oneslash-design-system 2.7.2 → 2.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -3,11 +3,13 @@ interface PageHeaderProps {
|
|
|
3
3
|
/** A small line over the title: where this page sits. */
|
|
4
4
|
eyebrow?: string;
|
|
5
5
|
title: string;
|
|
6
|
+
/** The element and the size: h1 to h3, each a step smaller than the last. Pick the one that fits the page's outline. */
|
|
7
|
+
level?: 1 | 2 | 3;
|
|
6
8
|
lede?: React.ReactNode;
|
|
7
9
|
facts?: {
|
|
8
10
|
label: string;
|
|
9
11
|
value: React.ReactNode;
|
|
10
12
|
}[];
|
|
11
13
|
}
|
|
12
|
-
export default function PageHeader({ eyebrow, title, lede, facts }: PageHeaderProps): React.JSX.Element;
|
|
14
|
+
export default function PageHeader({ eyebrow, title, level, lede, facts }: PageHeaderProps): React.JSX.Element;
|
|
13
15
|
export {};
|
|
@@ -1,14 +1,22 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import FactsRow from './factsRow';
|
|
3
3
|
import Paragraph from './paragraph';
|
|
4
|
+
// Full class names so Tailwind sees them. Each level steps down one type-scale
|
|
5
|
+
// step, on mobile and from md up.
|
|
6
|
+
var sizes = {
|
|
7
|
+
1: 'text-h3 md:text-h2',
|
|
8
|
+
2: 'text-h4 md:text-h3',
|
|
9
|
+
3: 'text-h5 md:text-h4',
|
|
10
|
+
};
|
|
4
11
|
export default function PageHeader(_a) {
|
|
5
|
-
var eyebrow = _a.eyebrow, title = _a.title, lede = _a.lede, facts = _a.facts;
|
|
12
|
+
var eyebrow = _a.eyebrow, title = _a.title, _b = _a.level, level = _b === void 0 ? 1 : _b, lede = _a.lede, facts = _a.facts;
|
|
13
|
+
var Tag = "h".concat(level);
|
|
6
14
|
return (<div className="flex flex-col gap-huge">
|
|
7
15
|
<div className="flex flex-col gap-large">
|
|
8
16
|
{eyebrow && (<Paragraph tone="secondary" size="body2" measure="none">
|
|
9
17
|
{eyebrow}
|
|
10
18
|
</Paragraph>)}
|
|
11
|
-
<
|
|
19
|
+
<Tag className={"".concat(sizes[level], " text-fg-primary")}>{title}</Tag>
|
|
12
20
|
{lede && (<Paragraph tone="secondary" measure="lede">
|
|
13
21
|
{lede}
|
|
14
22
|
</Paragraph>)}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import PageHeader from "../components/pageHeader";
|
|
3
|
+
declare const meta: Meta<typeof PageHeader>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof PageHeader>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
/** Level 1 (the default) renders an h1 at the largest title size. */
|
|
8
|
+
export declare const Level1: Story;
|
|
9
|
+
/** Renders an h2, one type step smaller than level 1. */
|
|
10
|
+
export declare const Level2: Story;
|
|
11
|
+
/** Renders an h3, two type steps smaller than level 1. */
|
|
12
|
+
export declare const Level3: Story;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import PageHeader from "../components/pageHeader";
|
|
3
|
+
var meta = {
|
|
4
|
+
title: "Components/PageHeader",
|
|
5
|
+
component: PageHeader,
|
|
6
|
+
args: {
|
|
7
|
+
eyebrow: "Design Translation · 2011",
|
|
8
|
+
title: "Geocentric Clock",
|
|
9
|
+
lede: "The arm stays still and the numbers come to it.",
|
|
10
|
+
},
|
|
11
|
+
argTypes: {
|
|
12
|
+
level: { control: "select", options: [1, 2, 3] },
|
|
13
|
+
},
|
|
14
|
+
decorators: [
|
|
15
|
+
function (Story) { return (<div style={{ padding: "16px" }}>
|
|
16
|
+
<Story />
|
|
17
|
+
</div>); },
|
|
18
|
+
],
|
|
19
|
+
};
|
|
20
|
+
export default meta;
|
|
21
|
+
export var Default = {};
|
|
22
|
+
/** Level 1 (the default) renders an h1 at the largest title size. */
|
|
23
|
+
export var Level1 = { args: { level: 1 } };
|
|
24
|
+
/** Renders an h2, one type step smaller than level 1. */
|
|
25
|
+
export var Level2 = { args: { level: 2 } };
|
|
26
|
+
/** Renders an h3, two type steps smaller than level 1. */
|
|
27
|
+
export var Level3 = { args: { level: 3 } };
|