group props with classname

This commit is contained in:
Nate Kelley 2025-10-01 09:49:35 -06:00
parent dfc17043fb
commit 9e793787ef
No known key found for this signature in database
GPG Key ID: FD90372AB8D98B4F
3 changed files with 11 additions and 1 deletions

View File

@ -207,6 +207,7 @@ const manyCharacters: MentionInputTriggerItem[] = [
}, },
], ],
label: 'SpongeBob SquarePants Characters', label: 'SpongeBob SquarePants Characters',
className: 'bg-red-100',
}, },
{ {
type: 'separator', type: 'separator',

View File

@ -46,6 +46,7 @@ export type MentionInputTriggerGroup<T = string> = {
icon?: React.ReactNode; icon?: React.ReactNode;
type: 'group'; type: 'group';
disabled?: boolean; disabled?: boolean;
className?: string;
}; };
export type MentionInputTriggerSeparator = { export type MentionInputTriggerSeparator = {

View File

@ -1,3 +1,4 @@
import { cn } from '@/lib/utils';
import { type MentionListGroupExtended, MentionListSelector } from './MentionListSelector'; import { type MentionListGroupExtended, MentionListSelector } from './MentionListSelector';
export function MentionListGroup<T = string>({ export function MentionListGroup<T = string>({
@ -7,9 +8,16 @@ export function MentionListGroup<T = string>({
setSelectedItem, setSelectedItem,
selectedItem, selectedItem,
onSelectItem, onSelectItem,
type,
className,
disabled, //this is consumed by the children items, we can stylized this if we want
}: MentionListGroupExtended<T>) { }: MentionListGroupExtended<T>) {
return ( return (
<div className="mention-list-group"> <div
className={cn('mention-list-group', className)}
aria-disabled={disabled}
data-testid={type}
>
<div className="flex items-center pb-1 px-2 pt-2 h-7 text-sm text-gray-dark"> <div className="flex items-center pb-1 px-2 pt-2 h-7 text-sm text-gray-dark">
{icon && <span className="mr-2 text-icon-color">{icon}</span>} {icon && <span className="mr-2 text-icon-color">{icon}</span>}
{label} {label}