Skip to content

Commit

Permalink
fix(form-builder): hide slug generate button if field has no source
Browse files Browse the repository at this point in the history
  • Loading branch information
rexxars committed Mar 11, 2021
1 parent 981d21d commit da6fc83
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions packages/@sanity/form-builder/src/inputs/Slug/SlugInput.tsx
Expand Up @@ -134,16 +134,18 @@ const SlugInput = React.forwardRef(function SlugInput(
</Card>
)}
</Box>
<Box marginLeft={1}>
<Button
mode="ghost"
type="button"
disabled={readOnly || isUpdating}
onClick={handleGenerateSlug}
onFocus={handleFocus}
text={generateState?.status === 'pending' ? 'Generating…' : 'Generate'}
/>
</Box>
{sourceField && (
<Box marginLeft={1}>
<Button
mode="ghost"
type="button"
disabled={readOnly || isUpdating}
onClick={handleGenerateSlug}
onFocus={handleFocus}
text={generateState?.status === 'pending' ? 'Generating…' : 'Generate'}
/>
</Box>
)}
</Flex>
</Stack>
</FormField>
Expand Down

2 comments on commit da6fc83

@vercel
Copy link

@vercel vercel bot commented on da6fc83 Mar 11, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

perf-studio – ./

perf-studio.sanity.build
perf-studio-git-next.sanity.build

@vercel
Copy link

@vercel vercel bot commented on da6fc83 Mar 11, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

test-studio – ./

test-studio-git-next.sanity.build
test-studio.sanity.build

Please sign in to comment.