Files
blitzkit/packages/website/src/components/SearchResults.tsx
T

35 lines
847 B
TypeScript
Raw Normal View History

2025-05-04 21:02:50 -05:00
import {
Badge,
Button,
Flex,
2025-10-02 10:29:43 -05:00
Text,
2025-05-04 21:02:50 -05:00
type ButtonProps,
type FlexProps,
2025-10-02 10:29:43 -05:00
} from "@radix-ui/themes";
import type { ReactNode } from "react";
2025-05-04 21:02:50 -05:00
function Root(props: FlexProps) {
return <Flex direction="column" gap="2" width="100%" {...props} />;
}
2025-10-02 10:29:43 -05:00
interface ItemProps extends Omit<ButtonProps, "prefix"> {
prefix?: React.ReactNode;
2025-05-04 21:02:50 -05:00
text: string;
discriminator?: ReactNode;
}
2025-10-02 10:29:43 -05:00
function Item({ text, discriminator, prefix, ...props }: ItemProps) {
2025-05-04 21:02:50 -05:00
return (
<Button variant="ghost" {...props} highContrast>
2025-10-02 10:29:43 -05:00
<Flex width="100%" gap="2" align="center">
{prefix}
<Text style={{ flex: 1 }} align={prefix ? "left" : "center"}>
{text}
</Text>
2025-05-04 21:02:50 -05:00
{discriminator !== undefined && <Badge>{discriminator}</Badge>}
</Flex>
</Button>
);
}
export const SearchResults = { Root, Item };