consolidate tag components
This commit is contained in:
@@ -30,33 +30,6 @@ export function Tag({
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function InlineTag({
|
|
||||||
value,
|
|
||||||
textSize,
|
|
||||||
}: {
|
|
||||||
value: string
|
|
||||||
textSize?: CustomTextProps['type']
|
|
||||||
}) {
|
|
||||||
const pal = usePalette('default')
|
|
||||||
const type = textSize || 'xs-medium'
|
|
||||||
|
|
||||||
return (
|
|
||||||
<TextLink
|
|
||||||
type={type}
|
|
||||||
text={`#${value}`}
|
|
||||||
accessible
|
|
||||||
href={`/search?q=${value}`}
|
|
||||||
style={[
|
|
||||||
pal.link,
|
|
||||||
{
|
|
||||||
paddingTop: 0,
|
|
||||||
paddingBottom: 2,
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
/>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
export function EditableTag({
|
export function EditableTag({
|
||||||
value,
|
value,
|
||||||
onRemove,
|
onRemove,
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import {lh} from 'lib/styles'
|
|||||||
import {toShortUrl} from 'lib/strings/url-helpers'
|
import {toShortUrl} from 'lib/strings/url-helpers'
|
||||||
import {useTheme, TypographyVariant} from 'lib/ThemeContext'
|
import {useTheme, TypographyVariant} from 'lib/ThemeContext'
|
||||||
import {usePalette} from 'lib/hooks/usePalette'
|
import {usePalette} from 'lib/hooks/usePalette'
|
||||||
import {InlineTag} from 'view/com/Tag'
|
import {Tag} from 'view/com/Tag'
|
||||||
|
|
||||||
const WORD_WRAP = {wordWrap: 1}
|
const WORD_WRAP = {wordWrap: 1}
|
||||||
|
|
||||||
@@ -95,7 +95,7 @@ export function RichText({
|
|||||||
/>,
|
/>,
|
||||||
)
|
)
|
||||||
} else if (tag && AppBskyRichtextFacet.validateTag(tag).success) {
|
} else if (tag && AppBskyRichtextFacet.validateTag(tag).success) {
|
||||||
els.push(<InlineTag key={key} value={tag.tag} textSize={type} />)
|
els.push(<Tag key={key} value={tag.tag} textSize={type} />)
|
||||||
} else {
|
} else {
|
||||||
els.push(segment.text)
|
els.push(segment.text)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user