Remove fallback gradient on external links without thumbs (#164)
* Remove fallback gradient on external links without thumbs * Remove fallback gradient on external links without thumbs in the composer preview
This commit is contained in:
@@ -7,10 +7,9 @@ import {
|
|||||||
} from 'react-native'
|
} from 'react-native'
|
||||||
import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome'
|
import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome'
|
||||||
import {BlurView} from '@react-native-community/blur'
|
import {BlurView} from '@react-native-community/blur'
|
||||||
import LinearGradient from 'react-native-linear-gradient'
|
|
||||||
import {Image} from '../util/images/Image'
|
import {Image} from '../util/images/Image'
|
||||||
import {Text} from '../util/text/Text'
|
import {Text} from '../util/text/Text'
|
||||||
import {s, gradients} from '../../lib/styles'
|
import {s} from '../../lib/styles'
|
||||||
import {usePalette} from '../../lib/hooks/usePalette'
|
import {usePalette} from '../../lib/hooks/usePalette'
|
||||||
import {ExternalEmbedDraft} from '../../../state/lib/api'
|
import {ExternalEmbedDraft} from '../../../state/lib/api'
|
||||||
|
|
||||||
@@ -39,19 +38,7 @@ export const ExternalEmbed = ({
|
|||||||
</View>
|
</View>
|
||||||
) : link.localThumb ? (
|
) : link.localThumb ? (
|
||||||
<Image uri={link.localThumb.path} style={styles.image} />
|
<Image uri={link.localThumb.path} style={styles.image} />
|
||||||
) : (
|
) : undefined}
|
||||||
<LinearGradient
|
|
||||||
colors={[gradients.blueDark.start, gradients.blueDark.end]}
|
|
||||||
start={{x: 0, y: 0}}
|
|
||||||
end={{x: 1, y: 1}}
|
|
||||||
style={[styles.image, styles.imageFallback]}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
<TouchableWithoutFeedback onPress={onRemove}>
|
|
||||||
<BlurView style={styles.removeBtn} blurType="dark">
|
|
||||||
<FontAwesomeIcon size={18} icon="xmark" style={s.white} />
|
|
||||||
</BlurView>
|
|
||||||
</TouchableWithoutFeedback>
|
|
||||||
<View style={styles.inner}>
|
<View style={styles.inner}>
|
||||||
{!!link.meta?.title && (
|
{!!link.meta?.title && (
|
||||||
<Text type="sm-bold" numberOfLines={2} style={[pal.text]}>
|
<Text type="sm-bold" numberOfLines={2} style={[pal.text]}>
|
||||||
@@ -78,6 +65,11 @@ export const ExternalEmbed = ({
|
|||||||
</Text>
|
</Text>
|
||||||
)}
|
)}
|
||||||
</View>
|
</View>
|
||||||
|
<TouchableWithoutFeedback onPress={onRemove}>
|
||||||
|
<BlurView style={styles.removeBtn} blurType="dark">
|
||||||
|
<FontAwesomeIcon size={18} icon="xmark" style={s.white} />
|
||||||
|
</BlurView>
|
||||||
|
</TouchableWithoutFeedback>
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -97,9 +89,6 @@ const styles = StyleSheet.create({
|
|||||||
width: '100%',
|
width: '100%',
|
||||||
maxHeight: 200,
|
maxHeight: 200,
|
||||||
},
|
},
|
||||||
imageFallback: {
|
|
||||||
height: 160,
|
|
||||||
},
|
|
||||||
removeBtn: {
|
removeBtn: {
|
||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
top: 10,
|
top: 10,
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import {
|
|||||||
Image as RNImage,
|
Image as RNImage,
|
||||||
} from 'react-native'
|
} 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 {Image} from './images/Image'
|
import {Image} from './images/Image'
|
||||||
@@ -15,7 +14,6 @@ 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 {saveImageModal} from '../../../lib/images'
|
import {saveImageModal} from '../../../lib/images'
|
||||||
|
|
||||||
type Embed =
|
type Embed =
|
||||||
@@ -112,14 +110,7 @@ export function PostEmbeds({
|
|||||||
noFeedback>
|
noFeedback>
|
||||||
{link.thumb ? (
|
{link.thumb ? (
|
||||||
<Image uri={link.thumb} style={styles.extImage} />
|
<Image uri={link.thumb} style={styles.extImage} />
|
||||||
) : (
|
) : undefined}
|
||||||
<LinearGradient
|
|
||||||
colors={[gradients.blueDark.start, gradients.blueDark.end]}
|
|
||||||
start={{x: 0, y: 0}}
|
|
||||||
end={{x: 1, y: 1}}
|
|
||||||
style={[styles.extImage, styles.extImageFallback]}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
<View style={styles.extInner}>
|
<View style={styles.extInner}>
|
||||||
<Text type="md-bold" numberOfLines={2} style={[pal.text]}>
|
<Text type="md-bold" numberOfLines={2} style={[pal.text]}>
|
||||||
{link.title || link.uri}
|
{link.title || link.uri}
|
||||||
@@ -167,9 +158,6 @@ const styles = StyleSheet.create({
|
|||||||
width: '100%',
|
width: '100%',
|
||||||
maxHeight: 200,
|
maxHeight: 200,
|
||||||
},
|
},
|
||||||
extImageFallback: {
|
|
||||||
height: 160,
|
|
||||||
},
|
|
||||||
extUri: {
|
extUri: {
|
||||||
marginTop: 2,
|
marginTop: 2,
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user