From 9a448694f7d5f59db886f5f351996a5ae97ea9dc Mon Sep 17 00:00:00 2001 From: Fernanda Castillo Date: Wed, 4 Dec 2024 14:33:59 +0000 Subject: [PATCH] updates to headers alignment --- .changeset/poor-scissors-chew.md | 5 ++++ packages/lab/src/dialog/DialogHeader.css | 4 ++- packages/lab/src/dialog/DialogHeader.tsx | 3 +- packages/lab/src/overlay/OverlayHeader.css | 1 - .../lab/stories/dialog/dialog.qa.stories.tsx | 15 +++++++++- .../lab/stories/dialog/dialog.stories.tsx | 6 ++++ .../stories/overlay/overlay.qa.stories.tsx | 12 +++++--- .../lab/stories/overlay/overlay.stories.tsx | 29 +++++++++++++++++-- 8 files changed, 64 insertions(+), 11 deletions(-) create mode 100644 .changeset/poor-scissors-chew.md diff --git a/.changeset/poor-scissors-chew.md b/.changeset/poor-scissors-chew.md new file mode 100644 index 00000000000..eda562ba27b --- /dev/null +++ b/.changeset/poor-scissors-chew.md @@ -0,0 +1,5 @@ +--- +"@salt-ds/lab": patch +--- + +fix alignment for titles spanning into multiple lines, wrap labs dialog header in H2 to avoid breaking change diff --git a/packages/lab/src/dialog/DialogHeader.css b/packages/lab/src/dialog/DialogHeader.css index 17aeb97d312..3d32cd686ad 100644 --- a/packages/lab/src/dialog/DialogHeader.css +++ b/packages/lab/src/dialog/DialogHeader.css @@ -3,12 +3,14 @@ padding-bottom: var(--salt-spacing-300); padding-left: var(--salt-spacing-300); padding-right: var(--salt-spacing-300); - align-items: center; display: flex; flex-direction: row; gap: var(--salt-spacing-100); box-sizing: border-box; } +.saltDialogHeader-header { + margin: 0; +} .saltDialogHeader-container { flex-grow: 1; diff --git a/packages/lab/src/dialog/DialogHeader.tsx b/packages/lab/src/dialog/DialogHeader.tsx index 6ea6463beff..22395b47826 100644 --- a/packages/lab/src/dialog/DialogHeader.tsx +++ b/packages/lab/src/dialog/DialogHeader.tsx @@ -1,4 +1,5 @@ import { + H2, StatusIndicator, Text, type ValidationStatus, @@ -86,7 +87,7 @@ export const DialogHeader = forwardRef( {preheader && ( {preheader} )} - {header} +

{header}

{description && ( diff --git a/packages/lab/src/overlay/OverlayHeader.css b/packages/lab/src/overlay/OverlayHeader.css index 2a74f8fd5b0..da5e7af7276 100644 --- a/packages/lab/src/overlay/OverlayHeader.css +++ b/packages/lab/src/overlay/OverlayHeader.css @@ -1,7 +1,6 @@ .saltOverlayHeader { padding: var(--salt-spacing-100); width: 100%; - align-items: center; display: flex; flex-direction: row; justify-content: stretch; diff --git a/packages/lab/stories/dialog/dialog.qa.stories.tsx b/packages/lab/stories/dialog/dialog.qa.stories.tsx index a3a355afe7e..0c2d4940096 100644 --- a/packages/lab/stories/dialog/dialog.qa.stories.tsx +++ b/packages/lab/stories/dialog/dialog.qa.stories.tsx @@ -1,4 +1,5 @@ -import { Dialog, H2 } from "@salt-ds/core"; +import { Button, Dialog, H2 } from "@salt-ds/core"; +import { CloseIcon } from "@salt-ds/icons"; import { DialogHeader } from "@salt-ds/lab"; import type { Meta, StoryFn } from "@storybook/react"; import { QAContainer, type QAContainerProps } from "docs/components"; @@ -55,6 +56,18 @@ export const DialogHeaders: StoryFn = () => ( preheader="Ensure you read and agree to these Terms" description="Effective date: August 29, 2024" /> + + + + } + status="info" + style={{ + width: 600, + }} + header="Complete terms and conditions for using the services provided by our company" + /> ); DialogHeaders.parameters = { diff --git a/packages/lab/stories/dialog/dialog.stories.tsx b/packages/lab/stories/dialog/dialog.stories.tsx index f1aaa1e77be..ea20eeac614 100644 --- a/packages/lab/stories/dialog/dialog.stories.tsx +++ b/packages/lab/stories/dialog/dialog.stories.tsx @@ -145,6 +145,12 @@ export const Default = DialogTemplate.bind({}); Default.args = { id: "Default", }; +export const LongTitle = DialogTemplate.bind({}); +Default.args = { + id: "LongTitle", + header: + "Complete terms and conditions for using the services provided by our company", +}; const AlertDialogTemplate: StoryFn< DialogProps & { header: ReactNode; content: ReactNode } diff --git a/packages/lab/stories/overlay/overlay.qa.stories.tsx b/packages/lab/stories/overlay/overlay.qa.stories.tsx index 1c7b5a5a0c4..3288dd2fcc9 100644 --- a/packages/lab/stories/overlay/overlay.qa.stories.tsx +++ b/packages/lab/stories/overlay/overlay.qa.stories.tsx @@ -29,8 +29,8 @@ export const Default: StoryFn = (props) => { return ( = (props) => { - + Header block} + header={

Guidelines for optimal use of our application

} actions={} /> diff --git a/packages/lab/stories/overlay/overlay.stories.tsx b/packages/lab/stories/overlay/overlay.stories.tsx index cf640781114..4a9d6cb56ea 100644 --- a/packages/lab/stories/overlay/overlay.stories.tsx +++ b/packages/lab/stories/overlay/overlay.stories.tsx @@ -13,14 +13,14 @@ import { } from "@salt-ds/core"; import { CloseIcon } from "@salt-ds/icons"; import { OverlayHeader } from "@salt-ds/lab"; -import type { Meta } from "@storybook/react"; +import type { Meta, StoryFn } from "@storybook/react"; import { useState } from "react"; export default { title: "Lab/Overlay Header", } as Meta; -export const Header = ({ onOpenChange }: OverlayProps) => { +const HeaderTemplate: StoryFn = ({ onOpenChange, ...props }: OverlayProps) => { const [open, setOpen] = useState(false); const id = useId(); @@ -40,7 +40,7 @@ export const Header = ({ onOpenChange }: OverlayProps) => { width: 500, }} > - Header block} /> + Header block} {...props} /> @@ -62,6 +62,29 @@ export const Header = ({ onOpenChange }: OverlayProps) => { ); }; +export const Header = HeaderTemplate.bind({}); +Header.args = {}; + +export const LongHeader = HeaderTemplate.bind({}); +LongHeader.args = { + header: ( +

+ Comprehensive guidelines and detailed instructions for the optimal use and + application of our services to ensure maximum efficiency and user + satisfaction +

+ ), + actions: ( + + ), +}; + export const HeaderWithCloseButton = ({ onOpenChange }: OverlayProps) => { const [open, setOpen] = useState(false); const id = useId();