Add rectangular shape to button (#9382)
This commit is contained in:
@@ -48,6 +48,7 @@ export function AppLanguageDropdown() {
|
|||||||
})}
|
})}
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
color="secondary"
|
color="secondary"
|
||||||
|
shape="rectangular"
|
||||||
style={[
|
style={[
|
||||||
a.pr_xs,
|
a.pr_xs,
|
||||||
a.pl_sm,
|
a.pl_sm,
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ export type ButtonColor =
|
|||||||
| 'primary_subtle'
|
| 'primary_subtle'
|
||||||
| 'negative_subtle'
|
| 'negative_subtle'
|
||||||
export type ButtonSize = 'tiny' | 'small' | 'large'
|
export type ButtonSize = 'tiny' | 'small' | 'large'
|
||||||
export type ButtonShape = 'round' | 'square' | 'default'
|
export type ButtonShape = 'round' | 'square' | 'rectangular' | 'default'
|
||||||
export type VariantProps = {
|
export type VariantProps = {
|
||||||
/**
|
/**
|
||||||
* The style variation of the button
|
* The style variation of the button
|
||||||
@@ -56,6 +56,11 @@ export type VariantProps = {
|
|||||||
size?: ButtonSize
|
size?: ButtonSize
|
||||||
/**
|
/**
|
||||||
* The shape of the button
|
* The shape of the button
|
||||||
|
*
|
||||||
|
* - `default`: Pill shaped. Most buttons should use this shape.
|
||||||
|
* - `round`: Circular. For icon-only buttons.
|
||||||
|
* - `square`: Square. For icon-only buttons.
|
||||||
|
* - `rectangular`: Rectangular. Matches previous style, use when adjacent to form fields.
|
||||||
*/
|
*/
|
||||||
shape?: ButtonShape
|
shape?: ButtonShape
|
||||||
}
|
}
|
||||||
@@ -453,6 +458,29 @@ export const Button = React.forwardRef<View, ButtonProps>(
|
|||||||
gap: 2,
|
gap: 2,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
} else if (shape === 'rectangular') {
|
||||||
|
if (size === 'large') {
|
||||||
|
baseStyles.push({
|
||||||
|
paddingVertical: 12,
|
||||||
|
paddingHorizontal: 25,
|
||||||
|
borderRadius: 10,
|
||||||
|
gap: 3,
|
||||||
|
})
|
||||||
|
} else if (size === 'small') {
|
||||||
|
baseStyles.push({
|
||||||
|
paddingVertical: 8,
|
||||||
|
paddingHorizontal: 13,
|
||||||
|
borderRadius: 8,
|
||||||
|
gap: 3,
|
||||||
|
})
|
||||||
|
} else if (size === 'tiny') {
|
||||||
|
baseStyles.push({
|
||||||
|
paddingVertical: 5,
|
||||||
|
paddingHorizontal: 9,
|
||||||
|
borderRadius: 6,
|
||||||
|
gap: 2,
|
||||||
|
})
|
||||||
|
}
|
||||||
} else if (shape === 'round' || shape === 'square') {
|
} else if (shape === 'round' || shape === 'square') {
|
||||||
/*
|
/*
|
||||||
* These sizes match the actual rendered size on screen, based on
|
* These sizes match the actual rendered size on screen, based on
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ export function Trigger({children, label}: TriggerProps) {
|
|||||||
style={[a.flex_1, a.justify_between]}
|
style={[a.flex_1, a.justify_between]}
|
||||||
color="secondary"
|
color="secondary"
|
||||||
size="small"
|
size="small"
|
||||||
variant="solid">
|
shape="rectangular">
|
||||||
<>{children}</>
|
<>{children}</>
|
||||||
</Button>
|
</Button>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -362,7 +362,8 @@ export function SearchScreenShell({
|
|||||||
size="large"
|
size="large"
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
color="secondary"
|
color="secondary"
|
||||||
style={[a.px_sm, a.rounded_sm]}
|
shape="rectangular"
|
||||||
|
style={[a.px_sm]}
|
||||||
onPress={onPressCancelSearch}
|
onPress={onPressCancelSearch}
|
||||||
hitSlop={HITSLOP_10}>
|
hitSlop={HITSLOP_10}>
|
||||||
<ButtonText>
|
<ButtonText>
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import Animated, {
|
|||||||
FadeOut,
|
FadeOut,
|
||||||
LayoutAnimationConfig,
|
LayoutAnimationConfig,
|
||||||
LinearTransition,
|
LinearTransition,
|
||||||
StretchOutY,
|
|
||||||
} from 'react-native-reanimated'
|
} from 'react-native-reanimated'
|
||||||
import {type ComAtprotoServerListAppPasswords} from '@atproto/api'
|
import {type ComAtprotoServerListAppPasswords} from '@atproto/api'
|
||||||
import {msg, Trans} from '@lingui/macro'
|
import {msg, Trans} from '@lingui/macro'
|
||||||
@@ -14,7 +13,6 @@ import {type NativeStackScreenProps} from '@react-navigation/native-stack'
|
|||||||
|
|
||||||
import {type CommonNavigatorParams} from '#/lib/routes/types'
|
import {type CommonNavigatorParams} from '#/lib/routes/types'
|
||||||
import {cleanError} from '#/lib/strings/errors'
|
import {cleanError} from '#/lib/strings/errors'
|
||||||
import {isWeb} from '#/platform/detection'
|
|
||||||
import {
|
import {
|
||||||
useAppPasswordDeleteMutation,
|
useAppPasswordDeleteMutation,
|
||||||
useAppPasswordsQuery,
|
useAppPasswordsQuery,
|
||||||
@@ -94,7 +92,7 @@ export function AppPasswordsScreen({}: Props) {
|
|||||||
key={appPassword.name}
|
key={appPassword.name}
|
||||||
style={a.w_full}
|
style={a.w_full}
|
||||||
entering={FadeIn}
|
entering={FadeIn}
|
||||||
exiting={isWeb ? FadeOut : StretchOutY}
|
exiting={FadeOut}
|
||||||
layout={LinearTransition.delay(150)}>
|
layout={LinearTransition.delay(150)}>
|
||||||
<SettingsList.Item>
|
<SettingsList.Item>
|
||||||
<AppPasswordCard appPassword={appPassword} />
|
<AppPasswordCard appPassword={appPassword} />
|
||||||
@@ -188,6 +186,7 @@ function AppPasswordCard({
|
|||||||
variant="ghost"
|
variant="ghost"
|
||||||
color="negative"
|
color="negative"
|
||||||
size="small"
|
size="small"
|
||||||
|
shape="square"
|
||||||
style={[a.bg_transparent]}
|
style={[a.bg_transparent]}
|
||||||
onPress={() => deleteControl.open()}>
|
onPress={() => deleteControl.open()}>
|
||||||
<ButtonIcon icon={TrashIcon} />
|
<ButtonIcon icon={TrashIcon} />
|
||||||
|
|||||||
@@ -164,7 +164,7 @@ export function LanguageSettingsScreen({}: Props) {
|
|||||||
label={_(msg`Select content languages`)}
|
label={_(msg`Select content languages`)}
|
||||||
size="small"
|
size="small"
|
||||||
color="secondary"
|
color="secondary"
|
||||||
variant="solid"
|
shape="rectangular"
|
||||||
onPress={onPressContentLanguages}
|
onPress={onPressContentLanguages}
|
||||||
style={[a.justify_start, web({maxWidth: 400})]}>
|
style={[a.justify_start, web({maxWidth: 400})]}>
|
||||||
<ButtonIcon
|
<ButtonIcon
|
||||||
|
|||||||
@@ -500,9 +500,14 @@ function OwnHandlePage({goToServiceHandle}: {goToServiceHandle: () => void}) {
|
|||||||
value={currentAccount?.did ?? ''}
|
value={currentAccount?.did ?? ''}
|
||||||
label={_(msg`Copy DID`)}
|
label={_(msg`Copy DID`)}
|
||||||
size="large"
|
size="large"
|
||||||
variant="solid"
|
shape="rectangular"
|
||||||
color="secondary"
|
color="secondary"
|
||||||
style={[a.px_md, a.border, t.atoms.border_contrast_low]}>
|
style={[
|
||||||
|
a.px_md,
|
||||||
|
a.border,
|
||||||
|
t.atoms.border_contrast_low,
|
||||||
|
t.atoms.bg_contrast_25,
|
||||||
|
]}>
|
||||||
<Text style={[a.text_md, a.flex_1]}>{currentAccount?.did}</Text>
|
<Text style={[a.text_md, a.flex_1]}>{currentAccount?.did}</Text>
|
||||||
<ButtonIcon icon={CopyIcon} />
|
<ButtonIcon icon={CopyIcon} />
|
||||||
</CopyButton>
|
</CopyButton>
|
||||||
|
|||||||
Reference in New Issue
Block a user