Enforce visibility types

This commit is contained in:
Sam Becker 2025-07-10 10:05:55 -05:00
parent 217baba066
commit a86f04b654
2 changed files with 5 additions and 5 deletions

View File

@ -2,15 +2,15 @@ import clsx from 'clsx/lite';
import { ReactNode, useEffect, useRef } from 'react';
import IconCheck from './icons/IconCheck';
export interface SelectMenuOptionType {
value: string
export type SelectMenuOptionType<T = string> = {
value: T
label: ReactNode
accessoryStart?: ReactNode
accessoryEnd?: ReactNode
note?: ReactNode
}
export default function SelectMenuOption({
export default function SelectMenuOption<T = string>({
label,
accessoryStart,
accessoryEnd,
@ -24,7 +24,7 @@ export default function SelectMenuOption({
isHighlighted?: boolean
shouldHighlightOnHover?: boolean
onClick?: () => void
} & SelectMenuOptionType) {
} & SelectMenuOptionType<T>) {
const ref = useRef<HTMLDivElement>(null);
useEffect(() => {

View File

@ -10,7 +10,7 @@ export const EXCLUDE_DESCRIPTION =
export const PRIVATE_DESCRIPTION =
'Visible only to admins';
export const VISIBILITY_OPTIONS: SelectMenuOptionType[] = [
export const VISIBILITY_OPTIONS: SelectMenuOptionType<VisibilityValue>[] = [
{
value: 'default',
accessoryStart: <IconHidden size={17} visible />,