mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-24 10:21:15 +01:00
Switch to BiomeJS (#306)
This commit is contained in:
@@ -37,18 +37,18 @@ export function SegmentedControl<T extends string>({
|
||||
const selectedIndex = options.findIndex((o) => o.value === selectedValue);
|
||||
if (e.key === 'ArrowRight') {
|
||||
const newIndex = Math.abs((selectedIndex + 1) % options.length);
|
||||
setSelectedValue(options[newIndex]!.value);
|
||||
options[newIndex] && setSelectedValue(options[newIndex].value);
|
||||
const child = containerRef.current?.children[newIndex] as HTMLButtonElement;
|
||||
child.focus();
|
||||
} else if (e.key === 'ArrowLeft') {
|
||||
const newIndex = Math.abs((selectedIndex - 1) % options.length);
|
||||
setSelectedValue(options[newIndex]!.value);
|
||||
options[newIndex] && setSelectedValue(options[newIndex].value);
|
||||
const child = containerRef.current?.children[newIndex] as HTMLButtonElement;
|
||||
child.focus();
|
||||
}
|
||||
}}
|
||||
>
|
||||
{options.map((o, i) => {
|
||||
{options.map((o) => {
|
||||
const isSelected = selectedValue === o.value;
|
||||
const isActive = value === o.value;
|
||||
return (
|
||||
@@ -63,7 +63,7 @@ export function SegmentedControl<T extends string>({
|
||||
'!px-1.5 !w-auto',
|
||||
'focus:ring-border-focus',
|
||||
)}
|
||||
key={i}
|
||||
key={o.label}
|
||||
title={o.label}
|
||||
icon={o.icon}
|
||||
onClick={() => onChange(o.value)}
|
||||
|
||||
Reference in New Issue
Block a user