Skip to content

Commit

Permalink
feat: extend alert interface with div props
Browse files Browse the repository at this point in the history
  • Loading branch information
mnlfischer committed May 31, 2024
1 parent abfd389 commit d10fefa
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/components/alert/alert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ const iconNames: Record<AlertIntent, React.ElementType> = {
danger: ErrorIcon,
};

export interface AlertProps {
export interface AlertProps extends React.ComponentPropsWithoutRef<"div"> {
title: string;
intent: AlertIntent;
children?: React.ReactNode;
}

export const Alert = ({ title, children, intent }: AlertProps) => {
export const Alert = ({ title, children, intent, ...props }: AlertProps) => {
const Icon = iconNames[intent];

return (
Expand All @@ -41,6 +41,7 @@ export const Alert = ({ title, children, intent }: AlertProps) => {
"flex flex-row gap-4 rounded-lg border px-4 py-3 text-neutral-800",
alertVariants[intent]
)}
{...props}
>
<Icon className={classNames("h-4 w-4 flex-shrink-0", iconVariants[intent])} />
<div className="flex-grow">
Expand Down

0 comments on commit d10fefa

Please sign in to comment.