mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-24 12:09:51 +02:00
feat: guesser flag icons
This commit is contained in:
1 parent
aadc252e47
commit
9b97d3e27d
2 files changed
+19
-10
No files matched your search
@@ -1,4 +1,5 @@
|
|||||||
import {
|
import {
|
||||||
|
asset,
|
||||||
SEARCH_KEYS,
|
SEARCH_KEYS,
|
||||||
TankDefinition,
|
TankDefinition,
|
||||||
TIER_ROMAN_NUMERALS,
|
TIER_ROMAN_NUMERALS,
|
||||||
@@ -110,6 +111,7 @@ export function Guesser() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<SearchResults.Item
|
<SearchResults.Item
|
||||||
|
key={result.id}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
if (!input.current) return;
|
if (!input.current) return;
|
||||||
|
|
||||||
@@ -118,6 +120,12 @@ export function Guesser() {
|
|||||||
setResults(null);
|
setResults(null);
|
||||||
}}
|
}}
|
||||||
text={unwrap(result.name)}
|
text={unwrap(result.name)}
|
||||||
|
prefix={
|
||||||
|
<img
|
||||||
|
style={{ width: "1em", height: "1em" }}
|
||||||
|
src={asset(`flags/circle/${result.nation}.webp`)}
|
||||||
|
/>
|
||||||
|
}
|
||||||
discriminator={
|
discriminator={
|
||||||
<Flex
|
<Flex
|
||||||
align="center"
|
align="center"
|
||||||
|
|||||||
@@ -2,29 +2,30 @@ import {
|
|||||||
Badge,
|
Badge,
|
||||||
Button,
|
Button,
|
||||||
Flex,
|
Flex,
|
||||||
|
Text,
|
||||||
type ButtonProps,
|
type ButtonProps,
|
||||||
type FlexProps,
|
type FlexProps,
|
||||||
} from '@radix-ui/themes';
|
} from "@radix-ui/themes";
|
||||||
import type { ReactNode } from 'react';
|
import type { ReactNode } from "react";
|
||||||
|
|
||||||
function Root(props: FlexProps) {
|
function Root(props: FlexProps) {
|
||||||
return <Flex direction="column" gap="2" width="100%" {...props} />;
|
return <Flex direction="column" gap="2" width="100%" {...props} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ItemProps extends ButtonProps {
|
interface ItemProps extends Omit<ButtonProps, "prefix"> {
|
||||||
|
prefix?: React.ReactNode;
|
||||||
text: string;
|
text: string;
|
||||||
discriminator?: ReactNode;
|
discriminator?: ReactNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
function Item({ text, discriminator, ...props }: ItemProps) {
|
function Item({ text, discriminator, prefix, ...props }: ItemProps) {
|
||||||
return (
|
return (
|
||||||
<Button variant="ghost" {...props} highContrast>
|
<Button variant="ghost" {...props} highContrast>
|
||||||
<Flex
|
<Flex width="100%" gap="2" align="center">
|
||||||
justify={discriminator === undefined ? 'center' : 'between'}
|
{prefix}
|
||||||
width="100%"
|
<Text style={{ flex: 1 }} align={prefix ? "left" : "center"}>
|
||||||
gap="2"
|
{text}
|
||||||
>
|
</Text>
|
||||||
{text}
|
|
||||||
{discriminator !== undefined && <Badge>{discriminator}</Badge>}
|
{discriminator !== undefined && <Badge>{discriminator}</Badge>}
|
||||||
</Flex>
|
</Flex>
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
Reference in new issue
Block a user