Refactor locale

This commit is contained in:
Sakura Knoll
2022-04-05 07:36:08 +09:00 Unverified
parent 08fad17e96
commit df0b073d65
16 changed files with 107 additions and 94 deletions
+13 -6
View File
@@ -11,9 +11,15 @@ interface BattlesuitCardProps {
battlesuit: Pick<BattlesuitData, 'id' | 'name' | 'krName'>
hidden?: boolean
size?: 'sm' | 'default'
href?: string
}
const BattlesuitCard = ({ battlesuit, hidden, size }: BattlesuitCardProps) => {
const BattlesuitCard = ({
battlesuit,
hidden,
size,
href,
}: BattlesuitCardProps) => {
const { locale } = useRouter()
const battlesuitName = translate(
@@ -22,6 +28,10 @@ const BattlesuitCard = ({ battlesuit, hidden, size }: BattlesuitCardProps) => {
battlesuit.name
)
if (href == null) {
href = `/honkai3rd/battlesuits/${battlesuit.id}`
}
if (size === 'sm') {
return (
<Card
@@ -35,7 +45,7 @@ const BattlesuitCard = ({ battlesuit, hidden, size }: BattlesuitCardProps) => {
},
}}
>
<PageLink href={`/honkai3rd/battlesuits/${battlesuit.id}`}>
<PageLink href={href}>
<Flex>
<SquareImageBox
mr={2}
@@ -72,10 +82,7 @@ const BattlesuitCard = ({ battlesuit, hidden, size }: BattlesuitCardProps) => {
},
}}
>
<PageLink
href={`/honkai3rd/battlesuits/${battlesuit.id}`}
key={battlesuit.id}
>
<PageLink href={href}>
<SquareImageBox
alt={battlesuitName}
src={`${assetsBucketBaseUrl}/honkai3rd/battlesuits/portrait-${battlesuit.id}.png`}