diff --git a/src/view/com/util/post-embeds/GithubGist.tsx b/src/view/com/util/post-embeds/GithubGist.tsx index fd165d742a..763e646b93 100644 --- a/src/view/com/util/post-embeds/GithubGist.tsx +++ b/src/view/com/util/post-embeds/GithubGist.tsx @@ -1,5 +1,6 @@ import React from 'react' -import {View} from 'react-native' +import {LayoutChangeEvent,ScrollView, View} from 'react-native' +import {LinearGradient} from 'expo-linear-gradient' import {AppBskyEmbedExternal} from '@atproto/api' import {msg} from '@lingui/macro' import {useLingui} from '@lingui/react' @@ -9,8 +10,11 @@ import {shareUrl} from '#/lib/sharing' import {toNiceDomain} from '#/lib/strings/url-helpers' import {isNative} from '#/platform/detection' import {atoms as a, useTheme} from '#/alf' +import {Button, ButtonIcon, ButtonText} from '#/components/Button' import {Divider} from '#/components/Divider' -import {Earth_Stroke2_Corner0_Rounded as Globe} from '#/components/icons/Globe' +import {ChevronBottom_Stroke2_Corner0_Rounded as Chevron} from '#/components/icons/Chevron' +import {CodeBrackets_Stroke2_Corner0_Rounded as Code} from '#/components/icons/CodeBrackets' +import {Globe_Stroke2_Corner0_Rounded as Globe} from '#/components/icons/Globe' import {Link} from '#/components/Link' import {Loader} from '#/components/Loader' import {Text} from '#/components/Typography' @@ -24,6 +28,8 @@ export function GithubGist({ }) { const t = useTheme() const {_} = useLingui() + const [footerHeight, setFooterHeight] = React.useState(100) + const [showMore, setShowMore] = React.useState(false) const {data: files, isLoading} = useQuery({ queryKey: ['gist', id], @@ -49,106 +55,199 @@ export function GithubGist({ } }, [info.uri]) - return ( - - {({hovered}) => ( - - - {isLoading || !files ? ( - - ) : ( - - - {files[0].filename} - - - {files[0].content} - - - )} - + const onFooterLayout = React.useCallback( + (e: LayoutChangeEvent) => { + setFooterHeight(e.nativeEvent.layout.height) + }, + [setFooterHeight], + ) - - - - {info.title || info.uri} - + const onShowMore = React.useCallback(() => { + setShowMore(true) + }, [setShowMore]) + + return ( + + + {isLoading || !files ? ( + + + + ) : ( + + + + + + + + + + {files[0].filename} + + + + {files[0].content} + + + + + + {!showMore && } - - - - - - {toNiceDomain(info.uri)} - - + + + {!showMore && ( + + + + + + + )} + + + {({hovered}) => ( + + + + {info.title || info.uri} + + + + + + + + {toNiceDomain(info.uri)} + + + + + )} + - - )} - + )} + + ) }