Hide tags behind button

This commit is contained in:
Eric Bailey
2024-10-23 10:25:56 -05:00
parent c02c919252
commit c09345c603
2 changed files with 46 additions and 4 deletions
@@ -217,7 +217,7 @@ export function OutlineTags({
}, [closeDropdownAndReset]) }, [closeDropdownAndReset])
return ( return (
<View ref={containerRef as any} style={[a.px_sm]}> <View ref={containerRef as any} style={[a.w_full]}>
<View style={[a.flex_row, a.align_start, a.flex_wrap, a.gap_sm]}> <View style={[a.flex_row, a.align_start, a.flex_wrap, a.gap_sm]}>
{tags.map((tag, i) => ( {tags.map((tag, i) => (
<TagButton key={tag + i} onPress={() => removeTag(tag)}> <TagButton key={tag + i} onPress={() => removeTag(tag)}>
@@ -247,7 +247,7 @@ export function OutlineTags({
paddingVertical: 4, paddingVertical: 4,
}, },
]} ]}
placeholder="Add outline tags" placeholder="Add tags"
autoCapitalize="none" autoCapitalize="none"
autoCorrect={false} autoCorrect={false}
autoComplete="off" autoComplete="off"
+43 -1
View File
@@ -106,8 +106,10 @@ import {UserAvatar} from '#/view/com/util/UserAvatar'
import {atoms as a, native, useTheme} from '#/alf' import {atoms as a, native, useTheme} from '#/alf'
import {Button, ButtonIcon, ButtonText} from '#/components/Button' import {Button, ButtonIcon, ButtonText} from '#/components/Button'
import {OutlineTags} from '#/components/Composer/OutlineTags' import {OutlineTags} from '#/components/Composer/OutlineTags'
import {Divider} from '#/components/Divider'
import {CircleInfo_Stroke2_Corner0_Rounded as CircleInfo} from '#/components/icons/CircleInfo' import {CircleInfo_Stroke2_Corner0_Rounded as CircleInfo} from '#/components/icons/CircleInfo'
import {EmojiArc_Stroke2_Corner0_Rounded as EmojiSmile} from '#/components/icons/Emoji' import {EmojiArc_Stroke2_Corner0_Rounded as EmojiSmile} from '#/components/icons/Emoji'
import {Hashtag_Stroke2_Corner0_Rounded as Hashtag} from '#/components/icons/Hashtag'
import {TimesLarge_Stroke2_Corner0_Rounded as X} from '#/components/icons/Times' import {TimesLarge_Stroke2_Corner0_Rounded as X} from '#/components/icons/Times'
import * as Prompt from '#/components/Prompt' import * as Prompt from '#/components/Prompt'
import {Text as NewText} from '#/components/Typography' import {Text as NewText} from '#/components/Typography'
@@ -522,6 +524,9 @@ export const ComposePost = ({
[dispatch], [dispatch],
) )
const [showOutlineTags, setShowOutlineTags] = useState(false)
const outlineTagsVisible = showOutlineTags || draft.tags.length > 0
const { const {
scrollHandler, scrollHandler,
onScrollViewContentSizeChange, onScrollViewContentSizeChange,
@@ -758,10 +763,33 @@ export const ComposePost = ({
</Animated.ScrollView> </Animated.ScrollView>
<SuggestedLanguage text={richtext.text} /> <SuggestedLanguage text={richtext.text} />
{outlineTagsVisible && (
<View style={[a.px_lg]}>
<Divider />
<View style={[a.flex_row, a.gap_xs, a.pt_sm, a.pb_md]}>
<View
style={[
{
paddingTop: 1,
},
]}>
<Hashtag size="md" />
</View>
<View style={[a.flex_1]}>
<OutlineTags onChangeTags={onChangeOutlineTags} /> <OutlineTags onChangeTags={onChangeOutlineTags} />
</View>
</View>
</View>
)}
<Animated.View <Animated.View
style={[a.flex_row, a.p_sm, t.atoms.bg, bottomBarAnimatedStyle]}> style={[
a.flex_row,
a.pb_md,
a.px_lg,
t.atoms.bg,
bottomBarAnimatedStyle,
]}>
<ScrollView <ScrollView
contentContainerStyle={[a.gap_sm]} contentContainerStyle={[a.gap_sm]}
horizontal={true} horizontal={true}
@@ -790,6 +818,20 @@ export const ComposePost = ({
}} }}
hasMedia={hasMedia || Boolean(extLink)} hasMedia={hasMedia || Boolean(extLink)}
/> />
{!outlineTagsVisible && (
<Button
label={_(msg`Add tags`)}
size="small"
variant="solid"
color="secondary"
onPress={() => setShowOutlineTags(true)}>
<ButtonIcon icon={Hashtag} position="left" />
<ButtonText>
<Trans>Add tags</Trans>
</ButtonText>
</Button>
)}
</ScrollView> </ScrollView>
</Animated.View> </Animated.View>
<View <View