mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-05-30 19:54:16 -04:00
Use A instead of a Link component for external links
This commit is contained in:
parent
05d8332358
commit
9bfd1a78bd
Binary file not shown.
@ -23,18 +23,26 @@ import { Platform, Pressable, TextProps, View, PressableProps } from "react-nati
|
|||||||
import { TextLink, useLink } from "solito/link";
|
import { TextLink, useLink } from "solito/link";
|
||||||
import { useTheme, useYoshiki } from "yoshiki/native";
|
import { useTheme, useYoshiki } from "yoshiki/native";
|
||||||
import { alpha } from "./themes";
|
import { alpha } from "./themes";
|
||||||
|
import { NextLink } from "solito/build/link/next-link";
|
||||||
|
|
||||||
export const A = ({
|
export const A = ({
|
||||||
href,
|
href,
|
||||||
replace,
|
replace,
|
||||||
children,
|
children,
|
||||||
|
target,
|
||||||
...props
|
...props
|
||||||
}: TextProps & { href?: string; replace?: boolean; children: ReactNode }) => {
|
}: TextProps & {
|
||||||
|
href?: string | null;
|
||||||
|
target?: string;
|
||||||
|
replace?: boolean;
|
||||||
|
children: ReactNode;
|
||||||
|
}) => {
|
||||||
const { css, theme } = useYoshiki();
|
const { css, theme } = useYoshiki();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<TextLink
|
<TextLink
|
||||||
href={href ?? ""}
|
href={href ?? ""}
|
||||||
|
target={target}
|
||||||
replace={replace as any}
|
replace={replace as any}
|
||||||
experimental={
|
experimental={
|
||||||
replace
|
replace
|
||||||
@ -51,6 +59,7 @@ export const A = ({
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
selectable: true,
|
selectable: true,
|
||||||
|
hrefAttrs: { target },
|
||||||
...props,
|
...props,
|
||||||
},
|
},
|
||||||
)}
|
)}
|
||||||
|
@ -50,7 +50,7 @@ import {
|
|||||||
} from "@kyoo/primitives";
|
} from "@kyoo/primitives";
|
||||||
import { Fragment } from "react";
|
import { Fragment } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { ImageStyle, Platform, View } from "react-native";
|
import { ImageStyle, Platform, Text, View } from "react-native";
|
||||||
import {
|
import {
|
||||||
Theme,
|
Theme,
|
||||||
md,
|
md,
|
||||||
@ -430,12 +430,12 @@ export const Header = ({
|
|||||||
).map(([name, data]) => (
|
).map(([name, data]) => (
|
||||||
<Chip
|
<Chip
|
||||||
key={name}
|
key={name}
|
||||||
as={Link}
|
as={A}
|
||||||
href={data?.link}
|
href={data?.link}
|
||||||
target="_blank"
|
target="_blank"
|
||||||
size="small"
|
size="small"
|
||||||
outline
|
outline
|
||||||
{...css({
|
{...(css({
|
||||||
m: ts(0.5),
|
m: ts(0.5),
|
||||||
color: (theme: Theme) => theme.contrast,
|
color: (theme: Theme) => theme.contrast,
|
||||||
fover: {
|
fover: {
|
||||||
@ -444,7 +444,7 @@ export const Header = ({
|
|||||||
bg: (theme: Theme) => theme.accent,
|
bg: (theme: Theme) => theme.accent,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})}
|
}) as any)}
|
||||||
>
|
>
|
||||||
{data ? name : <Skeleton {...css({ width: rem(3) })} />}
|
{data ? name : <Skeleton {...css({ width: rem(3) })} />}
|
||||||
</Chip>
|
</Chip>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user