diff --git a/.changeset/late-pets-drop.md b/.changeset/late-pets-drop.md new file mode 100644 index 0000000..745c6bc --- /dev/null +++ b/.changeset/late-pets-drop.md @@ -0,0 +1,6 @@ +--- +"@holisticon/hap-documentation": minor +"@holisticon/hap-foundation": minor +--- + +Added CSS classes and documentation for alert component. diff --git a/packages/documentation/src/elements/alert/alert.mdx b/packages/documentation/src/elements/alert/alert.mdx new file mode 100644 index 0000000..5d9b04b --- /dev/null +++ b/packages/documentation/src/elements/alert/alert.mdx @@ -0,0 +1,28 @@ +import { Meta, Canvas } from "@storybook/blocks"; +import * as AlertStories from "./alert.stories.ts"; + + + +# Alerts + +The following kinds of alerts are available. + +## Alert Positive + + + +## Alert Caution + + + +## Alert Critical + + + +## Alert Informative + + + +## Alert Promoted + + diff --git a/packages/documentation/src/elements/alert/alert.stories.ts b/packages/documentation/src/elements/alert/alert.stories.ts new file mode 100644 index 0000000..9725263 --- /dev/null +++ b/packages/documentation/src/elements/alert/alert.stories.ts @@ -0,0 +1,65 @@ +import type { Meta, StoryObj } from "@storybook/web-components"; +import { html } from "lit"; + +type AlertVariant = + | "positive" + | "caution" + | "critical" + | "informative" + | "promoted"; + +interface AlertArgs { + label: string; + variant: AlertVariant; + icon?: string; + iconbutton?: string; +} + +const meta: Meta = { + args: { + label: "Badge", + icon: "[Icon]", + iconbutton: "[Iconbutton]", + }, + argTypes: { + variant: { + control: { type: "select" }, + options: ["positive", "caution", "critical", "informative", "promoted"], + }, + }, + + render: (args) => html` +
+
+
+ ${args.icon} + ${args.label} +
+ ${args.iconbutton} +
+
+ `, +}; + +export default meta; +type Story = StoryObj; + +export const Positive: Story = { + args: { variant: "positive", label: "This is a positive message." }, +}; + +export const Caution: Story = { + args: { variant: "caution", label: "This is a cautionary message." }, +}; + +export const Critical: Story = { + args: { variant: "critical", label: "This is a critical message." }, +}; + +export const Neutral: Story = { + args: { variant: "informative", label: "This is an informative message." }, +}; + +export const New: Story = { + args: { variant: "promoted", label: "This is a promoted message." }, +}; diff --git a/packages/foundation/src/atomic-playfulness.css b/packages/foundation/src/atomic-playfulness.css index e26cd08..19e8051 100644 --- a/packages/foundation/src/atomic-playfulness.css +++ b/packages/foundation/src/atomic-playfulness.css @@ -5,3 +5,4 @@ @import "./elements/typography.css"; @import "./elements/button.css"; @import "./elements/badge.css"; +@import "./elements/alert.css"; diff --git a/packages/foundation/src/elements/alert.css b/packages/foundation/src/elements/alert.css new file mode 100644 index 0000000..be81c94 --- /dev/null +++ b/packages/foundation/src/elements/alert.css @@ -0,0 +1,77 @@ +.hap-alert { + font-family: var(--hap-typography-font-family-body); + font-size: var(--hap-typography-font-size-bodytext-standard); + font-weight: var(--hap-typography-font-weight-regular); + letter-spacing: var(--hap-typography-letter-spacing-lg); + line-height: var(--hap-typography-line-height-bodytext-standard-multiline); + border: none; + border-radius: var(--hap-radius-rounded); + padding: var(--hap-spacing-md) var(--hap-spacing-md); + display: flex; + flex-direction: row; + align-items: flex-start; + gap: var(--hap-spacing-md); + width: 100%; + + &.positive { + color: light-dark( + var(--hap-color-feedback-positive-light), + var(--hap-color-feedback-positive-dark) + ); + background-color: light-dark( + var(--hap-color-feedback-positive-dark), + var(--hap-color-feedback-positive-light) + ); + } + + &.caution { + color: light-dark( + var(--hap-color-feedback-caution-light), + var(--hap-color-feedback-caution-dark) + ); + background-color: light-dark( + var(--hap-color-feedback-caution-dark), + var(--hap-color-feedback-caution-light) + ); + } + + &.critical { + color: light-dark( + var(--hap-color-feedback-critical-light), + var(--hap-color-feedback-critical-dark) + ); + background-color: light-dark( + var(--hap-color-feedback-critical-dark), + var(--hap-color-feedback-critical-light) + ); + } + + &.informative { + color: light-dark( + var(--hap-color-feedback-neutral-light), + var(--hap-color-feedback-neutral-dark) + ); + background-color: light-dark( + var(--hap-color-feedback-neutral-dark), + var(--hap-color-feedback-neutral-light) + ); + } + + &.promoted { + color: light-dark( + var(--hap-color-feedback-new-light), + var(--hap-color-feedback-new-dark) + ); + background-color: light-dark( + var(--hap-color-feedback-new-dark), + var(--hap-color-feedback-new-light) + ); + } +} + +.hap-alert-content { + display: flex; + flex-grow: 1; + flex-wrap: wrap; + gap: var(--hap-spacing-sm); +}