Build in tracking to text atoms

This commit is contained in:
Eric Bailey
2024-02-19 17:26:51 -06:00
parent 688868a7a9
commit 579f20eca6
6 changed files with 21 additions and 18 deletions
+14 -1
View File
@@ -176,33 +176,43 @@ export const atoms = {
}, },
text_2xs: { text_2xs: {
fontSize: tokens.fontSize._2xs, fontSize: tokens.fontSize._2xs,
letterSpacing: 0.25,
}, },
text_xs: { text_xs: {
fontSize: tokens.fontSize.xs, fontSize: tokens.fontSize.xs,
letterSpacing: 0.25,
}, },
text_sm: { text_sm: {
fontSize: tokens.fontSize.sm, fontSize: tokens.fontSize.sm,
letterSpacing: 0.25,
}, },
text_md: { text_md: {
fontSize: tokens.fontSize.md, fontSize: tokens.fontSize.md,
letterSpacing: 0.25,
}, },
text_lg: { text_lg: {
fontSize: tokens.fontSize.lg, fontSize: tokens.fontSize.lg,
letterSpacing: 0.25,
}, },
text_xl: { text_xl: {
fontSize: tokens.fontSize.xl, fontSize: tokens.fontSize.xl,
letterSpacing: 0.25,
}, },
text_2xl: { text_2xl: {
fontSize: tokens.fontSize._2xl, fontSize: tokens.fontSize._2xl,
letterSpacing: 0.25,
}, },
text_3xl: { text_3xl: {
fontSize: tokens.fontSize._3xl, fontSize: tokens.fontSize._3xl,
letterSpacing: 0.25,
}, },
text_4xl: { text_4xl: {
fontSize: tokens.fontSize._4xl, fontSize: tokens.fontSize._4xl,
letterSpacing: 0.25,
}, },
text_5xl: { text_5xl: {
fontSize: tokens.fontSize._5xl, fontSize: tokens.fontSize._5xl,
letterSpacing: 0.25,
}, },
leading_tight: { leading_tight: {
lineHeight: 1.15, lineHeight: 1.15,
@@ -213,8 +223,11 @@ export const atoms = {
leading_normal: { leading_normal: {
lineHeight: 1.5, lineHeight: 1.5,
}, },
tracking_normal: {
letterSpacing: 0,
},
tracking_wide: { tracking_wide: {
letterSpacing: 0.2, letterSpacing: 0.25,
}, },
font_normal: { font_normal: {
fontWeight: tokens.fontWeight.normal, fontWeight: tokens.fontWeight.normal,
+2 -2
View File
@@ -1,7 +1,7 @@
import React from 'react' import React from 'react'
import {RichText as RichTextAPI, AppBskyRichtextFacet} from '@atproto/api' import {RichText as RichTextAPI, AppBskyRichtextFacet} from '@atproto/api'
import {atoms as a, TextStyleProp} from '#/alf' import {atoms as a, TextStyleProp, flatten} from '#/alf'
import {InlineLink} from '#/components/Link' import {InlineLink} from '#/components/Link'
import {Text, TextProps} from '#/components/Typography' import {Text, TextProps} from '#/components/Typography'
import {toShortUrl} from 'lib/strings/url-helpers' import {toShortUrl} from 'lib/strings/url-helpers'
@@ -29,7 +29,7 @@ export function RichText({
const [richText, setRichText] = React.useState<RichTextAPI>(() => const [richText, setRichText] = React.useState<RichTextAPI>(() =>
value instanceof RichTextAPI ? value : new RichTextAPI({text: value}), value instanceof RichTextAPI ? value : new RichTextAPI({text: value}),
) )
const styles = [a.leading_tight, style] const styles = [a.leading_snug, flatten(style)]
React.useEffect(() => { React.useEffect(() => {
if (!resolveFacets) return if (!resolveFacets) return
+2 -12
View File
@@ -328,12 +328,7 @@ let PostThreadItemLoaded = ({
]}> ]}>
<RichText <RichText
value={richText} value={richText}
style={[ style={[a.flex_1, a.leading_snug, a.text_xl]}
a.flex_1,
a.leading_snug,
a.text_xl,
a.tracking_wide,
]}
selectable selectable
/> />
</View> </View>
@@ -527,12 +522,7 @@ let PostThreadItemLoaded = ({
<View style={styles.postTextContainer}> <View style={styles.postTextContainer}>
<RichText <RichText
value={richText} value={richText}
style={[ style={[a.flex_1, a.leading_snug, a.text_md]}
a.flex_1,
a.leading_snug,
a.text_md,
a.tracking_wide,
]}
numberOfLines={limitLines ? MAX_POST_LINES : undefined} numberOfLines={limitLines ? MAX_POST_LINES : undefined}
/> />
</View> </View>
+1 -1
View File
@@ -350,7 +350,7 @@ let PostContent = ({
testID="postText" testID="postText"
value={richText} value={richText}
numberOfLines={limitLines ? MAX_POST_LINES : undefined} numberOfLines={limitLines ? MAX_POST_LINES : undefined}
style={[a.flex_1, a.leading_snug, a.tracking_wide, a.text_md]} style={[a.flex_1, a.leading_snug, a.text_md]}
/> />
</View> </View>
) : undefined} ) : undefined}
+1 -1
View File
@@ -129,7 +129,7 @@ export function QuoteEmbed({
{richText ? ( {richText ? (
<RichText <RichText
value={richText} value={richText}
style={[a.text_md, a.tracking_wide]} style={[a.text_md]}
numberOfLines={20} numberOfLines={20}
disableLinks disableLinks
/> />
+1 -1
View File
@@ -576,7 +576,7 @@ function AboutSection({
{feedInfo.description ? ( {feedInfo.description ? (
<RichText <RichText
testID="listDescription" testID="listDescription"
style={[a.text_md, a.leading_snug, a.tracking_wide]} style={[a.text_md, a.leading_snug]}
value={feedInfo.description} value={feedInfo.description}
/> />
) : ( ) : (