Skip to content

Commit

Permalink
updates to examples
Browse files Browse the repository at this point in the history
  • Loading branch information
Fercas123 committed Dec 18, 2024
1 parent 7c3d5f2 commit 4e8f42e
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 52 deletions.
11 changes: 5 additions & 6 deletions packages/lab/stories/dialog/dialog.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
DialogContent,
type DialogContentProps,
type DialogProps,
H2,
SplitLayout,
StackLayout,
} from "@salt-ds/core";
Expand All @@ -24,7 +23,7 @@ export default {
component: Dialog,
args: {
preheader: "Settlements",
header: <H2>Terms and conditions</H2>,
header: "Terms and conditions",
description: "Effective date: August 29, 2024",
content:
"Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.",
Expand Down Expand Up @@ -207,23 +206,23 @@ const AlertDialogTemplate: StoryFn<
export const InfoStatus = AlertDialogTemplate.bind({});
InfoStatus.args = {
status: "info",
header: <H2>Info</H2>,
header: "Info",
};

export const SuccessStatus = AlertDialogTemplate.bind({});
SuccessStatus.args = {
status: "success",
header: <H2>Success</H2>,
header: "Success",
};

export const WarningStatus = AlertDialogTemplate.bind({});
WarningStatus.args = {
status: "warning",
header: <H2>Warning</H2>,
header: "Warning",
};

export const ErrorStatus = AlertDialogTemplate.bind({});
ErrorStatus.args = {
status: "error",
header: <H2>Error</H2>,
header: "Error",
};
7 changes: 1 addition & 6 deletions packages/lab/stories/overlay/overlay.qa.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {
Button,
H2,
Overlay,
OverlayPanel,
OverlayPanelContent,
Expand Down Expand Up @@ -47,11 +46,7 @@ export const Default: StoryFn<QAContainerProps> = (props) => {
<OverlayHeader
preheader="Preheader"
description="Description"
header={
<H2 styleAs="h4">
Guidelines for optimal use of our application
</H2>
}
header="Guidelines for optimal use of our application"
actions={<CloseButton />}
/>
<OverlayPanelContent>
Expand Down
30 changes: 4 additions & 26 deletions packages/lab/stories/overlay/overlay.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {
Button,
H2,
Overlay,
OverlayPanel,
OverlayPanelContent,
Expand All @@ -9,7 +8,6 @@ import {
StackLayout,
Text,
Tooltip,
useId,
} from "@salt-ds/core";
import { CloseIcon } from "@salt-ds/icons";
import { OverlayHeader } from "@salt-ds/lab";
Expand All @@ -22,7 +20,6 @@ export default {

const HeaderTemplate: StoryFn = ({ onOpenChange, ...props }: OverlayProps) => {
const [open, setOpen] = useState(false);
const id = useId();

const onChange = (newOpen: boolean) => {
setOpen(newOpen);
Expand All @@ -35,19 +32,11 @@ const HeaderTemplate: StoryFn = ({ onOpenChange, ...props }: OverlayProps) => {
<Button>Show Overlay</Button>
</OverlayTrigger>
<OverlayPanel
aria-labelledby={id}
style={{
width: 500,
}}
>
<OverlayHeader
header={
<H2 styleAs="h4" id={id}>
Header block
</H2>
}
{...props}
/>
<OverlayHeader header="Header block" {...props} />
<OverlayPanelContent>
<StackLayout gap={1}>
<Text>
Expand All @@ -74,13 +63,8 @@ Header.args = {};

export const LongHeader = HeaderTemplate.bind({});
LongHeader.args = {
header: (
<H2 styleAs="h4">
Comprehensive guidelines and detailed instructions for the optimal use and
application of our services to ensure maximum efficiency and user
satisfaction
</H2>
),
header:
"Comprehensive guidelines and detailed instructions for the optimal use and application of our services to ensure maximum efficiency and user satisfaction",
actions: (
<Button
aria-label="Close overlay"
Expand All @@ -94,7 +78,6 @@ LongHeader.args = {

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

const onChange = (newOpen: boolean) => {
setOpen(newOpen);
Expand All @@ -120,19 +103,14 @@ export const HeaderWithCloseButton = ({ onOpenChange }: OverlayProps) => {
<Button>Show Overlay</Button>
</OverlayTrigger>
<OverlayPanel
aria-labelledby={id}
style={{
width: 500,
}}
>
<OverlayHeader
preheader="Preheader"
description="Description"
header={
<H2 styleAs="h4" id={id}>
Header block
</H2>
}
header="Header block"
actions={<CloseButton />}
/>
<OverlayPanelContent>
Expand Down
3 changes: 1 addition & 2 deletions site/src/examples/dialog/WithHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import {
Dialog,
DialogActions,
DialogContent,
H2,
H3,
StackLayout,
useId,
Expand Down Expand Up @@ -44,7 +43,7 @@ export const WithHeader = (): ReactElement => {
<Dialog open={open} onOpenChange={onOpenChange} id={id}>
<DialogHeader
preheader="Settlements"
header={<H2>Terms and conditions</H2>}
header="Terms and conditions"
description="Effective date: August 29, 2024"
actions={closeButton}
/>
Expand Down
14 changes: 2 additions & 12 deletions site/src/examples/overlay/WithHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
import {
Button,
H2,
Overlay,
OverlayPanel,
OverlayPanelContent,
OverlayTrigger,
useId,
} from "@salt-ds/core";
import { CloseIcon } from "@salt-ds/icons";
import { OverlayHeader } from "@salt-ds/lab";
import { type ReactElement, useState } from "react";

export const WithHeader = (): ReactElement => {
const [open, setOpen] = useState(false);
const id = useId();

const onOpenChange = (newOpen: boolean) => setOpen(newOpen);

Expand All @@ -33,15 +30,8 @@ export const WithHeader = (): ReactElement => {
<OverlayTrigger>
<Button>Show Overlay</Button>
</OverlayTrigger>
<OverlayPanel aria-labelledby={id}>
<OverlayHeader
header={
<H2 styleAs="h4" id={id}>
Title
</H2>
}
actions={headerActions}
/>
<OverlayPanel>
<OverlayHeader header="Title" actions={headerActions} />
<OverlayPanelContent>
<div>Content of Overlay</div>
</OverlayPanelContent>
Expand Down

0 comments on commit 4e8f42e

Please sign in to comment.