diff --git a/src/components/Post/Embed/ExternalEmbed/PublicationEmbed/index.tsx b/src/components/Post/Embed/ExternalEmbed/PublicationEmbed/index.tsx new file mode 100644 index 0000000000..76d42f0679 --- /dev/null +++ b/src/components/Post/Embed/ExternalEmbed/PublicationEmbed/index.tsx @@ -0,0 +1,115 @@ +import {type StyleProp, View, type ViewStyle} from 'react-native' +import {Image} from 'expo-image' +import {useLingui} from '@lingui/react/macro' + +import {useHaptics} from '#/lib/haptics' +import {shareUrl} from '#/lib/sharing' +import {atoms as a, useTheme} from '#/alf' +import {Divider} from '#/components/Divider' +import {Link} from '#/components/Link' +import {Text} from '#/components/Typography' +import {IS_NATIVE} from '#/env' +import {MetaRow} from './MetaRow' +import {PublicationFooter} from './PublicationFooter' +import { + type PublicationViewExternal, + type PublicationViewExternalSource, +} from './types' + +export function PublicationEmbed({ + link, + source, + onOpen, + style, +}: { + link: PublicationViewExternal + source: PublicationViewExternalSource + onOpen?: () => void + style?: StyleProp +}) { + const t = useTheme() + const {t: l} = useLingui() + const playHaptic = useHaptics() + + const onPress = () => { + playHaptic('Light') + onOpen?.() + } + + const onShareExternal = () => { + if (link.uri && IS_NATIVE) { + playHaptic('Heavy') + shareUrl(link.uri) + } + } + + return ( + + + {({hovered}) => ( + + {link.thumb ? ( + + ) : null} + + + + {link.title || link.uri} + + {link.description ? ( + + {link.description} + + ) : null} + + + + + )} + + + + {/* + Note: `source.theme` (background/foreground/accent/accentForeground + RGB triplets) is exposed by the lexicon but not consumed here. The + current design does not apply per-publication accent colors. Pick up + when product asks for theme accenting. + */} + + ) +}