Visual improvements to post embeds for external links
parent
90ac2fe1fc
commit
41337f6d17
|
@ -1,6 +1,7 @@
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
import {StyleSheet, StyleProp, View, ViewStyle} from 'react-native'
|
import {Image, StyleSheet, StyleProp, View, ViewStyle} from 'react-native'
|
||||||
import {AppBskyEmbedImages, AppBskyEmbedExternal} from '@atproto/api'
|
import {AppBskyEmbedImages, AppBskyEmbedExternal} from '@atproto/api'
|
||||||
|
import LinearGradient from 'react-native-linear-gradient'
|
||||||
import {Link} from '../util/Link'
|
import {Link} from '../util/Link'
|
||||||
import {Text} from './text/Text'
|
import {Text} from './text/Text'
|
||||||
import {AutoSizedImage} from './images/AutoSizedImage'
|
import {AutoSizedImage} from './images/AutoSizedImage'
|
||||||
|
@ -8,6 +9,8 @@ import {ImageLayoutGrid} from './images/ImageLayoutGrid'
|
||||||
import {ImagesLightbox} from '../../../state/models/shell-ui'
|
import {ImagesLightbox} from '../../../state/models/shell-ui'
|
||||||
import {useStores} from '../../../state'
|
import {useStores} from '../../../state'
|
||||||
import {usePalette} from '../../lib/hooks/usePalette'
|
import {usePalette} from '../../lib/hooks/usePalette'
|
||||||
|
import {gradients} from '../../lib/styles'
|
||||||
|
import {DEF_AVATAR} from '../../lib/assets'
|
||||||
|
|
||||||
type Embed =
|
type Embed =
|
||||||
| AppBskyEmbedImages.Presented
|
| AppBskyEmbedImages.Presented
|
||||||
|
@ -80,22 +83,37 @@ export function PostEmbeds({
|
||||||
href={link.uri}
|
href={link.uri}
|
||||||
noFeedback>
|
noFeedback>
|
||||||
{link.thumb ? (
|
{link.thumb ? (
|
||||||
<AutoSizedImage uri={link.thumb} containerStyle={{borderRadius: 4}} />
|
<AutoSizedImage uri={link.thumb} containerStyle={styles.extImage} />
|
||||||
) : undefined}
|
) : (
|
||||||
<Text type="h5" numberOfLines={2} style={pal.text}>
|
<LinearGradient
|
||||||
|
colors={[gradients.blue.start, gradients.blue.end]}
|
||||||
|
start={{x: 0, y: 0}}
|
||||||
|
end={{x: 1, y: 1}}
|
||||||
|
style={[styles.extImage, styles.extImageFallback]}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
<View style={styles.extInner}>
|
||||||
|
<Text
|
||||||
|
type="body2"
|
||||||
|
numberOfLines={2}
|
||||||
|
style={[pal.text, styles.extTitle]}>
|
||||||
{link.title || link.uri}
|
{link.title || link.uri}
|
||||||
</Text>
|
</Text>
|
||||||
<Text type="body2" numberOfLines={1} style={pal.textLight}>
|
<Text
|
||||||
|
type="body2"
|
||||||
|
numberOfLines={1}
|
||||||
|
style={[pal.textLight, styles.extUri]}>
|
||||||
{link.uri}
|
{link.uri}
|
||||||
</Text>
|
</Text>
|
||||||
{link.description ? (
|
{link.description ? (
|
||||||
<Text
|
<Text
|
||||||
type="body1"
|
type="body2"
|
||||||
numberOfLines={2}
|
numberOfLines={2}
|
||||||
style={[pal.text, styles.extDescription]}>
|
style={[pal.text, styles.extDescription]}>
|
||||||
{link.description}
|
{link.description}
|
||||||
</Text>
|
</Text>
|
||||||
) : undefined}
|
) : undefined}
|
||||||
|
</View>
|
||||||
</Link>
|
</Link>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -107,11 +125,28 @@ const styles = StyleSheet.create({
|
||||||
marginTop: 4,
|
marginTop: 4,
|
||||||
},
|
},
|
||||||
extOuter: {
|
extOuter: {
|
||||||
padding: 10,
|
|
||||||
borderWidth: 1,
|
borderWidth: 1,
|
||||||
borderRadius: 4,
|
borderRadius: 8,
|
||||||
marginTop: 4,
|
marginTop: 4,
|
||||||
},
|
},
|
||||||
|
extInner: {
|
||||||
|
padding: 10,
|
||||||
|
},
|
||||||
|
extImage: {
|
||||||
|
borderTopLeftRadius: 6,
|
||||||
|
borderTopRightRadius: 6,
|
||||||
|
width: '100%',
|
||||||
|
height: 200,
|
||||||
|
},
|
||||||
|
extImageFallback: {
|
||||||
|
height: 160,
|
||||||
|
},
|
||||||
|
extTitle: {
|
||||||
|
fontWeight: '600',
|
||||||
|
},
|
||||||
|
extUri: {
|
||||||
|
marginTop: 2,
|
||||||
|
},
|
||||||
extDescription: {
|
extDescription: {
|
||||||
marginTop: 4,
|
marginTop: 4,
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue