Skip to content

Commit 5f3dabf

Browse files
authored
Make alert description optional (#96)
1 parent 2604aae commit 5f3dabf

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

packages/demo/src/content/components/alert.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,6 @@ The `success`, `warning`, and `danger` variants apply a default icon automatical
116116
| Name | Description | Type | Default | Required |
117117
| ------------- | ----------------------------------------------------------------------------- | ---------------------------------------------------- | --------------- | -------- |
118118
| `title` | The alert heading, rendered as an `<h4>` | `string` |||
119-
| `description` | The alert body text, rendered as a `<p>` | `string` || |
119+
| `description` | The alert body text, rendered as a `<p>` | `string`, `ReactNode` || |
120120
| `variant` | The visual style of the alert | `primary`, `neutral`, `success`, `warning`, `danger` | `primary` ||
121121
| `icon` | Overrides the variant's default icon. Lucide name, element, or `null` to hide | `string`, `ReactElement`, `null` | Variant default ||

packages/ui/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "@eqtylab/equality",
33
"description": "EQTYLab's component and token-based design system",
44
"homepage": "https://equality.eqtylab.io/",
5-
"version": "2.0.0",
5+
"version": "2.0.1",
66
"license": "Apache-2.0",
77
"keywords": [
88
"component library",

packages/ui/src/components/alert/alert.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const defaultVariantIcons: Record<string, string> = {
3030
interface AlertProps
3131
extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof alertVariants> {
3232
title: string;
33-
description: string;
33+
description?: string | React.ReactNode;
3434
icon?: React.ReactElement | string | null;
3535
}
3636

@@ -61,7 +61,7 @@ const Alert = React.forwardRef<HTMLDivElement, AlertProps>(
6161
/>
6262
) : null}
6363
<h4 className={styles['alert-title']}>{title}</h4>
64-
<p className={styles['alert-description']}>{description}</p>
64+
{description ? <p className={styles['alert-description']}>{description}</p> : null}
6565
</div>
6666
);
6767
}

0 commit comments

Comments
 (0)