tweak web styles
This commit is contained in:
@@ -5,8 +5,8 @@ import {msg, Trans} from '@lingui/macro'
|
|||||||
import {useLingui} from '@lingui/react'
|
import {useLingui} from '@lingui/react'
|
||||||
|
|
||||||
import {createSanitizedDisplayName} from '#/lib/moderation/create-sanitized-display-name'
|
import {createSanitizedDisplayName} from '#/lib/moderation/create-sanitized-display-name'
|
||||||
import {isNative} from '#/platform/detection'
|
import {isWeb} from '#/platform/detection'
|
||||||
import {useTheme, web} from '#/alf'
|
import {platform, useTheme, web} from '#/alf'
|
||||||
import {atoms as a} from '#/alf'
|
import {atoms as a} from '#/alf'
|
||||||
import {Button, type ButtonProps, ButtonText} from '#/components/Button'
|
import {Button, type ButtonProps, ButtonText} from '#/components/Button'
|
||||||
import * as Dialog from '#/components/Dialog'
|
import * as Dialog from '#/components/Dialog'
|
||||||
@@ -85,9 +85,18 @@ function DialogInner({
|
|||||||
color: hasAny ? 'primary' : 'negative',
|
color: hasAny ? 'primary' : 'negative',
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return {
|
// on web, a disabled save button feels more natural than a massive close button
|
||||||
label: _(msg`Cancel`),
|
if (isWeb) {
|
||||||
color: 'secondary',
|
return {
|
||||||
|
label: _(msg`Save changes`),
|
||||||
|
color: 'secondary',
|
||||||
|
disabled: true,
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return {
|
||||||
|
label: _(msg`Cancel`),
|
||||||
|
color: 'secondary',
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [state, _])
|
}, [state, _])
|
||||||
@@ -130,36 +139,47 @@ function DialogInner({
|
|||||||
<Toggle.Item
|
<Toggle.Item
|
||||||
label={_(msg`Posts`)}
|
label={_(msg`Posts`)}
|
||||||
name="posts"
|
name="posts"
|
||||||
style={[a.justify_between, a.py_xs]}>
|
style={[
|
||||||
|
a.flex_1,
|
||||||
|
a.py_xs,
|
||||||
|
platform({
|
||||||
|
native: [a.justify_between],
|
||||||
|
web: [a.flex_row_reverse, a.gap_sm],
|
||||||
|
}),
|
||||||
|
]}>
|
||||||
<Toggle.LabelText
|
<Toggle.LabelText
|
||||||
style={[t.atoms.text, a.font_normal, a.text_md]}>
|
style={[t.atoms.text, a.font_normal, a.text_md, a.flex_1]}>
|
||||||
<Trans>Posts</Trans>
|
<Trans>Posts</Trans>
|
||||||
</Toggle.LabelText>
|
</Toggle.LabelText>
|
||||||
<Toggle.Platform />
|
<Toggle.Switch />
|
||||||
</Toggle.Item>
|
</Toggle.Item>
|
||||||
<Toggle.Item
|
<Toggle.Item
|
||||||
label={_(msg`Replies`)}
|
label={_(msg`Replies`)}
|
||||||
name="replies"
|
name="replies"
|
||||||
style={[a.justify_between, a.py_xs]}>
|
style={[
|
||||||
|
a.flex_1,
|
||||||
|
a.py_xs,
|
||||||
|
platform({
|
||||||
|
native: [a.justify_between],
|
||||||
|
web: [a.flex_row_reverse, a.gap_sm],
|
||||||
|
}),
|
||||||
|
]}>
|
||||||
<Toggle.LabelText
|
<Toggle.LabelText
|
||||||
style={[t.atoms.text, a.font_normal, a.text_md]}>
|
style={[t.atoms.text, a.font_normal, a.text_md, a.flex_1]}>
|
||||||
<Trans>Replies</Trans>
|
<Trans>Replies</Trans>
|
||||||
</Toggle.LabelText>
|
</Toggle.LabelText>
|
||||||
<Toggle.Platform />
|
<Toggle.Switch />
|
||||||
</Toggle.Item>
|
</Toggle.Item>
|
||||||
</View>
|
</View>
|
||||||
</Toggle.Group>
|
</Toggle.Group>
|
||||||
|
|
||||||
{/* don't show cancel button on web */}
|
<Button
|
||||||
{(isNative || buttonProps.color !== 'secondary') && (
|
{...buttonProps}
|
||||||
<Button
|
size="large"
|
||||||
{...buttonProps}
|
variant="solid"
|
||||||
size="large"
|
onPress={() => control.close()}>
|
||||||
variant="solid"
|
<ButtonText>{buttonProps.label}</ButtonText>
|
||||||
onPress={() => control.close()}>
|
</Button>
|
||||||
<ButtonText>{buttonProps.label}</ButtonText>
|
|
||||||
</Button>
|
|
||||||
)}
|
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
<Dialog.Close />
|
<Dialog.Close />
|
||||||
|
|||||||
Reference in New Issue
Block a user