Skip to content

Commit

Permalink
Merge pull request #125 from abusix/pla-1202-extend-alert-component-i…
Browse files Browse the repository at this point in the history
…n-hailstorm-with-props

feat: extend alert interface with div props
  • Loading branch information
mnlfischer authored May 31, 2024
2 parents 85f2160 + d10fefa commit c2b9548
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 c2b9548

Please sign in to comment.