Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
add alert variants and alert stories
Scott Wilson9cb94b7f9752
diff --git a/frontend/src/components/v3/generic/Alert/Alert.stories.tsx b/frontend/src/components/v3/generic/Alert/Alert.stories.tsxnew file mode 100644index 0000000000..9e7009e735--- /dev/null+++ b/frontend/src/components/v3/generic/Alert/Alert.stories.tsx@@ -0,0 +1,269 @@+import type { Meta, StoryObj } from "@storybook/react-vite";+import { CheckIcon, CircleXIcon, InfoIcon, TriangleAlertIcon } from "lucide-react";++import { OrgIcon, ProjectIcon, SubOrgIcon } from "../../platform";+import { Alert, AlertDescription, AlertTitle } from "./Alert";++/**+ * Alerts surface short, scannable messages that communicate state or call attention to contextual information.+ * Compose an alert from an optional leading icon, `AlertTitle`, and `AlertDescription`.+ * The `variant` determines the semantic tone of the message.+ */+const meta = {+ title: "Generic/Alert",+ component: Alert,+ parameters: {+ layout: "centered"+ },+ tags: ["autodocs"],+ argTypes: {+ variant: {+ control: "select",+ options: ["default", "info", "success", "warning", "danger", "project", "org", "sub-org"]+ },+ children: {+ table: {+ disable: true+ }+ },+ className: {+ table: {+ disable: true+ }+ }+ },+ args: {+ className: "w-[500px]"+ }+} satisfies Meta<typeof Alert>;++export default meta;+type Story = StoryObj<typeof meta>;++export const Default: Story = {+ name: "Variant: Default",+ args: {+ variant: "default"+ },+ parameters: {+ docs: {+ description: {+ story:+ "Use this variant for neutral informational messages that do not warrant a semantic tone."+ }+ }+ },+ render: (args) => (+ <Alert {...args}>+ <AlertTitle>Your changes have been saved.</AlertTitle>+ <AlertDescription>The new configuration will apply on the next sync.</AlertDescription>+ </Alert>+ )+};++export const Info: Story = {+ name: "Variant: Info",+ args: {+ variant: "info"+ },+ parameters: {+ docs: {+ description: {+ story: "Use this variant to highlight helpful context or link to relevant documentation."+ }+ }+ },+ render: (args) => (+ <Alert {...args}>+ <InfoIcon />+ <AlertTitle>Gateway deployment recommended.</AlertTitle>+ <AlertDescription>+ Deploy a gateway in the target network to keep traffic private and avoid public endpoints.+ </AlertDescription>+ </Alert>+ )+};++export const Success: Story = {+ name: "Variant: Success",+ args: {+ variant: "success"+ },+ parameters: {+ docs: {+ description: {+ story:+ "Use this variant to confirm a successful or healthy state after an operation completes."+ }+ }+ },+ render: (args) => (+ <Alert {...args}>+ <CheckIcon />+ <AlertTitle>Integration connected.</AlertTitle>+ <AlertDescription>+ Secrets will begin syncing to the target environment within the next minute.+ </AlertDescription>+ </Alert>+ )+};++export const Warning: Story = {+ name: "Variant: Warning",+ args: {+ variant: "warning"+ },+ parameters: {+ docs: {+ description: {+ story: "Use this variant to flag attention-warranting states before the user proceeds."+ }+ }+ },+ render: (args) => (+ <Alert {...args}>+ <TriangleAlertIcon />+ <AlertTitle>Access token expires soon.</AlertTitle>+ <AlertDescription>+ This token will expire in 24 hours. Rotate it now to avoid downstream failures.+ </AlertDescription>+ </Alert>+ )+};++export const Danger: Story = {+ name: "Variant: Danger",+ args: {+ variant: "danger"+ },+ parameters: {+ docs: {+ description: {+ story:+ "Use this variant to surface errors or destructive consequences the user must acknowledge."+ }+ }+ },+ render: (args) => (+ <Alert {...args}>+ <CircleXIcon />+ <AlertTitle>This action cannot be undone.</AlertTitle>+ <AlertDescription>+ Removing this identity will revoke all active tokens and disable existing integrations.+ </AlertDescription>+ </Alert>+ )+};++export const Project: Story = {+ name: "Variant: Project",+ args: {+ variant: "project"+ },+ parameters: {+ docs: {+ description: {+ story: "Use this variant to call out project-scoped information or configuration."+ }+ }+ },+ render: (args) => (+ <Alert {...args}>+ <ProjectIcon />+ <AlertTitle>Project-level override active.</AlertTitle>+ <AlertDescription>+ This project overrides the organization default for secret rotation intervals.+ </AlertDescription>+ </Alert>+ )+};++export const Organization: Story = {+ name: "Variant: Organization",+ args: {+ variant: "org"+ },+ parameters: {+ docs: {+ description: {+ story: "Use this variant to call out organization-scoped information or configuration."+ }+ }+ },+ render: (args) => (+ <Alert {...args}>+ <OrgIcon />+ <AlertTitle>Organization-wide policy applies.</AlertTitle>+ <AlertDescription>+ Settings defined at the organization level override project-level defaults.+ </AlertDescription>+ </Alert>+ )+};++export const SubOrganization: Story = {+ name: "Variant: Sub-Organization",+ args: {+ variant: "sub-org"+ },+ parameters: {+ docs: {+ description: {+ story: "Use this variant to call out sub-organization-scoped information or configuration."+ }+ }+ },+ render: (args) => (+ <Alert {...args}>+ <SubOrgIcon />+ <AlertTitle>Inherited from sub-organization.</AlertTitle>+ <AlertDescription>+ This configuration is managed by the parent sub-organization and cannot be edited here.+ </AlertDescription>+ </Alert>+ )+};++export const TitleOnly: Story = {+ name: "Example: Title Only",+ args: {+ variant: "info"+ },+ parameters: {+ docs: {+ description: {+ story:+ "Omit `AlertDescription` when the message fits in a single line — the title aligns vertically with the icon."+ }+ }+ },+ render: (args) => (+ <Alert {...args}>+ <InfoIcon />+ <AlertTitle>Sync completed successfully.</AlertTitle>+ </Alert>+ )+};++export const WithoutIcon: Story = {+ name: "Example: Without Icon",+ args: {+ variant: "default"+ },+ parameters: {+ docs: {+ description: {+ story:+ "Omit the leading icon when the variant's tone is conveyed through color alone — the content fills the full width."+ }+ }+ },+ render: (args) => (+ <Alert {...args}>+ <AlertTitle>3 secrets were imported.</AlertTitle>+ <AlertDescription>+ Review the changes in the audit log before sharing access.+ </AlertDescription>+ </Alert>+ )+};diff --git a/frontend/src/components/v3/generic/Alert/Alert.tsx b/frontend/src/components/v3/generic/Alert/Alert.tsxindex 387ab4bb45..fd50656278 100644--- a/frontend/src/components/v3/generic/Alert/Alert.tsx+++ b/frontend/src/components/v3/generic/Alert/Alert.tsx@@ -10,9 +10,12 @@ const alertVariants = cva({variants: {variant: {- default: "bg-container text-card-foreground",+ default: "bg-foreground/5 text-foreground/75 border-border",info: "bg-info/5 text-info border-info/20",+ success: "bg-success/5 text-success border-success/20",warning: "bg-warning/5 text-warning border-warning/20",+ danger: "bg-danger/5 text-danger border-danger/20",+ project: "bg-project/5 text-project border-project/20",org: "bg-org/5 text-org border-org/20","sub-org": "bg-sub-org/5 text-sub-org border-sub-org/20"}