Skip to content

Commit

Permalink
fix: padding in dropdown and extra tooltip
Browse files Browse the repository at this point in the history
  • Loading branch information
SimeonGriggs committed May 26, 2023
1 parent f114091 commit 8e6d515
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 12 deletions.
8 changes: 4 additions & 4 deletions src/components/DocumentInternationalizationMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,13 @@ export function DocumentInternationalizationMenu(
}, [supportedLanguages])

const content = (
<Card>
<Box padding={1}>
{error ? (
<Card tone="critical" padding={2}>
<Card tone="critical" padding={1}>
<Text>There was an error returning translations metadata</Text>
</Card>
) : (
<Stack padding={1} space={1}>
<Stack space={1}>
<LanguageManage id={metadata?._id} />
{supportedLanguages.length > 4 ? (
<TextInput
Expand Down Expand Up @@ -186,7 +186,7 @@ export function DocumentInternationalizationMenu(
) : null}
</Stack>
)}
</Card>
</Box>
)

const issueWithTranslations =
Expand Down
33 changes: 25 additions & 8 deletions src/components/LanguageManage.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {CogIcon} from '@sanity/icons'
import {Button} from '@sanity/ui'
import {Box, Button, Stack, Text, Tooltip} from '@sanity/ui'

import {METADATA_SCHEMA_NAME} from '../constants'
import {useOpenInNewPane} from '../hooks/useOpenInNewPane'
Expand All @@ -13,12 +13,29 @@ export default function LanguageManage(props: LanguageManageProps) {
const open = useOpenInNewPane(id, METADATA_SCHEMA_NAME)

return (
<Button
disabled={!id}
mode="ghost"
text="Manage Translations"
icon={CogIcon}
onClick={() => open()}
/>
<Tooltip
content={
id ? null : (
<Box padding={2}>
<Text muted size={1}>
Document has no other translations
</Text>
</Box>
)
}
fallbackPlacements={['right', 'left']}
placement="top"
portal
>
<Stack>
<Button
disabled={!id}
mode="ghost"
text="Manage Translations"
icon={CogIcon}
onClick={() => open()}
/>
</Stack>
</Tooltip>
)
}

0 comments on commit 8e6d515

Please sign in to comment.