diff --git a/src/components/Alert/Alert.stories.tsx b/src/components/Alert/Alert.stories.tsx index 1a2001ad..566ef93e 100644 --- a/src/components/Alert/Alert.stories.tsx +++ b/src/components/Alert/Alert.stories.tsx @@ -79,6 +79,13 @@ export const Closable = (args: any) => ( ) +export const WithAction = (args: any) => ( + + Lorem ipsum dolor sit amet consectetur adipisicing elit. Consequatur amet + labore. + +) + Neutral.args = { title: 'Success alert with icon', withIcon: true, @@ -132,3 +139,10 @@ Closable.args = { title: 'Closable alert', closable: true, } + +WithAction.args = { + title: 'Alert with action', + variant: 'warning', + withIcon: true, + actions:
Hello
, +} diff --git a/src/components/Alert/Alert.tsx b/src/components/Alert/Alert.tsx index 39a89a77..9391917c 100644 --- a/src/components/Alert/Alert.tsx +++ b/src/components/Alert/Alert.tsx @@ -18,6 +18,7 @@ interface Props { closable?: boolean children?: React.ReactNode icon?: React.ReactNode + actions?: React.ReactNode } const icons: Record< @@ -39,6 +40,7 @@ function Alert({ closable, children, icon, + actions, }: Props) { let __styles = styleHandler('alert') @@ -59,30 +61,33 @@ function Alert({ <> {visible && (
- {withIcon ? ( -
- {withIcon && icons[variant]} +
+ {withIcon ? ( +
+ {withIcon && icons[variant]} +
+ ) : null} + {icon && icon} +
+

+ {title} +

+
{children}
- ) : null} - {icon && icon} -
-

- {title} -

-
{children}
+ {actions} {closable && ( )}
diff --git a/src/lib/theme/defaultTheme.ts b/src/lib/theme/defaultTheme.ts index 6942762d..f16d562a 100644 --- a/src/lib/theme/defaultTheme.ts +++ b/src/lib/theme/defaultTheme.ts @@ -252,11 +252,8 @@ export default { alert: { base: ` - relative - rounded - py-4 px-6 - flex space-x-4 items-start - border + relative rounded border py-4 px-6 + flex justify-between space-x-4 items-start `, header: 'block text-sm font-normal mb-1', description: `text-xs`,