mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-11-21 12:53:56 +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,59 @@
|
||||
import { TrashIcon } from "@radix-ui/react-icons";
|
||||
import { useStrings } from "../../hooks/useStrings";
|
||||
import {
|
||||
vehicleStatusKeys,
|
||||
type VehicleStatusKey,
|
||||
} from "../../tankopedia/tankState";
|
||||
import { IconButton } from "../IconButton";
|
||||
import { LoadoutSection } from "../LoadoutSection";
|
||||
import styles from "./index.module.css";
|
||||
|
||||
interface LoadoutStatusProps {
|
||||
status: Record<VehicleStatusKey, boolean>;
|
||||
onToggle: (key: VehicleStatusKey) => void;
|
||||
onClear: () => void;
|
||||
}
|
||||
|
||||
export function LoadoutStatus({
|
||||
status,
|
||||
onToggle,
|
||||
onClear,
|
||||
}: LoadoutStatusProps) {
|
||||
const strings = useStrings();
|
||||
|
||||
return (
|
||||
<LoadoutSection
|
||||
title={strings.tanks.loadout.status}
|
||||
actions={
|
||||
<IconButton
|
||||
color="red"
|
||||
variant="ghost"
|
||||
size="minor"
|
||||
onClick={onClear}
|
||||
>
|
||||
<TrashIcon />
|
||||
</IconButton>
|
||||
}
|
||||
>
|
||||
<div className={styles.status}>
|
||||
{vehicleStatusKeys.map((group, index) => (
|
||||
<div key={index} className={styles.group}>
|
||||
{group.map((key) => (
|
||||
<IconButton
|
||||
key={key}
|
||||
aria-pressed={status[key]}
|
||||
radius="1"
|
||||
className={styles.state}
|
||||
color={status[key] ? "amber" : "gray"}
|
||||
variant={status[key] ? "surface" : "soft"}
|
||||
onClick={() => onToggle(key)}
|
||||
>
|
||||
<img src={`/media/status/${key}.png`} />
|
||||
</IconButton>
|
||||
))}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</LoadoutSection>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user