mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-11-20 04:14:12 +01:00
migrate compare and tankopedia loadout to new data-driven components, splitting the old monolithic loadout and compare UI into smaller pieces and adding shared Table, Dialog and Scroller primitives
This commit is contained in:
111 files changed
+4009
-3917
No files matched your search
@@ -0,0 +1,3 @@
|
||||
.shells {
|
||||
display: flex;
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
import { alias } from "@blitzkit/core";
|
||||
import type { GunDefinition } from "@blitzkit/protos";
|
||||
import { useStrings } from "../../hooks/useStrings";
|
||||
import { useUnwrapper } from "../../hooks/useUnwrapper";
|
||||
import { IconButton } from "../IconButton";
|
||||
import { LoadoutSection } from "../LoadoutSection";
|
||||
import { Tooltip } from "../Tooltip";
|
||||
import styles from "./index.module.css";
|
||||
|
||||
interface LoadoutShellsProps {
|
||||
gun: GunDefinition;
|
||||
selected: number;
|
||||
onSelect: (id: number) => void;
|
||||
}
|
||||
|
||||
export function LoadoutShells({ gun, selected, onSelect }: LoadoutShellsProps) {
|
||||
const strings = useStrings();
|
||||
const unwrap = useUnwrapper();
|
||||
|
||||
return (
|
||||
<LoadoutSection title={strings.tanks.loadout.shells}>
|
||||
<div className={styles.shells}>
|
||||
{gun.shells.map((candidate) => {
|
||||
const isSelected = candidate.id === selected;
|
||||
const name = unwrap(candidate.name!);
|
||||
|
||||
return (
|
||||
<Tooltip key={candidate.id} tooltip={name}>
|
||||
<IconButton
|
||||
size="major"
|
||||
radius="1"
|
||||
color={isSelected ? undefined : "gray"}
|
||||
variant={isSelected ? "surface" : "soft"}
|
||||
parentListChild="horizontal"
|
||||
onClick={() => onSelect(candidate.id)}
|
||||
>
|
||||
<img
|
||||
alt={name}
|
||||
src={alias("api", `/icons/shells/${candidate.icon}.webp`)}
|
||||
/>
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</LoadoutSection>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user