diff options
author | Paul Frazee <pfrazee@gmail.com> | 2023-04-05 18:56:02 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-05 18:56:02 -0500 |
commit | ea04c2bd330dc5b46d6f9df0d7d4619bbd8f56d0 (patch) | |
tree | 870c7d3dbffe1f382cba30b858eaa2b76b31af36 /src/view/com/util | |
parent | 8e28d3c6be8e063b6d563b0068cb4fc907ff5df0 (diff) | |
download | voidsky-ea04c2bd330dc5b46d6f9df0d7d4619bbd8f56d0.tar.zst |
Add user invite codes (#393)
* Add mobile UIs for invite codes * Update invite code UIs for web * Finish implementing invite code behaviors (including notifications of invited users) * Bump deps * Update web right nav to use real data; also fix lint
Diffstat (limited to 'src/view/com/util')
-rw-r--r-- | src/view/com/util/PostMeta.tsx | 4 | ||||
-rw-r--r-- | src/view/com/util/forms/Button.tsx | 148 |
2 files changed, 80 insertions, 72 deletions
diff --git a/src/view/com/util/PostMeta.tsx b/src/view/com/util/PostMeta.tsx index 870f503f2..cebab59c0 100644 --- a/src/view/com/util/PostMeta.tsx +++ b/src/view/com/util/PostMeta.tsx @@ -7,7 +7,7 @@ import {usePalette} from 'lib/hooks/usePalette' import {useStores} from 'state/index' import {UserAvatar} from './UserAvatar' import {observer} from 'mobx-react-lite' -import FollowButton from '../profile/FollowButton' +import {FollowButton} from '../profile/FollowButton' import {FollowState} from 'state/models/cache/my-follows' interface PostMetaOpts { @@ -78,7 +78,7 @@ export const PostMeta = observer(function (opts: PostMetaOpts) { <View> <FollowButton - type="default" + unfollowedType="default" did={opts.did} onToggleFollow={onToggleFollow} /> diff --git a/src/view/com/util/forms/Button.tsx b/src/view/com/util/forms/Button.tsx index b7c058d2d..a634b47a9 100644 --- a/src/view/com/util/forms/Button.tsx +++ b/src/view/com/util/forms/Button.tsx @@ -25,6 +25,7 @@ export function Button({ type = 'primary', label, style, + labelStyle, onPress, children, testID, @@ -32,87 +33,94 @@ export function Button({ type?: ButtonType label?: string style?: StyleProp<ViewStyle> + labelStyle?: StyleProp<TextStyle> onPress?: () => void testID?: string }>) { const theme = useTheme() - const outerStyle = choose<ViewStyle, Record<ButtonType, ViewStyle>>(type, { - primary: { - backgroundColor: theme.palette.primary.background, + const typeOuterStyle = choose<ViewStyle, Record<ButtonType, ViewStyle>>( + type, + { + primary: { + backgroundColor: theme.palette.primary.background, + }, + secondary: { + backgroundColor: theme.palette.secondary.background, + }, + default: { + backgroundColor: theme.palette.default.backgroundLight, + }, + inverted: { + backgroundColor: theme.palette.inverted.background, + }, + 'primary-outline': { + backgroundColor: theme.palette.default.background, + borderWidth: 1, + borderColor: theme.palette.primary.border, + }, + 'secondary-outline': { + backgroundColor: theme.palette.default.background, + borderWidth: 1, + borderColor: theme.palette.secondary.border, + }, + 'primary-light': { + backgroundColor: theme.palette.default.background, + }, + 'secondary-light': { + backgroundColor: theme.palette.default.background, + }, + 'default-light': { + backgroundColor: theme.palette.default.background, + }, }, - secondary: { - backgroundColor: theme.palette.secondary.background, - }, - default: { - backgroundColor: theme.palette.default.backgroundLight, - }, - inverted: { - backgroundColor: theme.palette.inverted.background, - }, - 'primary-outline': { - backgroundColor: theme.palette.default.background, - borderWidth: 1, - borderColor: theme.palette.primary.border, - }, - 'secondary-outline': { - backgroundColor: theme.palette.default.background, - borderWidth: 1, - borderColor: theme.palette.secondary.border, - }, - 'primary-light': { - backgroundColor: theme.palette.default.background, - }, - 'secondary-light': { - backgroundColor: theme.palette.default.background, - }, - 'default-light': { - backgroundColor: theme.palette.default.background, - }, - }) - const labelStyle = choose<TextStyle, Record<ButtonType, TextStyle>>(type, { - primary: { - color: theme.palette.primary.text, - fontWeight: '600', - }, - secondary: { - color: theme.palette.secondary.text, - fontWeight: theme.palette.secondary.isLowContrast ? '500' : undefined, - }, - default: { - color: theme.palette.default.text, - }, - inverted: { - color: theme.palette.inverted.text, - fontWeight: '600', - }, - 'primary-outline': { - color: theme.palette.primary.textInverted, - fontWeight: theme.palette.primary.isLowContrast ? '500' : undefined, - }, - 'secondary-outline': { - color: theme.palette.secondary.textInverted, - fontWeight: theme.palette.secondary.isLowContrast ? '500' : undefined, - }, - 'primary-light': { - color: theme.palette.primary.textInverted, - fontWeight: theme.palette.primary.isLowContrast ? '500' : undefined, - }, - 'secondary-light': { - color: theme.palette.secondary.textInverted, - fontWeight: theme.palette.secondary.isLowContrast ? '500' : undefined, - }, - 'default-light': { - color: theme.palette.default.text, - fontWeight: theme.palette.default.isLowContrast ? '500' : undefined, + ) + const typeLabelStyle = choose<TextStyle, Record<ButtonType, TextStyle>>( + type, + { + primary: { + color: theme.palette.primary.text, + fontWeight: '600', + }, + secondary: { + color: theme.palette.secondary.text, + fontWeight: theme.palette.secondary.isLowContrast ? '500' : undefined, + }, + default: { + color: theme.palette.default.text, + }, + inverted: { + color: theme.palette.inverted.text, + fontWeight: '600', + }, + 'primary-outline': { + color: theme.palette.primary.textInverted, + fontWeight: theme.palette.primary.isLowContrast ? '500' : undefined, + }, + 'secondary-outline': { + color: theme.palette.secondary.textInverted, + fontWeight: theme.palette.secondary.isLowContrast ? '500' : undefined, + }, + 'primary-light': { + color: theme.palette.primary.textInverted, + fontWeight: theme.palette.primary.isLowContrast ? '500' : undefined, + }, + 'secondary-light': { + color: theme.palette.secondary.textInverted, + fontWeight: theme.palette.secondary.isLowContrast ? '500' : undefined, + }, + 'default-light': { + color: theme.palette.default.text, + fontWeight: theme.palette.default.isLowContrast ? '500' : undefined, + }, }, - }) + ) return ( <TouchableOpacity - style={[outerStyle, styles.outer, style]} + style={[typeOuterStyle, styles.outer, style]} onPress={onPress} testID={testID}> {label ? ( - <Text type="button" style={[labelStyle]}> + <Text type="button" style={[typeLabelStyle, labelStyle]}> {label} </Text> ) : ( |