mirror of
https://github.com/fosrl/pangolin.git
synced 2026-02-10 20:02:26 +00:00
add optional icon to strategy select
This commit is contained in:
@@ -2,13 +2,14 @@
|
|||||||
|
|
||||||
import { cn } from "@app/lib/cn";
|
import { cn } from "@app/lib/cn";
|
||||||
import { RadioGroup, RadioGroupItem } from "./ui/radio-group";
|
import { RadioGroup, RadioGroupItem } from "./ui/radio-group";
|
||||||
import { useState } from "react";
|
import { useState, ReactNode } from "react";
|
||||||
|
|
||||||
export interface StrategyOption<TValue extends string> {
|
export interface StrategyOption<TValue extends string> {
|
||||||
id: TValue;
|
id: TValue;
|
||||||
title: string;
|
title: string;
|
||||||
description: string;
|
description: string;
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
|
icon?: ReactNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface StrategySelectProps<TValue extends string> {
|
interface StrategySelectProps<TValue extends string> {
|
||||||
@@ -58,10 +59,17 @@ export function StrategySelect<TValue extends string>({
|
|||||||
disabled={option.disabled}
|
disabled={option.disabled}
|
||||||
className="absolute left-4 top-5 h-4 w-4 border-primary text-primary"
|
className="absolute left-4 top-5 h-4 w-4 border-primary text-primary"
|
||||||
/>
|
/>
|
||||||
<div className="pl-7">
|
<div className="flex items-center gap-3 pl-7">
|
||||||
<div className="font-medium">{option.title}</div>
|
{option.icon && (
|
||||||
<div className="text-sm text-muted-foreground">
|
<div className="flex-shrink-0 flex items-center justify-center">
|
||||||
{option.description}
|
{option.icon}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
<div className="flex-1">
|
||||||
|
<div className="font-medium">{option.title}</div>
|
||||||
|
<div className="text-sm text-muted-foreground">
|
||||||
|
{option.description}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</label>
|
</label>
|
||||||
|
|||||||
Reference in New Issue
Block a user