Skip to content

Commit

Permalink
Merge branch 'liby-bugfix/desktop-web-text-link-media-query-issue' in…
Browse files Browse the repository at this point in the history
…to main
  • Loading branch information
pfrazee committed Oct 31, 2023
2 parents e1dcedd + 9826e7c commit e18e7ce
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 16 deletions.
6 changes: 3 additions & 3 deletions src/view/com/posts/FeedItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
} from '@fortawesome/react-native-fontawesome'
import {PostsFeedItemModel} from 'state/models/feeds/post'
import {FeedSourceInfo} from 'lib/api/feed/types'
import {Link, DesktopWebTextLink} from '../util/Link'
import {Link, TextLinkOnWebOnly} from '../util/Link'
import {Text} from '../util/text/Text'
import {UserInfoText} from '../util/UserInfoText'
import {PostMeta} from '../util/PostMeta'
Expand Down Expand Up @@ -189,7 +189,7 @@ export const FeedItem = observer(function FeedItemImpl({
lineHeight={1.2}
numberOfLines={1}>
From{' '}
<DesktopWebTextLink
<TextLinkOnWebOnly
type="sm-bold"
style={pal.textLight}
lineHeight={1.2}
Expand Down Expand Up @@ -220,7 +220,7 @@ export const FeedItem = observer(function FeedItemImpl({
lineHeight={1.2}
numberOfLines={1}>
Reposted by{' '}
<DesktopWebTextLink
<TextLinkOnWebOnly
type="sm-bold"
style={pal.textLight}
lineHeight={1.2}
Expand Down
13 changes: 5 additions & 8 deletions src/view/com/util/Link.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,10 @@ import {
isExternalUrl,
linkRequiresWarning,
} from 'lib/strings/url-helpers'
import {isAndroid} from 'platform/detection'
import {isAndroid, isWeb} from 'platform/detection'
import {sanitizeUrl} from '@braintree/sanitize-url'
import {PressableWithHover} from './PressableWithHover'
import FixedTouchableHighlight from '../pager/FixedTouchableHighlight'
import {useWebMediaQueries} from 'lib/hooks/useWebMediaQueries'

type Event =
| React.MouseEvent<HTMLAnchorElement, MouseEvent>
Expand Down Expand Up @@ -222,7 +221,7 @@ export const TextLink = memo(function TextLink({
/**
* Only acts as a link on desktop web
*/
interface DesktopWebTextLinkProps extends TextProps {
interface TextLinkOnWebOnlyProps extends TextProps {
testID?: string
type?: TypographyVariant
style?: StyleProp<TextStyle>
Expand All @@ -235,7 +234,7 @@ interface DesktopWebTextLinkProps extends TextProps {
accessibilityHint?: string
title?: string
}
export const DesktopWebTextLink = memo(function DesktopWebTextLink({
export const TextLinkOnWebOnly = memo(function DesktopWebTextLink({
testID,
type = 'md',
style,
Expand All @@ -244,10 +243,8 @@ export const DesktopWebTextLink = memo(function DesktopWebTextLink({
numberOfLines,
lineHeight,
...props
}: DesktopWebTextLinkProps) {
const {isDesktop} = useWebMediaQueries()

if (isDesktop) {
}: TextLinkOnWebOnlyProps) {
if (isWeb) {
return (
<TextLink
testID={testID}
Expand Down
6 changes: 3 additions & 3 deletions src/view/com/util/PostMeta.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react'
import {StyleProp, StyleSheet, TextStyle, View, ViewStyle} from 'react-native'
import {Text} from './text/Text'
import {DesktopWebTextLink} from './Link'
import {TextLinkOnWebOnly} from './Link'
import {niceDate} from 'lib/strings/time'
import {usePalette} from 'lib/hooks/usePalette'
import {TypographyVariant} from 'lib/ThemeContext'
Expand Down Expand Up @@ -47,7 +47,7 @@ export const PostMeta = observer(function PostMetaImpl(opts: PostMetaOpts) {
</View>
)}
<View style={styles.maxWidth}>
<DesktopWebTextLink
<TextLinkOnWebOnly
type={opts.displayNameType || 'lg-bold'}
style={[pal.text, opts.displayNameStyle]}
numberOfLines={1}
Expand Down Expand Up @@ -78,7 +78,7 @@ export const PostMeta = observer(function PostMetaImpl(opts: PostMetaOpts) {
)}
<TimeElapsed timestamp={opts.timestamp}>
{({timeElapsed}) => (
<DesktopWebTextLink
<TextLinkOnWebOnly
type="md"
style={pal.textLight}
lineHeight={1.2}
Expand Down
4 changes: 2 additions & 2 deletions src/view/com/util/UserInfoText.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, {useState, useEffect} from 'react'
import {AppBskyActorGetProfile as GetProfile} from '@atproto/api'
import {StyleProp, StyleSheet, TextStyle} from 'react-native'
import {DesktopWebTextLink} from './Link'
import {TextLinkOnWebOnly} from './Link'
import {Text} from './text/Text'
import {LoadingPlaceholder} from './LoadingPlaceholder'
import {useStores} from 'state/index'
Expand Down Expand Up @@ -65,7 +65,7 @@ export function UserInfoText({
)
} else if (profile) {
inner = (
<DesktopWebTextLink
<TextLinkOnWebOnly
type={type}
style={style}
lineHeight={1.2}
Expand Down

0 comments on commit e18e7ce

Please sign in to comment.