fix nested <a> starterPackCard
This commit is contained in:
@@ -11,9 +11,9 @@ import {useSession} from '#/state/session'
|
|||||||
import {LoadingPlaceholder} from '#/view/com/util/LoadingPlaceholder'
|
import {LoadingPlaceholder} from '#/view/com/util/LoadingPlaceholder'
|
||||||
import {UserAvatar} from '#/view/com/util/UserAvatar'
|
import {UserAvatar} from '#/view/com/util/UserAvatar'
|
||||||
import {atoms as a, useBreakpoints, useTheme, web} from '#/alf'
|
import {atoms as a, useBreakpoints, useTheme, web} from '#/alf'
|
||||||
import {ButtonText} from '#/components/Button'
|
import {Button, ButtonText} from '#/components/Button'
|
||||||
import {PlusSmall_Stroke2_Corner0_Rounded as Plus} from '#/components/icons/Plus'
|
import {PlusSmall_Stroke2_Corner0_Rounded as Plus} from '#/components/icons/Plus'
|
||||||
import {Link} from '#/components/Link'
|
import {Link, useLink} from '#/components/Link'
|
||||||
import {MediaInsetBorder} from '#/components/MediaInsetBorder'
|
import {MediaInsetBorder} from '#/components/MediaInsetBorder'
|
||||||
import {useStarterPackLink} from '#/components/StarterPack/StarterPackCard'
|
import {useStarterPackLink} from '#/components/StarterPack/StarterPackCard'
|
||||||
import {SubtleHover} from '#/components/SubtleHover'
|
import {SubtleHover} from '#/components/SubtleHover'
|
||||||
@@ -33,6 +33,15 @@ export function StarterPackCard({
|
|||||||
const {currentAccount} = useSession()
|
const {currentAccount} = useSession()
|
||||||
const {gtPhone} = useBreakpoints()
|
const {gtPhone} = useBreakpoints()
|
||||||
const link = useStarterPackLink({view})
|
const link = useStarterPackLink({view})
|
||||||
|
|
||||||
|
const openPack = useLink({
|
||||||
|
to: link.to,
|
||||||
|
displayText: link.label,
|
||||||
|
onPress: () => {
|
||||||
|
link.precache()
|
||||||
|
onPress?.()
|
||||||
|
},
|
||||||
|
})
|
||||||
const record = view.record
|
const record = view.record
|
||||||
const isOwnStarterPack = view.creator?.did === currentAccount?.did
|
const isOwnStarterPack = view.creator?.did === currentAccount?.did
|
||||||
|
|
||||||
@@ -105,13 +114,13 @@ export function StarterPackCard({
|
|||||||
: _(msg`By ${sanitizeHandle(view.creator.handle, '@')}`)}
|
: _(msg`By ${sanitizeHandle(view.creator.handle, '@')}`)}
|
||||||
</Text>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
<Link
|
<Button
|
||||||
to={link.to}
|
|
||||||
label={link.label}
|
label={link.label}
|
||||||
onHoverIn={link.precache}
|
onHoverIn={link.precache}
|
||||||
onPress={() => {
|
onPress={e => {
|
||||||
link.precache()
|
// don't let the press reach the surrounding card link
|
||||||
onPress?.()
|
e.stopPropagation()
|
||||||
|
openPack.onPress(e)
|
||||||
}}
|
}}
|
||||||
variant="solid"
|
variant="solid"
|
||||||
color="secondary"
|
color="secondary"
|
||||||
@@ -120,7 +129,7 @@ export function StarterPackCard({
|
|||||||
<ButtonText>
|
<ButtonText>
|
||||||
<Trans>Open pack</Trans>
|
<Trans>Open pack</Trans>
|
||||||
</ButtonText>
|
</ButtonText>
|
||||||
</Link>
|
</Button>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
</>
|
</>
|
||||||
|
|||||||
Reference in New Issue
Block a user