mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-05-05 07:10:55 +00:00
Add a theme preview and update the theme when highlight changes. (#151)
This commit is contained in:
parent
d8c0587346
commit
5790a5d7cf
4 changed files with 70 additions and 5 deletions
|
|
@ -34,6 +34,9 @@ export interface RadioButtonSelectProps<T> {
|
|||
|
||||
/** Function called when an item is selected. Receives the `value` of the selected item. */
|
||||
onSelect: (value: T) => void;
|
||||
|
||||
/** Function called when an item is highlighted. Receives the `value` of the selected item. */
|
||||
onHighlight?: (value: T) => void;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -73,10 +76,16 @@ export function RadioButtonSelect<T>({
|
|||
items,
|
||||
initialIndex,
|
||||
onSelect,
|
||||
onHighlight,
|
||||
}: RadioButtonSelectProps<T>): React.JSX.Element {
|
||||
const handleSelect = (item: RadioSelectItem<T>) => {
|
||||
onSelect(item.value);
|
||||
};
|
||||
const handleHighlight = (item: RadioSelectItem<T>) => {
|
||||
if (onHighlight) {
|
||||
onHighlight(item.value);
|
||||
}
|
||||
};
|
||||
initialIndex = initialIndex ?? 0;
|
||||
return (
|
||||
<SelectInput
|
||||
|
|
@ -85,6 +94,7 @@ export function RadioButtonSelect<T>({
|
|||
items={items}
|
||||
initialIndex={initialIndex}
|
||||
onSelect={handleSelect}
|
||||
onHighlight={handleHighlight}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue