mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-24 20:19:49 +02:00
feat: tank card links
This commit is contained in:
1 parent
406ad52c8d
commit
a7bd671309
2 files changed
+21
-5
No files matched your search
@@ -23,12 +23,18 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.icon {
|
.icon {
|
||||||
width: 13rem;
|
width: 11rem;
|
||||||
height: 8rem;
|
height: 7rem;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
||||||
background-size: 140%;
|
background-size: 140%;
|
||||||
background-position: 40% center;
|
background-position: 40% center;
|
||||||
|
|
||||||
|
.cover {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
background: linear-gradient(transparent 75%, var(--gray-1));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,16 +1,24 @@
|
|||||||
import { api } from "../../core/api/dynamic";
|
import { api } from "../../core/api/dynamic";
|
||||||
import { useAwait } from "../../hooks/useAwait";
|
import { useAwait } from "../../hooks/useAwait";
|
||||||
import { useGameStrings } from "../../hooks/useGameStrings";
|
import { useGameStrings } from "../../hooks/useGameStrings";
|
||||||
|
import { useLocale } from "../../hooks/useLocale";
|
||||||
import type { PopularTank } from "../../protos/popular_tanks";
|
import type { PopularTank } from "../../protos/popular_tanks";
|
||||||
|
import { LinkI18n } from "../LinkI18n";
|
||||||
import { Text } from "../Text";
|
import { Text } from "../Text";
|
||||||
import styles from "./index.module.css";
|
import styles from "./index.module.css";
|
||||||
|
|
||||||
export function TankCard({ id }: PopularTank) {
|
export function TankCard({ id }: PopularTank) {
|
||||||
const tank = useAwait(() => api.tank(id), `tank-${id}`);
|
const tank = useAwait(() => api.tank(id), `tank-${id}`);
|
||||||
const gameStrings = useGameStrings("TankEntity");
|
const gameStrings = useGameStrings("TankEntity");
|
||||||
|
const locale = useLocale();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles["tank-card"]}>
|
<LinkI18n
|
||||||
|
href={`/tanks/${tank.slug}`}
|
||||||
|
underline="never"
|
||||||
|
locale={locale}
|
||||||
|
className={styles["tank-card"]}
|
||||||
|
>
|
||||||
<div className={styles["icon-wrapper"]}>
|
<div className={styles["icon-wrapper"]}>
|
||||||
<div
|
<div
|
||||||
className={styles.flag}
|
className={styles.flag}
|
||||||
@@ -24,10 +32,12 @@ export function TankCard({ id }: PopularTank) {
|
|||||||
style={{
|
style={{
|
||||||
backgroundImage: `url(/api/tanks/${id}.webp)`,
|
backgroundImage: `url(/api/tanks/${id}.webp)`,
|
||||||
}}
|
}}
|
||||||
/>
|
>
|
||||||
|
<div className={styles.cover} />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Text className={styles.name}>{gameStrings[tank.tank!.name!.value]}</Text>
|
<Text className={styles.name}>{gameStrings[tank.tank!.name!.value]}</Text>
|
||||||
</div>
|
</LinkI18n>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user