mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-19 09:33:53 +00:00
Add a theme preview and update the theme when highlight changes. (#151)
This commit is contained in:
@@ -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}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user