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

View File

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