Skip to content

Commit

Permalink
feat: basic Alert component
Browse files Browse the repository at this point in the history
  • Loading branch information
kripod committed Dec 10, 2023
1 parent 7aba24d commit b5a2c76
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 0 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"@changesets/changelog-github": "0.5.0",
"@changesets/cli": "2.27.1",
"@evilmartians/harmony": "1.2.0",
"@heroicons/react": "2.0.18",
"@rollup/plugin-babel": "6.0.4",
"@rollup/plugin-typescript": "11.1.5",
"@storybook/addon-a11y": "7.6.4",
Expand Down
11 changes: 11 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions src/components/Alert.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import type { Meta, StoryObj } from "@storybook/react";

import { Alert } from "./Alert";

const meta = {
component: Alert,
tags: ["autodocs"],
} satisfies Meta<typeof Alert>;
export default meta;

type Story = StoryObj<typeof meta>;

export const Basic = {
args: {
children:
"An alert displays a brief, important message, usually at the top of a page. Only text content updates are conveyed to screen readers, preserving focus.",
},
} satisfies Story;
17 changes: 17 additions & 0 deletions src/components/Alert.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { InformationCircleIcon } from "@heroicons/react/24/solid";

export interface AlertProps {
children?: React.ReactNode;
}

export function Alert({ children }: AlertProps) {
return (
<div
role="alert"
className="grid grid-cols-[auto_1fr] gap-x-2 rounded-2xl bg-ui-neutral-1 p-4 text-base text-ui-neutral-5"
>
<InformationCircleIcon className="h-6 w-6" />
{children}
</div>
);
}

0 comments on commit b5a2c76

Please sign in to comment.