feat: guesser flag icons

This commit is contained in:
TrèsAbhi committed 2025-10-02 10:29:43 -05:00
1 parent aadc252e47
commit 9b97d3e27d
2 files changed
+19 -10

No files matched your search

@@ -1,4 +1,5 @@
import {
asset,
SEARCH_KEYS,
TankDefinition,
TIER_ROMAN_NUMERALS,
@@ -110,6 +111,7 @@ export function Guesser() {
return (
<SearchResults.Item
key={result.id}
onClick={() => {
if (!input.current) return;
@@ -118,6 +120,12 @@ export function Guesser() {
setResults(null);
}}
text={unwrap(result.name)}
prefix={
<img
style={{ width: "1em", height: "1em" }}
src={asset(`flags/circle/${result.nation}.webp`)}
/>
}
discriminator={
<Flex
align="center"
@@ -2,29 +2,30 @@ import {
Badge,
Button,
Flex,
Text,
type ButtonProps,
type FlexProps,
} from '@radix-ui/themes';
import type { ReactNode } from 'react';
} from "@radix-ui/themes";
import type { ReactNode } from "react";
function Root(props: FlexProps) {
return <Flex direction="column" gap="2" width="100%" {...props} />;
}
interface ItemProps extends ButtonProps {
interface ItemProps extends Omit<ButtonProps, "prefix"> {
prefix?: React.ReactNode;
text: string;
discriminator?: ReactNode;
}
function Item({ text, discriminator, ...props }: ItemProps) {
function Item({ text, discriminator, prefix, ...props }: ItemProps) {
return (
<Button variant="ghost" {...props} highContrast>
<Flex
justify={discriminator === undefined ? 'center' : 'between'}
width="100%"
gap="2"
>
{text}
<Flex width="100%" gap="2" align="center">
{prefix}
<Text style={{ flex: 1 }} align={prefix ? "left" : "center"}>
{text}
</Text>
{discriminator !== undefined && <Badge>{discriminator}</Badge>}
</Flex>
</Button>