Fixes to lineheight on web to counteract emoji issues

zio/stable
Paul Frazee 2023-02-24 11:40:43 -06:00
parent 80bd3398d7
commit d97e233518
8 changed files with 31 additions and 14 deletions

View File

@ -188,7 +188,7 @@ export const FeedItem = observer(function FeedItem({
style={styles.metaItem} style={styles.metaItem}
href={authors[0].href} href={authors[0].href}
title={`@${authors[0].handle}`}> title={`@${authors[0].handle}`}>
<Text style={[pal.text, s.bold]}> <Text style={[pal.text, s.bold]} lineHeight={1.2}>
{authors[0].displayName || authors[0].handle} {authors[0].displayName || authors[0].handle}
</Text> </Text>
</Link> </Link>
@ -333,10 +333,16 @@ function ExpandedAuthorsList({
/> />
</View> </View>
<View style={s.flex1}> <View style={s.flex1}>
<Text type="lg-bold" numberOfLines={1} style={pal.text}> <Text
type="lg-bold"
numberOfLines={1}
style={pal.text}
lineHeight={1.2}>
{author.displayName || author.handle} {author.displayName || author.handle}
&nbsp; &nbsp;
<Text style={[pal.textLight]}>{author.handle}</Text> <Text style={[pal.textLight]} lineHeight={1.2}>
{author.handle}
</Text>
</Text> </Text>
</View> </View>
</Link> </Link>

View File

@ -146,7 +146,11 @@ export const PostThreadItem = observer(function PostThreadItem({
style={styles.metaItem} style={styles.metaItem}
href={authorHref} href={authorHref}
title={authorTitle}> title={authorTitle}>
<Text type="xl-bold" style={[pal.text]} numberOfLines={1}> <Text
type="xl-bold"
style={[pal.text]}
numberOfLines={1}
lineHeight={1.2}>
{item.post.author.displayName || item.post.author.handle} {item.post.author.displayName || item.post.author.handle}
</Text> </Text>
</Link> </Link>

View File

@ -164,7 +164,7 @@ export const Post = observer(function Post({
size={9} size={9}
style={[pal.textLight, s.mr5]} style={[pal.textLight, s.mr5]}
/> />
<Text type="sm" style={[pal.textLight, s.mr2]}> <Text type="sm" style={[pal.textLight, s.mr2]} lineHeight={1.2}>
Reply to Reply to
</Text> </Text>
<UserInfoText <UserInfoText

View File

@ -155,7 +155,7 @@ export const FeedItem = observer(function ({
{color: pal.colors.textLight} as FontAwesomeIconStyle, {color: pal.colors.textLight} as FontAwesomeIconStyle,
]} ]}
/> />
<Text type="sm-bold" style={pal.textLight}> <Text type="sm-bold" style={pal.textLight} lineHeight={1.2}>
Reposted by{' '} Reposted by{' '}
{item.reasonRepost.by.displayName || item.reasonRepost.by.handle} {item.reasonRepost.by.displayName || item.reasonRepost.by.handle}
</Text> </Text>
@ -188,7 +188,7 @@ export const FeedItem = observer(function ({
s.mr5, s.mr5,
]} ]}
/> />
<Text type="md" style={[pal.textLight, s.mr2]}> <Text type="md" style={[pal.textLight, s.mr2]} lineHeight={1.2}>
Reply to Reply to
</Text> </Text>
<UserInfoText <UserInfoText

View File

@ -35,7 +35,11 @@ export function PostMeta(opts: PostMetaOpts) {
return ( return (
<View style={styles.meta}> <View style={styles.meta}>
<View style={[styles.metaItem, styles.maxWidth]}> <View style={[styles.metaItem, styles.maxWidth]}>
<Text type="lg-bold" style={[pal.text]} numberOfLines={1}> <Text
type="lg-bold"
style={[pal.text]}
numberOfLines={1}
lineHeight={1.2}>
{displayName} {displayName}
{handle ? ( {handle ? (
<Text type="md" style={[pal.textLight]}> <Text type="md" style={[pal.textLight]}>
@ -44,7 +48,7 @@ export function PostMeta(opts: PostMetaOpts) {
) : undefined} ) : undefined}
</Text> </Text>
</View> </View>
<Text type="md" style={[styles.metaItem, pal.textLight]}> <Text type="md" style={[styles.metaItem, pal.textLight]} lineHeight={1.2}>
&middot; {ago(opts.timestamp)} &middot; {ago(opts.timestamp)}
</Text> </Text>
</View> </View>

View File

@ -64,7 +64,7 @@ export function UserInfoText({
) )
} else if (profile) { } else if (profile) {
inner = ( inner = (
<Text type={type} style={style}>{`${prefix || ''}${ <Text type={type} style={style} lineHeight={1.2}>{`${prefix || ''}${
profile[attr] || profile.handle profile[attr] || profile.handle
}`}</Text> }`}</Text>
) )

View File

@ -73,14 +73,14 @@ export const ScrollView = React.forwardRef(function (
const styles = StyleSheet.create({ const styles = StyleSheet.create({
container: { container: {
width: '100%', width: '100%',
maxWidth: 600, maxWidth: 550,
marginLeft: 'auto', marginLeft: 'auto',
marginRight: 'auto', marginRight: 'auto',
}, },
containerScroll: { containerScroll: {
width: '100%', width: '100%',
height: `calc(100vh - ${DESKTOP_HEADER_HEIGHT}px)`, height: `calc(100vh - ${DESKTOP_HEADER_HEIGHT}px)`,
maxWidth: 600, maxWidth: 550,
marginLeft: 'auto', marginLeft: 'auto',
marginRight: 'auto', marginRight: 'auto',
}, },

View File

@ -1,22 +1,25 @@
import React from 'react' import React from 'react'
import {Text as RNText, TextProps} from 'react-native' import {Text as RNText, TextProps} from 'react-native'
import {s} from 'lib/styles' import {s, lh} from 'lib/styles'
import {useTheme, TypographyVariant} from 'lib/ThemeContext' import {useTheme, TypographyVariant} from 'lib/ThemeContext'
export type CustomTextProps = TextProps & { export type CustomTextProps = TextProps & {
type?: TypographyVariant type?: TypographyVariant
lineHeight?: number
} }
export function Text({ export function Text({
type = 'md', type = 'md',
children, children,
lineHeight,
style, style,
...props ...props
}: React.PropsWithChildren<CustomTextProps>) { }: React.PropsWithChildren<CustomTextProps>) {
const theme = useTheme() const theme = useTheme()
const typography = theme.typography[type] const typography = theme.typography[type]
const lineHeightStyle = lineHeight ? lh(theme, type, lineHeight) : undefined
return ( return (
<RNText style={[s.black, typography, style]} {...props}> <RNText style={[s.black, typography, lineHeightStyle, style]} {...props}>
{children} {children}
</RNText> </RNText>
) )