oneslash-design-system 2.24.0 → 2.26.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.
- package/README.md +1 -1
- package/dist/DESIGN.md +8 -4
- package/dist/cases/ask-page/answered.jsx +10 -2
- package/dist/cases/ask-page.md +12 -3
- package/dist/cases/billing-page/self-serve.jsx +4 -4
- package/dist/cases/billing-page/trial.d.ts +1 -0
- package/dist/cases/billing-page/trial.jsx +115 -0
- package/dist/cases/billing-page.md +166 -5
- package/dist/cases/collapsible-search/popover.jsx +1 -1
- package/dist/cases/collapsible-search.md +2 -2
- package/dist/cases/cookie-choice/banner.d.ts +1 -0
- package/dist/cases/cookie-choice/banner.jsx +82 -0
- package/dist/cases/cookie-choice/settings.d.ts +1 -0
- package/dist/cases/cookie-choice/settings.jsx +75 -0
- package/dist/cases/cookie-choice.md +234 -0
- package/dist/cases/dashboard/numbers-first.jsx +1 -1
- package/dist/cases/dashboard/work-first.jsx +1 -1
- package/dist/cases/dashboard.md +2 -2
- package/dist/cases/data-table-page/all-rows.jsx +1 -1
- package/dist/cases/data-table-page/paged.jsx +1 -1
- package/dist/cases/data-table-page.md +2 -2
- package/dist/cases/invoice-list/table.jsx +21 -9
- package/dist/cases/invoice-list.md +27 -12
- package/dist/cases/message-reactions/picker.jsx +1 -1
- package/dist/cases/message-reactions.md +2 -2
- package/dist/cases/message-row.md +2 -1
- package/dist/cases/newsletter-signup/inline.d.ts +1 -0
- package/dist/cases/newsletter-signup/inline.jsx +72 -0
- package/dist/cases/newsletter-signup/section.d.ts +1 -0
- package/dist/cases/newsletter-signup/section.jsx +72 -0
- package/dist/cases/newsletter-signup.md +234 -0
- package/dist/cases/number-format.md +6 -2
- package/dist/cases/on-this-page.md +2 -0
- package/dist/cases/people-row/stack.jsx +1 -1
- package/dist/cases/people-row.md +2 -2
- package/dist/cases/plan-comparison/table.d.ts +1 -0
- package/dist/cases/plan-comparison/table.jsx +47 -0
- package/dist/cases/plan-comparison.md +94 -0
- package/dist/cases/plan-picker.md +1 -0
- package/dist/cases/pricing-section.md +1 -1
- package/dist/cases/site-footer/columns.jsx +2 -1
- package/dist/cases/site-footer.md +3 -1
- package/dist/cases/stat-row/tiles.jsx +2 -1
- package/dist/cases/stat-row.md +4 -1
- package/dist/cases/task-header/agent-sets-status.jsx +1 -1
- package/dist/cases/task-header/people-change-status.jsx +1 -1
- package/dist/cases/task-header.md +2 -2
- package/dist/cases.json +245 -28
- package/dist/components/alert.d.ts +3 -1
- package/dist/components/alert.jsx +5 -5
- package/dist/components/barChart.jsx +4 -2
- package/dist/components/dateField.jsx +1 -1
- package/dist/components/formatNumber.d.ts +10 -2
- package/dist/components/formatNumber.js +44 -9
- package/dist/components/layout.d.ts +4 -2
- package/dist/components/layout.jsx +13 -2
- package/dist/components/markdown.d.ts +24 -0
- package/dist/components/markdown.jsx +81 -0
- package/dist/components/onThisPage.d.ts +14 -3
- package/dist/components/onThisPage.jsx +72 -8
- package/dist/components/pageShell.d.ts +3 -3
- package/dist/components/pageShell.jsx +6 -5
- package/dist/components/popover.d.ts +5 -1
- package/dist/components/popover.jsx +3 -2
- package/dist/components/progress.jsx +1 -1
- package/dist/components/select.jsx +5 -2
- package/dist/components/statTile.d.ts +1 -1
- package/dist/components/statTile.jsx +7 -2
- package/dist/components/tableCell.d.ts +4 -3
- package/dist/components/tableCell.jsx +2 -2
- package/dist/components/toaster.jsx +81 -11
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/internal/markdown.d.ts +40 -0
- package/dist/internal/markdown.js +577 -0
- package/dist/internal/toaster.d.ts +2 -0
- package/dist/internal/toaster.js +8 -0
- package/dist/native-mapping.json +9 -3
- package/dist/stories/Cases.generated.stories.d.ts +6 -0
- package/dist/stories/Cases.generated.stories.jsx +12 -0
- package/dist/stories/Markdown.stories.d.ts +9 -0
- package/dist/stories/Markdown.stories.jsx +66 -0
- package/dist/stories/OnThisPage.stories.d.ts +1 -0
- package/dist/stories/OnThisPage.stories.jsx +11 -0
- package/dist/stories/Popover.stories.d.ts +2 -0
- package/dist/stories/Popover.stories.jsx +33 -0
- package/dist/stories/StatTile.stories.d.ts +4 -0
- package/dist/stories/StatTile.stories.jsx +47 -2
- package/dist/stories/Toaster.stories.d.ts +4 -0
- package/dist/stories/Toaster.stories.jsx +30 -0
- package/package.json +1 -1
|
@@ -15,7 +15,7 @@ People answer a message with an emoji instead of a reply.
|
|
|
15
15
|
- Close the quick pick when an emoji is picked. Focus goes back to the button that opened it.
|
|
16
16
|
- Move focus to the 'Add reaction' button when the chip that had it disappears, because its count reached 0.
|
|
17
17
|
- Use `quick-pick` when six emoji cover most reactions, and `picker` when people use many. Both name each emoji in words.
|
|
18
|
-
- Open the picker from 'Add reaction' in a `<Popover returnFocus>` around `EmojiPicker`. Pass the person's emoji as `selected`, so they show pressed. A pick adds or removes the reaction and closes the Popover.
|
|
18
|
+
- Open the picker from 'Add reaction' in a `<Popover returnFocus aria-label="Pick a reaction">` around `EmojiPicker`. Pass the person's emoji as `selected`, so they show pressed. A pick adds or removes the reaction and closes the Popover.
|
|
19
19
|
|
|
20
20
|
## Don't
|
|
21
21
|
|
|
@@ -525,7 +525,7 @@ export default function MessageReactionsPicker() {
|
|
|
525
525
|
</Stack>
|
|
526
526
|
</Stack>
|
|
527
527
|
{/* The picker focuses its search. ArrowDown enters the grid; Tab and Shift+Tab move between the search and the grid. */}
|
|
528
|
-
<Popover open={pickOpen} anchorEl={pickAnchor} onClose={closePick} returnFocus>
|
|
528
|
+
<Popover open={pickOpen} anchorEl={pickAnchor} onClose={closePick} returnFocus aria-label="Pick a reaction">
|
|
529
529
|
<EmojiPicker
|
|
530
530
|
id="message-reactions-picker"
|
|
531
531
|
aria-label="Add reaction"
|
|
@@ -14,7 +14,8 @@ A thread shows messages from people, and sometimes from an agent.
|
|
|
14
14
|
- Put a date line between days, a `Line` with a `label` that reads 'Today', 'Yesterday', or the full date with the year: 'Monday, January 13, 2025'.
|
|
15
15
|
- Pass an `aria-label` that names the sender on every row, compact ones too: 'Dana Lee', or 'Acme Agent, agent'. The time is in the row.
|
|
16
16
|
- Give the list that holds the rows `role="log"`, so a screen reader reads new messages as they arrive.
|
|
17
|
-
- Write an agent's text as
|
|
17
|
+
- Write an agent's plain text as sentences in `Paragraph`.
|
|
18
|
+
- Render an agent's markdown with `Markdown`, never as raw text with its marks.
|
|
18
19
|
|
|
19
20
|
## Don't
|
|
20
21
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function NewsletterSignupInline(): import("react").JSX.Element;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useEffect, useRef, useState } from 'react';
|
|
3
|
+
import Form from '../../components/form';
|
|
4
|
+
import TextField from '../../components/textField';
|
|
5
|
+
import Button from '../../components/button';
|
|
6
|
+
import Heading from '../../components/heading';
|
|
7
|
+
import SiteFooter from '../../components/siteFooter';
|
|
8
|
+
import { Center, Stack } from '../../components/layout';
|
|
9
|
+
// A small check: some text, an @, then some text.
|
|
10
|
+
function looksLikeEmail(value) {
|
|
11
|
+
return /^[^@\s]+@[^@\s]+$/.test(value);
|
|
12
|
+
}
|
|
13
|
+
export default function NewsletterSignupInline() {
|
|
14
|
+
var _a = useState(''), email = _a[0], setEmail = _a[1];
|
|
15
|
+
var _b = useState(''), error = _b[0], setError = _b[1];
|
|
16
|
+
var _c = useState(false), sending = _c[0], setSending = _c[1];
|
|
17
|
+
var _d = useState(false), done = _d[0], setDone = _d[1];
|
|
18
|
+
var timer = useRef();
|
|
19
|
+
var doneLine = useRef(null);
|
|
20
|
+
// Stops the request if the example goes away before it ends.
|
|
21
|
+
useEffect(function () { return function () { return clearTimeout(timer.current); }; }, []);
|
|
22
|
+
// The form is gone, so focus moves to the line that took its place, and a screen reader reads it.
|
|
23
|
+
useEffect(function () {
|
|
24
|
+
var _a;
|
|
25
|
+
if (done)
|
|
26
|
+
(_a = doneLine.current) === null || _a === void 0 ? void 0 : _a.focus({ preventScroll: true });
|
|
27
|
+
}, [done]);
|
|
28
|
+
// While it sends, the field is read-only, not disabled, so focus stays in it.
|
|
29
|
+
function handleSubmit() {
|
|
30
|
+
if (sending)
|
|
31
|
+
return;
|
|
32
|
+
// An empty field and a bad address get their own words. The Button stays enabled either way.
|
|
33
|
+
var value = email.trim();
|
|
34
|
+
if (!value) {
|
|
35
|
+
setError('Enter your email.');
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
if (!looksLikeEmail(value)) {
|
|
39
|
+
setError('Enter an email address, like name@example.com.');
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
setError('');
|
|
43
|
+
setSending(true);
|
|
44
|
+
// Stands in for the request to the server. It always sends an email: a link to confirm a new address,
|
|
45
|
+
// or a note that an address already on the list is subscribed, with the link to leave.
|
|
46
|
+
// A failed request shows an inline error Alert above the field instead, such as 'Could not subscribe. Try again.'
|
|
47
|
+
timer.current = setTimeout(function () {
|
|
48
|
+
setSending(false);
|
|
49
|
+
// Both get an email, so the same line is true for both, and the form never tells who is subscribed.
|
|
50
|
+
setDone(true);
|
|
51
|
+
}, 1200);
|
|
52
|
+
}
|
|
53
|
+
return (<Stack gap="huge">
|
|
54
|
+
{/* The sign-up sits just above the footer, one field wide. The footer itself holds only links. */}
|
|
55
|
+
<Center width="form">
|
|
56
|
+
<Stack gap="large">
|
|
57
|
+
<Heading level={2} size="subtitle1">Get the Acme newsletter</Heading>
|
|
58
|
+
{done ? (<Heading ref={doneLine} tabIndex={-1} level={3} size="subtitle1">Check your email to confirm.</Heading>) : (<Form aria-label="Get the Acme newsletter" onSubmit={handleSubmit}>
|
|
59
|
+
<TextField id="newsletter-signup-inline-email" label="Email address" type="email" autoComplete="email" value={email} readOnly={sending} error={Boolean(error)} errorText={error} onChange={function (e) { setEmail(e.target.value); setError(''); }}/>
|
|
60
|
+
<Stack align="start">
|
|
61
|
+
<Button size="medium" type="secondary" state="enabled" label="Subscribe" htmlType="submit" loading={sending}/>
|
|
62
|
+
</Stack>
|
|
63
|
+
</Form>)}
|
|
64
|
+
</Stack>
|
|
65
|
+
</Center>
|
|
66
|
+
<SiteFooter brand={{ href: '#top', name: 'Acme' }} links={[
|
|
67
|
+
{ label: 'Pricing', href: '#pricing' },
|
|
68
|
+
{ label: 'Blog', href: '#blog' },
|
|
69
|
+
{ label: 'Privacy', href: '#privacy' },
|
|
70
|
+
]} legal="© 2026 Acme. All rights reserved."/>
|
|
71
|
+
</Stack>);
|
|
72
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function NewsletterSignupSection(): import("react").JSX.Element;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useEffect, useRef, useState } from 'react';
|
|
3
|
+
import Surface from '../../components/surface';
|
|
4
|
+
import Form from '../../components/form';
|
|
5
|
+
import TextField from '../../components/textField';
|
|
6
|
+
import Button from '../../components/button';
|
|
7
|
+
import Heading from '../../components/heading';
|
|
8
|
+
import Paragraph from '../../components/paragraph';
|
|
9
|
+
import { Center, Stack } from '../../components/layout';
|
|
10
|
+
// A small check: some text, an @, then some text.
|
|
11
|
+
function looksLikeEmail(value) {
|
|
12
|
+
return /^[^@\s]+@[^@\s]+$/.test(value);
|
|
13
|
+
}
|
|
14
|
+
export default function NewsletterSignupSection() {
|
|
15
|
+
var _a = useState(''), email = _a[0], setEmail = _a[1];
|
|
16
|
+
var _b = useState(''), error = _b[0], setError = _b[1];
|
|
17
|
+
var _c = useState(false), sending = _c[0], setSending = _c[1];
|
|
18
|
+
var _d = useState(false), done = _d[0], setDone = _d[1];
|
|
19
|
+
var timer = useRef();
|
|
20
|
+
var doneLine = useRef(null);
|
|
21
|
+
// Stops the request if the example goes away before it ends.
|
|
22
|
+
useEffect(function () { return function () { return clearTimeout(timer.current); }; }, []);
|
|
23
|
+
// The form is gone, so focus moves to the line that took its place, and a screen reader reads it.
|
|
24
|
+
useEffect(function () {
|
|
25
|
+
var _a;
|
|
26
|
+
if (done)
|
|
27
|
+
(_a = doneLine.current) === null || _a === void 0 ? void 0 : _a.focus({ preventScroll: true });
|
|
28
|
+
}, [done]);
|
|
29
|
+
// While it sends, the field is read-only, not disabled, so focus stays in it.
|
|
30
|
+
function handleSubmit() {
|
|
31
|
+
if (sending)
|
|
32
|
+
return;
|
|
33
|
+
// An empty field and a bad address get their own words. The Button stays enabled either way.
|
|
34
|
+
var value = email.trim();
|
|
35
|
+
if (!value) {
|
|
36
|
+
setError('Enter your email.');
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
if (!looksLikeEmail(value)) {
|
|
40
|
+
setError('Enter an email address, like name@example.com.');
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
setError('');
|
|
44
|
+
setSending(true);
|
|
45
|
+
// Stands in for the request to the server. It always sends an email: a link to confirm a new address,
|
|
46
|
+
// or a note that an address already on the list is subscribed, with the link to leave.
|
|
47
|
+
// A failed request shows an inline error Alert above the field instead, such as 'Could not subscribe. Try again.'
|
|
48
|
+
timer.current = setTimeout(function () {
|
|
49
|
+
setSending(false);
|
|
50
|
+
// Both get an email, so the same line is true for both, and the form never tells who is subscribed.
|
|
51
|
+
setDone(true);
|
|
52
|
+
}, 1200);
|
|
53
|
+
}
|
|
54
|
+
return (
|
|
55
|
+
// The end of a post: the section says what comes and how often, then asks for one address.
|
|
56
|
+
<Center width="form">
|
|
57
|
+
<Surface padding="small">
|
|
58
|
+
<Stack gap="large">
|
|
59
|
+
<Stack gap="small">
|
|
60
|
+
<Heading level={2} size="h6">Get the Acme newsletter</Heading>
|
|
61
|
+
<Paragraph tone="secondary" size="body2" measure="none">One email a month with what shipped. Leave any time from the link in each email.</Paragraph>
|
|
62
|
+
</Stack>
|
|
63
|
+
{done ? (<Heading ref={doneLine} tabIndex={-1} level={3} size="subtitle1">Check your email to confirm.</Heading>) : (<Form aria-label="Get the Acme newsletter" onSubmit={handleSubmit}>
|
|
64
|
+
<TextField id="newsletter-signup-section-email" label="Email address" type="email" autoComplete="email" value={email} readOnly={sending} error={Boolean(error)} errorText={error} onChange={function (e) { setEmail(e.target.value); setError(''); }}/>
|
|
65
|
+
<Stack align="start">
|
|
66
|
+
<Button size="medium" type="secondary" state="enabled" label="Subscribe" htmlType="submit" loading={sending}/>
|
|
67
|
+
</Stack>
|
|
68
|
+
</Form>)}
|
|
69
|
+
</Stack>
|
|
70
|
+
</Surface>
|
|
71
|
+
</Center>);
|
|
72
|
+
}
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
# Newsletter sign-up
|
|
2
|
+
|
|
3
|
+
A reader of the public site wants to hear about the product by email, without making an account.
|
|
4
|
+
|
|
5
|
+
## Do
|
|
6
|
+
|
|
7
|
+
- Follow the rules 'A form error shows next to the problem' and 'Success shows where the person is looking'.
|
|
8
|
+
- Use a `Form` with a visible label 'Email address' on a `TextField type="email" autoComplete="email"`, and a Button 'Subscribe'.
|
|
9
|
+
- Make 'Subscribe' secondary. The page's one primary Button stays 'Sign Up', as the rule 'A marketing page asks for one main action, in the same words everywhere' says.
|
|
10
|
+
- Show a bad address on submit, under the field: 'Enter an email address, like name@example.com.' Keep the Button enabled.
|
|
11
|
+
- Make the pressed Button `loading` while the request runs, and keep its label. Make the field `readOnly` meanwhile, so focus stays in it.
|
|
12
|
+
- Replace the form with 'Check your email to confirm.' when the request works, and move focus to that line, so a screen reader reads it.
|
|
13
|
+
- Send an email to an address already on the list too, saying it is subscribed and how to leave, so the line is true for both.
|
|
14
|
+
- Show the same line for an address that is already on the list, so the form never tells who is subscribed.
|
|
15
|
+
- Confirm by email before sending anything, as the case 'Check your email' says.
|
|
16
|
+
- Say how often the email comes and how to leave, in `section`: 'One email a month with what shipped. Leave any time from the link in each email.'
|
|
17
|
+
- Put `section` after the post's text and before the case 'Page end' `next-link`, which still ends the page. It asks for an email, not an account, so it is not a sign-up banner.
|
|
18
|
+
- Put the sign-up above the footer, not in it, as the case 'Site footer' says. The footer's 'Newsletter' link goes to a page with this form.
|
|
19
|
+
|
|
20
|
+
## Don't
|
|
21
|
+
|
|
22
|
+
- Do not open the sign-up in a popup on scroll or when the reader leaves.
|
|
23
|
+
- Do not tick a box for marketing email before the reader does.
|
|
24
|
+
- Do not use a placeholder as the only label.
|
|
25
|
+
- Do not label the Button 'Sign Up'. That word means making an account.
|
|
26
|
+
- Do not say 'You are already subscribed'. It tells anyone whether an address is on the list.
|
|
27
|
+
- Do not disable the Button until the field is filled. Show the error on submit.
|
|
28
|
+
|
|
29
|
+
## Option: One field above the footer
|
|
30
|
+
|
|
31
|
+
Use when: A sign-up just above the footer or at the end of a page, one field wide.
|
|
32
|
+
|
|
33
|
+
Uses: `Button`, `Center`, `Form`, `Heading`, `SiteFooter`, `Stack`, `TextField`
|
|
34
|
+
|
|
35
|
+
```tsx
|
|
36
|
+
'use client';
|
|
37
|
+
import { useEffect, useRef, useState } from 'react';
|
|
38
|
+
import Form from 'oneslash-design-system/components/form';
|
|
39
|
+
import TextField from 'oneslash-design-system/components/textField';
|
|
40
|
+
import Button from 'oneslash-design-system/components/button';
|
|
41
|
+
import Heading from 'oneslash-design-system/components/heading';
|
|
42
|
+
import SiteFooter from 'oneslash-design-system/components/siteFooter';
|
|
43
|
+
import { Center, Stack } from 'oneslash-design-system/components/layout';
|
|
44
|
+
|
|
45
|
+
// A small check: some text, an @, then some text.
|
|
46
|
+
function looksLikeEmail(value: string) {
|
|
47
|
+
return /^[^@\s]+@[^@\s]+$/.test(value);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export default function NewsletterSignupInline() {
|
|
51
|
+
const [email, setEmail] = useState('');
|
|
52
|
+
const [error, setError] = useState('');
|
|
53
|
+
const [sending, setSending] = useState(false);
|
|
54
|
+
const [done, setDone] = useState(false);
|
|
55
|
+
const timer = useRef<ReturnType<typeof setTimeout>>();
|
|
56
|
+
const doneLine = useRef<HTMLHeadingElement>(null);
|
|
57
|
+
|
|
58
|
+
// Stops the request if the example goes away before it ends.
|
|
59
|
+
useEffect(() => () => clearTimeout(timer.current), []);
|
|
60
|
+
|
|
61
|
+
// The form is gone, so focus moves to the line that took its place, and a screen reader reads it.
|
|
62
|
+
useEffect(() => {
|
|
63
|
+
if (done) doneLine.current?.focus({ preventScroll: true });
|
|
64
|
+
}, [done]);
|
|
65
|
+
|
|
66
|
+
// While it sends, the field is read-only, not disabled, so focus stays in it.
|
|
67
|
+
function handleSubmit() {
|
|
68
|
+
if (sending) return;
|
|
69
|
+
// An empty field and a bad address get their own words. The Button stays enabled either way.
|
|
70
|
+
const value = email.trim();
|
|
71
|
+
if (!value) {
|
|
72
|
+
setError('Enter your email.');
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
if (!looksLikeEmail(value)) {
|
|
76
|
+
setError('Enter an email address, like name@example.com.');
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
setError('');
|
|
80
|
+
setSending(true);
|
|
81
|
+
// Stands in for the request to the server. It always sends an email: a link to confirm a new address,
|
|
82
|
+
// or a note that an address already on the list is subscribed, with the link to leave.
|
|
83
|
+
// A failed request shows an inline error Alert above the field instead, such as 'Could not subscribe. Try again.'
|
|
84
|
+
timer.current = setTimeout(() => {
|
|
85
|
+
setSending(false);
|
|
86
|
+
// Both get an email, so the same line is true for both, and the form never tells who is subscribed.
|
|
87
|
+
setDone(true);
|
|
88
|
+
}, 1200);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return (
|
|
92
|
+
<Stack gap="huge">
|
|
93
|
+
{/* The sign-up sits just above the footer, one field wide. The footer itself holds only links. */}
|
|
94
|
+
<Center width="form">
|
|
95
|
+
<Stack gap="large">
|
|
96
|
+
<Heading level={2} size="subtitle1">Get the Acme newsletter</Heading>
|
|
97
|
+
{done ? (
|
|
98
|
+
<Heading ref={doneLine} tabIndex={-1} level={3} size="subtitle1">Check your email to confirm.</Heading>
|
|
99
|
+
) : (
|
|
100
|
+
<Form aria-label="Get the Acme newsletter" onSubmit={handleSubmit}>
|
|
101
|
+
<TextField
|
|
102
|
+
id="newsletter-signup-inline-email"
|
|
103
|
+
label="Email address"
|
|
104
|
+
type="email"
|
|
105
|
+
autoComplete="email"
|
|
106
|
+
value={email}
|
|
107
|
+
readOnly={sending}
|
|
108
|
+
error={Boolean(error)}
|
|
109
|
+
errorText={error}
|
|
110
|
+
onChange={(e) => { setEmail(e.target.value); setError(''); }}
|
|
111
|
+
/>
|
|
112
|
+
<Stack align="start">
|
|
113
|
+
<Button size="medium" type="secondary" state="enabled" label="Subscribe" htmlType="submit" loading={sending} />
|
|
114
|
+
</Stack>
|
|
115
|
+
</Form>
|
|
116
|
+
)}
|
|
117
|
+
</Stack>
|
|
118
|
+
</Center>
|
|
119
|
+
<SiteFooter
|
|
120
|
+
brand={{ href: '#top', name: 'Acme' }}
|
|
121
|
+
links={[
|
|
122
|
+
{ label: 'Pricing', href: '#pricing' },
|
|
123
|
+
{ label: 'Blog', href: '#blog' },
|
|
124
|
+
{ label: 'Privacy', href: '#privacy' },
|
|
125
|
+
]}
|
|
126
|
+
legal="© 2026 Acme. All rights reserved."
|
|
127
|
+
/>
|
|
128
|
+
</Stack>
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Option: A section at the end of a post
|
|
134
|
+
|
|
135
|
+
Use when: The end of a post, where a reader decides whether to hear more, so it says what comes and how often.
|
|
136
|
+
|
|
137
|
+
Uses: `Button`, `Center`, `Form`, `Heading`, `Paragraph`, `Stack`, `Surface`, `TextField`
|
|
138
|
+
|
|
139
|
+
```tsx
|
|
140
|
+
'use client';
|
|
141
|
+
import { useEffect, useRef, useState } from 'react';
|
|
142
|
+
import Surface from 'oneslash-design-system/components/surface';
|
|
143
|
+
import Form from 'oneslash-design-system/components/form';
|
|
144
|
+
import TextField from 'oneslash-design-system/components/textField';
|
|
145
|
+
import Button from 'oneslash-design-system/components/button';
|
|
146
|
+
import Heading from 'oneslash-design-system/components/heading';
|
|
147
|
+
import Paragraph from 'oneslash-design-system/components/paragraph';
|
|
148
|
+
import { Center, Stack } from 'oneslash-design-system/components/layout';
|
|
149
|
+
|
|
150
|
+
// A small check: some text, an @, then some text.
|
|
151
|
+
function looksLikeEmail(value: string) {
|
|
152
|
+
return /^[^@\s]+@[^@\s]+$/.test(value);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export default function NewsletterSignupSection() {
|
|
156
|
+
const [email, setEmail] = useState('');
|
|
157
|
+
const [error, setError] = useState('');
|
|
158
|
+
const [sending, setSending] = useState(false);
|
|
159
|
+
const [done, setDone] = useState(false);
|
|
160
|
+
const timer = useRef<ReturnType<typeof setTimeout>>();
|
|
161
|
+
const doneLine = useRef<HTMLHeadingElement>(null);
|
|
162
|
+
|
|
163
|
+
// Stops the request if the example goes away before it ends.
|
|
164
|
+
useEffect(() => () => clearTimeout(timer.current), []);
|
|
165
|
+
|
|
166
|
+
// The form is gone, so focus moves to the line that took its place, and a screen reader reads it.
|
|
167
|
+
useEffect(() => {
|
|
168
|
+
if (done) doneLine.current?.focus({ preventScroll: true });
|
|
169
|
+
}, [done]);
|
|
170
|
+
|
|
171
|
+
// While it sends, the field is read-only, not disabled, so focus stays in it.
|
|
172
|
+
function handleSubmit() {
|
|
173
|
+
if (sending) return;
|
|
174
|
+
// An empty field and a bad address get their own words. The Button stays enabled either way.
|
|
175
|
+
const value = email.trim();
|
|
176
|
+
if (!value) {
|
|
177
|
+
setError('Enter your email.');
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
if (!looksLikeEmail(value)) {
|
|
181
|
+
setError('Enter an email address, like name@example.com.');
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
setError('');
|
|
185
|
+
setSending(true);
|
|
186
|
+
// Stands in for the request to the server. It always sends an email: a link to confirm a new address,
|
|
187
|
+
// or a note that an address already on the list is subscribed, with the link to leave.
|
|
188
|
+
// A failed request shows an inline error Alert above the field instead, such as 'Could not subscribe. Try again.'
|
|
189
|
+
timer.current = setTimeout(() => {
|
|
190
|
+
setSending(false);
|
|
191
|
+
// Both get an email, so the same line is true for both, and the form never tells who is subscribed.
|
|
192
|
+
setDone(true);
|
|
193
|
+
}, 1200);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
return (
|
|
197
|
+
// The end of a post: the section says what comes and how often, then asks for one address.
|
|
198
|
+
<Center width="form">
|
|
199
|
+
<Surface padding="small">
|
|
200
|
+
<Stack gap="large">
|
|
201
|
+
<Stack gap="small">
|
|
202
|
+
<Heading level={2} size="h6">Get the Acme newsletter</Heading>
|
|
203
|
+
<Paragraph tone="secondary" size="body2" measure="none">One email a month with what shipped. Leave any time from the link in each email.</Paragraph>
|
|
204
|
+
</Stack>
|
|
205
|
+
{done ? (
|
|
206
|
+
<Heading ref={doneLine} tabIndex={-1} level={3} size="subtitle1">Check your email to confirm.</Heading>
|
|
207
|
+
) : (
|
|
208
|
+
<Form aria-label="Get the Acme newsletter" onSubmit={handleSubmit}>
|
|
209
|
+
<TextField
|
|
210
|
+
id="newsletter-signup-section-email"
|
|
211
|
+
label="Email address"
|
|
212
|
+
type="email"
|
|
213
|
+
autoComplete="email"
|
|
214
|
+
value={email}
|
|
215
|
+
readOnly={sending}
|
|
216
|
+
error={Boolean(error)}
|
|
217
|
+
errorText={error}
|
|
218
|
+
onChange={(e) => { setEmail(e.target.value); setError(''); }}
|
|
219
|
+
/>
|
|
220
|
+
<Stack align="start">
|
|
221
|
+
<Button size="medium" type="secondary" state="enabled" label="Subscribe" htmlType="submit" loading={sending} />
|
|
222
|
+
</Stack>
|
|
223
|
+
</Form>
|
|
224
|
+
)}
|
|
225
|
+
</Stack>
|
|
226
|
+
</Surface>
|
|
227
|
+
</Center>
|
|
228
|
+
);
|
|
229
|
+
}
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
## Native
|
|
233
|
+
|
|
234
|
+
On Apple and Android an app has no newsletter form. Link to the web page that has it, or let the person turn on product news in the app's notification settings.
|
|
@@ -4,7 +4,7 @@ A page shows counts, money, sizes, shares or changes.
|
|
|
4
4
|
|
|
5
5
|
## Answer
|
|
6
6
|
|
|
7
|
-
Use the helpers in `formatNumber` (`formatCount`, `formatMoney`, `formatPercent`, `formatBytes`, `formatDuration`), `StatTile` and `Progress`. A count is whole and grouped: '1,240'. In a tile, a count or an amount from 10,000 up shows its short form: '12.4K', '$12.4K'. A table shows the exact number, right-aligned. On a chart's axis, a number from 10,000 up shows its short form too: '12.4K'. The chart's readout and its table show the exact number. Money has its symbol and
|
|
7
|
+
Use the helpers in `formatNumber` (`formatCount`, `formatMoney`, `formatPercent`, `formatBytes`, `formatDuration`), `StatTile` and `Progress`. A count is whole and grouped: '1,240'. In a tile, a count or an amount from 10,000 up shows its short form: '12.4K', '$12.4K'. A table shows the exact number, right-aligned. On a chart's axis, a number from 10,000 up shows its short form too: '12.4K'. The chart's readout and its table show the exact number. Money has its symbol and its currency's decimals: '$1,240.00', '¥1,240', 'KWD 1,240.000'. A cost under the smallest unit reads '< $0.01'. A share is a whole percent, and a small one reads '< 1%'. A size is base 1024: '52 MB', '1.2 GB'. A time reads '340 ms', '1.2 s', '2 h 24 min'. The unit is in the label or after the number in words: 'Responses', '7 of 8 seats', '340 responses, no limit'. A bare number is never shown, and a unit is never only in a tooltip. A change says its direction, its size and what it compares with: 'Up 12% from last week'. It reads 'New this week' when there was nothing before. A change in a percent is in points: 'Up 3 pts from last week'. A refund in a list of charges has a minus: '-$12.00'. In a sentence, say the word: 'Refunded $12.00'. A change has no color, because more is not good or bad by itself. Unknown is never 0. `formatNumber` shows '–' for a value it cannot read. `StatTile` shows 'No data yet'. While a number loads, a `Skeleton` holds its place. On a failure, show the case 'Load failure'. A limit is a `Progress`, which says 'Limit reached' in words.
|
|
8
8
|
|
|
9
9
|
## Why
|
|
10
10
|
|
|
@@ -15,11 +15,13 @@ One page that rounds a cost to four decimals and another that rounds it to two m
|
|
|
15
15
|
- Show a count whole and grouped: '1,240'. In a tile, show a count or an amount from 10,000 up in its short form: '12.4K', '$12.4K'.
|
|
16
16
|
- Show the exact number in a table, right-aligned.
|
|
17
17
|
- Show a number from 10,000 up on a chart's axis in its short form too: '12.4K'. Show the exact number in the chart's readout and its table.
|
|
18
|
-
- Show money with its symbol and
|
|
18
|
+
- Show money with its symbol and its currency's decimals: '$1,240.00', '¥1,240', 'KWD 1,240.000'. Show a cost under the smallest unit as '< $0.01'.
|
|
19
19
|
- Show a time as '340 ms', '1.2 s' or '2 h 24 min'. Show a share as a whole percent, and a small one as '< 1%'. Show a size in base 1024: '52 MB', '1.2 GB'.
|
|
20
20
|
- Put the unit in the label or after the number in words: 'Responses', '7 of 8 seats', '340 responses, no limit'.
|
|
21
21
|
- Match the noun to the count: '1 invoice', '290 invoices'.
|
|
22
22
|
- Say a change's direction, size and comparison: 'Up 12% from last week'. Say 'New this week' when there was nothing before.
|
|
23
|
+
- Say a change in a percent in points: 'Up 3 pts from last week'. A screen reader hears 'percentage points'.
|
|
24
|
+
- Show a refund in a list of charges with a minus: '-$12.00'. In a sentence, say the word: 'Refunded $12.00'.
|
|
23
25
|
- Show a `Skeleton` while a number loads, 'No data yet' when there is none, and the case 'Load failure' when it could not load.
|
|
24
26
|
- Use the helpers in `formatNumber` (`formatCount`, `formatMoney`, `formatPercent`, `formatBytes`, `formatDuration`), `StatTile` and `Progress`. Do not format a number by hand.
|
|
25
27
|
|
|
@@ -28,6 +30,8 @@ One page that rounds a cost to four decimals and another that rounds it to two m
|
|
|
28
30
|
- Do not show 0 for a number that is loading, missing or failed.
|
|
29
31
|
- Do not show a bare number, or a unit only in a tooltip.
|
|
30
32
|
- Do not round a cost to four decimals in one place and two in another.
|
|
33
|
+
- Do not give every currency two decimals. Yen has none: '¥1,240', not '¥1,240.00'.
|
|
34
|
+
- Do not say a change in a percent as a percent ('Up 25%' for 12% against 9.6%).
|
|
31
35
|
- Do not color a change green or red. More is not good or bad by itself.
|
|
32
36
|
- Do not show the compact form ('12.4K') in a table, or give a screen reader only the compact form.
|
|
33
37
|
- Do not show only the short form in a chart. Its readout and table are exact.
|
|
@@ -10,6 +10,8 @@ A person reads a long page and wants to see its sections, jump to one and know w
|
|
|
10
10
|
- Keep the labels the same as the headings, in the same case.
|
|
11
11
|
- Name the nav 'On this page', which is the default, or pass an `aria-label` that fits the page.
|
|
12
12
|
- Let a click scroll the heading to just under the header and keep its item current until the scroll ends. With reduced motion it jumps.
|
|
13
|
+
- Pass `history="replace"` when Back should leave the page, such as a page that closes by going back. Keep the default when a person should be able to go back to where they were reading.
|
|
14
|
+
- Pass `keepInView` when images or other content above a section can load late and push it down.
|
|
13
15
|
- Keep the aside to the list. A phone does not show it, so the page must read in order without it. The sections are not places: on a phone the person scrolls to them.
|
|
14
16
|
|
|
15
17
|
## Don't
|
|
@@ -26,7 +26,7 @@ export default function PeopleRowStack() {
|
|
|
26
26
|
</Stack>
|
|
27
27
|
<AvatarStack people={people} aria-label={"Show the ".concat(people.length, " people in this thread")} aria-haspopup="dialog" aria-expanded={anchor !== null} onClick={function (event) { return setAnchor(anchor ? null : event.currentTarget); }}/>
|
|
28
28
|
</Cluster>
|
|
29
|
-
<Popover id="people-row-people" open={anchor !== null} anchorEl={anchor} onClose={function () { return setAnchor(null); }} returnFocus>
|
|
29
|
+
<Popover id="people-row-people" open={anchor !== null} anchorEl={anchor} onClose={function () { return setAnchor(null); }} returnFocus aria-label="People in this thread">
|
|
30
30
|
<List items={people.map(function (p) { return "".concat(p.name, ", ").concat(p.role); })}/>
|
|
31
31
|
</Popover>
|
|
32
32
|
</Stack>);
|
package/dist/cases/people-row.md
CHANGED
|
@@ -6,7 +6,7 @@ A thread or a task shows who is on it, and the person can find out who they all
|
|
|
6
6
|
|
|
7
7
|
- Use `AvatarStack` for four or more people. Past `max` its last circle counts the rest, such as '+3'.
|
|
8
8
|
- Make the stack one button with `onClick`, and name it for what it opens: 'Show the 6 people in this thread'.
|
|
9
|
-
- Open a `<Popover returnFocus>` from the stack with a `List` of every name and role, such as 'Ben Carter, Admin'. Escape or a click outside closes it, and Escape puts focus back on the stack.
|
|
9
|
+
- Open a `<Popover returnFocus aria-label="People in this thread">` from the stack with a `List` of every name and role, such as 'Ben Carter, Admin'. Escape or a click outside closes it, and Escape puts focus back on the stack.
|
|
10
10
|
- Show one to three people as faces and their names: 'Dana Lee, Ben Carter and Omar Reyes'. Make each face `UserImage decorative`, because the names say who is there.
|
|
11
11
|
- Keep the same order everywhere, the person who started the item first.
|
|
12
12
|
- Use the person's name as `userHandle`, so a person with no picture shows their initial.
|
|
@@ -62,7 +62,7 @@ export default function PeopleRowStack() {
|
|
|
62
62
|
onClick={(event) => setAnchor(anchor ? null : event.currentTarget)}
|
|
63
63
|
/>
|
|
64
64
|
</Cluster>
|
|
65
|
-
<Popover id="people-row-people" open={anchor !== null} anchorEl={anchor} onClose={() => setAnchor(null)} returnFocus>
|
|
65
|
+
<Popover id="people-row-people" open={anchor !== null} anchorEl={anchor} onClose={() => setAnchor(null)} returnFocus aria-label="People in this thread">
|
|
66
66
|
<List items={people.map((p) => `${p.name}, ${p.role}`)} />
|
|
67
67
|
</Popover>
|
|
68
68
|
</Stack>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function PlanComparisonTable(): import("react").JSX.Element;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import PageShell from '../../components/pageShell';
|
|
3
|
+
import SectionIntro from '../../components/sectionIntro';
|
|
4
|
+
import TableContainer from '../../components/tableContainer';
|
|
5
|
+
import TableHeader from '../../components/tableHeader';
|
|
6
|
+
import TableHeaderCell from '../../components/tableHeaderCell';
|
|
7
|
+
import TableRow from '../../components/tableRow';
|
|
8
|
+
import TableCell from '../../components/tableCell';
|
|
9
|
+
import { formatMoney } from '../../components/formatNumber';
|
|
10
|
+
import { PageSection } from '../../components/layout';
|
|
11
|
+
// The same plans as the cases 'Plan picker' and 'Pricing section': names, prices and what each includes. A real site reads them from one place.
|
|
12
|
+
var plans = [
|
|
13
|
+
{ id: 'free', name: 'Free', price: "".concat(formatMoney(0), " per month"), includes: ['3 members', '50 AI agent responses a month', '1 GB of storage'] },
|
|
14
|
+
{ id: 'pro', name: 'Pro', price: "".concat(formatMoney(8), " per member per month"), includes: ['Unlimited members', '1,000 AI agent responses a month', '50 GB of storage', 'Export to PDF'] },
|
|
15
|
+
{ id: 'business', name: 'Business', price: "".concat(formatMoney(16), " per member per month"), includes: ['Unlimited members', '10,000 AI agent responses a month', '500 GB of storage', 'Export to PDF', 'Priority support'] },
|
|
16
|
+
];
|
|
17
|
+
// One row per limit. A cell is the plan's own words for it, 'Included' when the plan has the feature, or 'Not included'.
|
|
18
|
+
var rows = [
|
|
19
|
+
{ feature: 'Price', cells: { free: "".concat(formatMoney(0), " per month"), pro: "".concat(formatMoney(8), " per member per month"), business: "".concat(formatMoney(16), " per member per month") } },
|
|
20
|
+
{ feature: 'Members', cells: { free: '3 members', pro: 'Unlimited members', business: 'Unlimited members' } },
|
|
21
|
+
{ feature: 'AI agent responses', cells: { free: '50 AI agent responses a month', pro: '1,000 AI agent responses a month', business: '10,000 AI agent responses a month' } },
|
|
22
|
+
{ feature: 'Storage', cells: { free: '1 GB of storage', pro: '50 GB of storage', business: '500 GB of storage' } },
|
|
23
|
+
{ feature: 'Export to PDF', cells: { free: 'Not included', pro: 'Included', business: 'Included' } },
|
|
24
|
+
{ feature: 'Priority support', cells: { free: 'Not included', pro: 'Not included', business: 'Included' } },
|
|
25
|
+
];
|
|
26
|
+
export default function PlanComparisonTable() {
|
|
27
|
+
return (<PageShell>
|
|
28
|
+
<PageSection gap="xxlarge">
|
|
29
|
+
<SectionIntro name="Compare plans"/>
|
|
30
|
+
{/* A named region that scrolls sideways on a phone, so the page never does. The header row stays at every width. */}
|
|
31
|
+
{/* No Buttons here: the plan cards above the table hold the one action for each plan. */}
|
|
32
|
+
<TableContainer aria-label="Compare plans" minWidth="40rem">
|
|
33
|
+
<TableHeader>
|
|
34
|
+
<TableRow>
|
|
35
|
+
<TableHeaderCell>Feature</TableHeaderCell>
|
|
36
|
+
{plans.map(function (p) { return (<TableHeaderCell key={p.id}>{p.name}</TableHeaderCell>); })}
|
|
37
|
+
</TableRow>
|
|
38
|
+
</TableHeader>
|
|
39
|
+
{rows.map(function (row) { return (<TableRow key={row.feature}>
|
|
40
|
+
{/* The feature names its row, so a screen reader says it with each cell. */}
|
|
41
|
+
<TableCell rowHeader>{row.feature}</TableCell>
|
|
42
|
+
{plans.map(function (p) { return (<TableCell key={p.id}>{row.cells[p.id]}</TableCell>); })}
|
|
43
|
+
</TableRow>); })}
|
|
44
|
+
</TableContainer>
|
|
45
|
+
</PageSection>
|
|
46
|
+
</PageShell>);
|
|
47
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# Plan comparison
|
|
2
|
+
|
|
3
|
+
A visitor to the public site wants to see every limit of every plan side by side before signing up.
|
|
4
|
+
|
|
5
|
+
## Do
|
|
6
|
+
|
|
7
|
+
- Follow the rule 'A number shows its unit and never shows 0 for unknown'.
|
|
8
|
+
- Show the same plans as the case 'Plan picker', word for word: the names, the prices and what each includes.
|
|
9
|
+
- Open the section with `SectionIntro` 'Compare plans', under the plan cards of the case 'Pricing section'.
|
|
10
|
+
- Put the table in `TableContainer aria-label="Compare plans" minWidth="40rem"`. It is a named region that scrolls sideways on a phone, as in the case 'Data table page', so the page never does.
|
|
11
|
+
- Put the plan names in the header row, after 'Feature', with one `TableHeaderCell` for each plan.
|
|
12
|
+
- Put the features in the first column, each in `TableCell rowHeader`, so a screen reader says the feature with each cell: Price, Members, AI agent responses, Storage, Export to PDF and Priority support.
|
|
13
|
+
- Write each cell in the plan's own words, such as 'Unlimited members'. Say what a plan has as 'Included' and what is missing as 'Not included'.
|
|
14
|
+
- Leave Buttons out of the table. The plan cards above it hold the one action for each plan, as the rule 'A marketing page asks for one main action, in the same words everywhere' says.
|
|
15
|
+
|
|
16
|
+
## Don't
|
|
17
|
+
|
|
18
|
+
- Do not show a check mark or a cross with no words.
|
|
19
|
+
- Do not build the table from a grid of boxes. A screen reader cannot read it as a table.
|
|
20
|
+
- Do not hide the header row on a phone. Let the table scroll sideways in its region.
|
|
21
|
+
- Do not put a Button in every column.
|
|
22
|
+
- Do not change a price or a limit here without changing it in the cases 'Plan picker' and 'Pricing section' too.
|
|
23
|
+
- Do not dim the other columns with tabs. Every plan stays in view.
|
|
24
|
+
|
|
25
|
+
## Example: Table under the plan cards
|
|
26
|
+
|
|
27
|
+
Uses: `PageSection`, `PageShell`, `SectionIntro`, `TableCell`, `TableContainer`, `TableHeader`, `TableHeaderCell`, `TableRow`, `formatMoney`
|
|
28
|
+
|
|
29
|
+
```tsx
|
|
30
|
+
'use client';
|
|
31
|
+
import PageShell from 'oneslash-design-system/components/pageShell';
|
|
32
|
+
import SectionIntro from 'oneslash-design-system/components/sectionIntro';
|
|
33
|
+
import TableContainer from 'oneslash-design-system/components/tableContainer';
|
|
34
|
+
import TableHeader from 'oneslash-design-system/components/tableHeader';
|
|
35
|
+
import TableHeaderCell from 'oneslash-design-system/components/tableHeaderCell';
|
|
36
|
+
import TableRow from 'oneslash-design-system/components/tableRow';
|
|
37
|
+
import TableCell from 'oneslash-design-system/components/tableCell';
|
|
38
|
+
import { formatMoney } from 'oneslash-design-system/components/formatNumber';
|
|
39
|
+
import { PageSection } from 'oneslash-design-system/components/layout';
|
|
40
|
+
|
|
41
|
+
type PlanId = 'free' | 'pro' | 'business';
|
|
42
|
+
|
|
43
|
+
// The same plans as the cases 'Plan picker' and 'Pricing section': names, prices and what each includes. A real site reads them from one place.
|
|
44
|
+
const plans: { id: PlanId; name: string; price: string; includes: string[] }[] = [
|
|
45
|
+
{ id: 'free', name: 'Free', price: `${formatMoney(0)} per month`, includes: ['3 members', '50 AI agent responses a month', '1 GB of storage'] },
|
|
46
|
+
{ id: 'pro', name: 'Pro', price: `${formatMoney(8)} per member per month`, includes: ['Unlimited members', '1,000 AI agent responses a month', '50 GB of storage', 'Export to PDF'] },
|
|
47
|
+
{ id: 'business', name: 'Business', price: `${formatMoney(16)} per member per month`, includes: ['Unlimited members', '10,000 AI agent responses a month', '500 GB of storage', 'Export to PDF', 'Priority support'] },
|
|
48
|
+
];
|
|
49
|
+
|
|
50
|
+
// One row per limit. A cell is the plan's own words for it, 'Included' when the plan has the feature, or 'Not included'.
|
|
51
|
+
const rows: { feature: string; cells: Record<PlanId, string> }[] = [
|
|
52
|
+
{ feature: 'Price', cells: { free: `${formatMoney(0)} per month`, pro: `${formatMoney(8)} per member per month`, business: `${formatMoney(16)} per member per month` } },
|
|
53
|
+
{ feature: 'Members', cells: { free: '3 members', pro: 'Unlimited members', business: 'Unlimited members' } },
|
|
54
|
+
{ feature: 'AI agent responses', cells: { free: '50 AI agent responses a month', pro: '1,000 AI agent responses a month', business: '10,000 AI agent responses a month' } },
|
|
55
|
+
{ feature: 'Storage', cells: { free: '1 GB of storage', pro: '50 GB of storage', business: '500 GB of storage' } },
|
|
56
|
+
{ feature: 'Export to PDF', cells: { free: 'Not included', pro: 'Included', business: 'Included' } },
|
|
57
|
+
{ feature: 'Priority support', cells: { free: 'Not included', pro: 'Not included', business: 'Included' } },
|
|
58
|
+
];
|
|
59
|
+
|
|
60
|
+
export default function PlanComparisonTable() {
|
|
61
|
+
return (
|
|
62
|
+
<PageShell>
|
|
63
|
+
<PageSection gap="xxlarge">
|
|
64
|
+
<SectionIntro name="Compare plans" />
|
|
65
|
+
{/* A named region that scrolls sideways on a phone, so the page never does. The header row stays at every width. */}
|
|
66
|
+
{/* No Buttons here: the plan cards above the table hold the one action for each plan. */}
|
|
67
|
+
<TableContainer aria-label="Compare plans" minWidth="40rem">
|
|
68
|
+
<TableHeader>
|
|
69
|
+
<TableRow>
|
|
70
|
+
<TableHeaderCell>Feature</TableHeaderCell>
|
|
71
|
+
{plans.map((p) => (
|
|
72
|
+
<TableHeaderCell key={p.id}>{p.name}</TableHeaderCell>
|
|
73
|
+
))}
|
|
74
|
+
</TableRow>
|
|
75
|
+
</TableHeader>
|
|
76
|
+
{rows.map((row) => (
|
|
77
|
+
<TableRow key={row.feature}>
|
|
78
|
+
{/* The feature names its row, so a screen reader says it with each cell. */}
|
|
79
|
+
<TableCell rowHeader>{row.feature}</TableCell>
|
|
80
|
+
{plans.map((p) => (
|
|
81
|
+
<TableCell key={p.id}>{row.cells[p.id]}</TableCell>
|
|
82
|
+
))}
|
|
83
|
+
</TableRow>
|
|
84
|
+
))}
|
|
85
|
+
</TableContainer>
|
|
86
|
+
</PageSection>
|
|
87
|
+
</PageShell>
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Native
|
|
93
|
+
|
|
94
|
+
On Apple an app has no pricing page. The plans are in the app as a `List` with the system purchase sheet, as the case 'Plan picker' says. On iPad or Mac, a `Table` with the plans as columns works too.
|