From 41337f6d17f4ce4bc3d0bc0b729c7d7d692eebff Mon Sep 17 00:00:00 2001 From: Paul Frazee Date: Tue, 17 Jan 2023 16:42:32 -0600 Subject: Visual improvements to post embeds for external links --- src/view/com/util/PostEmbeds.tsx | 67 ++++++++++++++++++++++++++++++---------- 1 file changed, 51 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/view/com/util/PostEmbeds.tsx b/src/view/com/util/PostEmbeds.tsx index b0122a700..d38dd6c08 100644 --- a/src/view/com/util/PostEmbeds.tsx +++ b/src/view/com/util/PostEmbeds.tsx @@ -1,6 +1,7 @@ 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 LinearGradient from 'react-native-linear-gradient' import {Link} from '../util/Link' import {Text} from './text/Text' import {AutoSizedImage} from './images/AutoSizedImage' @@ -8,6 +9,8 @@ import {ImageLayoutGrid} from './images/ImageLayoutGrid' import {ImagesLightbox} from '../../../state/models/shell-ui' import {useStores} from '../../../state' import {usePalette} from '../../lib/hooks/usePalette' +import {gradients} from '../../lib/styles' +import {DEF_AVATAR} from '../../lib/assets' type Embed = | AppBskyEmbedImages.Presented @@ -80,22 +83,37 @@ export function PostEmbeds({ href={link.uri} noFeedback> {link.thumb ? ( - - ) : undefined} - - {link.title || link.uri} - - - {link.uri} - - {link.description ? ( + + ) : ( + + )} + - {link.description} + style={[pal.text, styles.extTitle]}> + {link.title || link.uri} - ) : undefined} + + {link.uri} + + {link.description ? ( + + {link.description} + + ) : undefined} + ) } @@ -107,11 +125,28 @@ const styles = StyleSheet.create({ marginTop: 4, }, extOuter: { - padding: 10, borderWidth: 1, - borderRadius: 4, + borderRadius: 8, marginTop: 4, }, + extInner: { + padding: 10, + }, + extImage: { + borderTopLeftRadius: 6, + borderTopRightRadius: 6, + width: '100%', + height: 200, + }, + extImageFallback: { + height: 160, + }, + extTitle: { + fontWeight: '600', + }, + extUri: { + marginTop: 2, + }, extDescription: { marginTop: 4, }, -- cgit 1.4.1