oneslash-design-system 2.19.0 → 2.21.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 +62 -5
- package/dist/cases/about-page/profile.d.ts +1 -0
- package/dist/cases/about-page/profile.jsx +64 -0
- package/dist/cases/about-page.md +114 -0
- package/dist/cases/admin-inbox/list.d.ts +1 -0
- package/dist/cases/admin-inbox/list.jsx +104 -0
- package/dist/cases/admin-inbox/split.d.ts +1 -0
- package/dist/cases/admin-inbox/split.jsx +68 -0
- package/dist/cases/admin-inbox.md +254 -0
- package/dist/cases/api-keys.md +1 -1
- package/dist/cases/billing-page/billed-elsewhere.d.ts +1 -0
- package/dist/cases/billing-page/billed-elsewhere.jsx +28 -0
- package/dist/cases/billing-page/self-serve.d.ts +1 -0
- package/dist/cases/billing-page/self-serve.jsx +134 -0
- package/dist/cases/billing-page.md +247 -0
- package/dist/cases/blog-index/cards.d.ts +1 -0
- package/dist/cases/blog-index/cards.jsx +45 -0
- package/dist/cases/blog-index/list.d.ts +1 -0
- package/dist/cases/blog-index/list.jsx +46 -0
- package/dist/cases/blog-index.md +160 -0
- package/dist/cases/breakdown-list/bars.d.ts +1 -0
- package/dist/cases/breakdown-list/bars.jsx +47 -0
- package/dist/cases/breakdown-list/table.d.ts +1 -0
- package/dist/cases/breakdown-list/table.jsx +69 -0
- package/dist/cases/breakdown-list.md +158 -0
- package/dist/cases/changelog/by-month.d.ts +1 -0
- package/dist/cases/changelog/by-month.jsx +70 -0
- package/dist/cases/changelog/one-page.d.ts +1 -0
- package/dist/cases/changelog/one-page.jsx +70 -0
- package/dist/cases/changelog.md +200 -0
- package/dist/cases/code-sample/block.d.ts +1 -0
- package/dist/cases/code-sample/block.jsx +19 -0
- package/dist/cases/code-sample/command.d.ts +1 -0
- package/dist/cases/code-sample/command.jsx +17 -0
- package/dist/cases/code-sample.md +96 -0
- package/dist/cases/composer-limit/notice-with-action.jsx +3 -3
- package/dist/cases/composer-limit/notice.jsx +3 -3
- package/dist/cases/composer-limit.md +8 -8
- package/dist/cases/contact-page/form.d.ts +1 -0
- package/dist/cases/contact-page/form.jsx +83 -0
- package/dist/cases/contact-page/links.d.ts +1 -0
- package/dist/cases/contact-page/links.jsx +19 -0
- package/dist/cases/contact-page.md +142 -0
- package/dist/cases/dashboard/numbers-first.d.ts +1 -0
- package/dist/cases/dashboard/numbers-first.jsx +165 -0
- package/dist/cases/dashboard/work-first.d.ts +1 -0
- package/dist/cases/dashboard/work-first.jsx +165 -0
- package/dist/cases/dashboard.md +507 -0
- package/dist/cases/data-table-page/all-rows.d.ts +1 -0
- package/dist/cases/data-table-page/all-rows.jsx +226 -0
- package/dist/cases/data-table-page/paged.d.ts +1 -0
- package/dist/cases/data-table-page/paged.jsx +284 -0
- package/dist/cases/data-table-page.md +771 -0
- package/dist/cases/docs-component-page/reference.d.ts +1 -0
- package/dist/cases/docs-component-page/reference.jsx +93 -0
- package/dist/cases/docs-component-page.md +144 -0
- package/dist/cases/faq/accordion.d.ts +1 -0
- package/dist/cases/faq/accordion.jsx +25 -0
- package/dist/cases/faq/open-list.d.ts +1 -0
- package/dist/cases/faq/open-list.jsx +27 -0
- package/dist/cases/faq.md +110 -0
- package/dist/cases/feature-grid/cards.d.ts +1 -0
- package/dist/cases/feature-grid/cards.jsx +33 -0
- package/dist/cases/feature-grid/rows.d.ts +1 -0
- package/dist/cases/feature-grid/rows.jsx +30 -0
- package/dist/cases/feature-grid.md +132 -0
- package/dist/cases/image-viewer/gallery.d.ts +1 -0
- package/dist/cases/image-viewer/gallery.jsx +32 -0
- package/dist/cases/image-viewer/single.d.ts +1 -0
- package/dist/cases/image-viewer/single.jsx +25 -0
- package/dist/cases/image-viewer.md +123 -0
- package/dist/cases/invoice-list/table.d.ts +1 -0
- package/dist/cases/invoice-list/table.jsx +64 -0
- package/dist/cases/invoice-list/with-upcoming.d.ts +1 -0
- package/dist/cases/invoice-list/with-upcoming.jsx +75 -0
- package/dist/cases/invoice-list.md +237 -0
- package/dist/cases/landing-hero/centered.d.ts +1 -0
- package/dist/cases/landing-hero/centered.jsx +22 -0
- package/dist/cases/landing-hero/split.d.ts +1 -0
- package/dist/cases/landing-hero/split.jsx +30 -0
- package/dist/cases/landing-hero.md +114 -0
- package/dist/cases/legal-page/sections.d.ts +1 -0
- package/dist/cases/legal-page/sections.jsx +61 -0
- package/dist/cases/legal-page.md +96 -0
- package/dist/cases/load-failure/inline.jsx +2 -2
- package/dist/cases/load-failure.md +2 -2
- package/dist/cases/long-form-page/article.d.ts +1 -0
- package/dist/cases/long-form-page/article.jsx +58 -0
- package/dist/cases/long-form-page/with-contents.d.ts +1 -0
- package/dist/cases/long-form-page/with-contents.jsx +41 -0
- package/dist/cases/long-form-page.md +170 -0
- package/dist/cases/members-list/rows.jsx +2 -1
- package/dist/cases/members-list/table.jsx +8 -9
- package/dist/cases/members-list.md +12 -13
- package/dist/cases/message-actions/hover-toolbar.jsx +11 -8
- package/dist/cases/message-actions/menu.jsx +10 -7
- package/dist/cases/message-actions.md +19 -13
- package/dist/cases/message-attachments/in-composer.jsx +2 -2
- package/dist/cases/message-attachments/in-message.jsx +16 -11
- package/dist/cases/message-attachments.md +29 -17
- package/dist/cases/number-format.md +36 -0
- package/dist/cases/one-main-action.md +33 -0
- package/dist/cases/overflow-menu/in-a-header.jsx +9 -6
- package/dist/cases/overflow-menu/on-a-row.jsx +9 -6
- package/dist/cases/overflow-menu.md +16 -10
- package/dist/cases/page-end/cta-band.d.ts +1 -0
- package/dist/cases/page-end/cta-band.jsx +24 -0
- package/dist/cases/page-end/next-link.d.ts +1 -0
- package/dist/cases/page-end/next-link.jsx +18 -0
- package/dist/cases/page-end.md +88 -0
- package/dist/cases/paged-card/pager.d.ts +1 -0
- package/dist/cases/paged-card/pager.jsx +41 -0
- package/dist/cases/paged-card/see-all.d.ts +1 -0
- package/dist/cases/paged-card/see-all.jsx +34 -0
- package/dist/cases/paged-card.md +147 -0
- package/dist/cases/password-gate/inline.d.ts +1 -0
- package/dist/cases/password-gate/inline.jsx +94 -0
- package/dist/cases/password-gate/modal.d.ts +1 -0
- package/dist/cases/password-gate/modal.jsx +81 -0
- package/dist/cases/password-gate/page.d.ts +1 -0
- package/dist/cases/password-gate/page.jsx +82 -0
- package/dist/cases/password-gate.md +351 -0
- package/dist/cases/payment-method/none.d.ts +1 -0
- package/dist/cases/payment-method/none.jsx +17 -0
- package/dist/cases/payment-method/on-file.d.ts +1 -0
- package/dist/cases/payment-method/on-file.jsx +92 -0
- package/dist/cases/payment-method.md +182 -0
- package/dist/cases/plan-change-confirm/blocked.d.ts +1 -0
- package/dist/cases/plan-change-confirm/blocked.jsx +48 -0
- package/dist/cases/plan-change-confirm/downgrade.d.ts +1 -0
- package/dist/cases/plan-change-confirm/downgrade.jsx +52 -0
- package/dist/cases/plan-change-confirm/upgrade.d.ts +1 -0
- package/dist/cases/plan-change-confirm/upgrade.jsx +51 -0
- package/dist/cases/plan-change-confirm.md +261 -0
- package/dist/cases/plan-picker/cards.d.ts +1 -0
- package/dist/cases/plan-picker/cards.jsx +97 -0
- package/dist/cases/plan-picker/list.d.ts +1 -0
- package/dist/cases/plan-picker/list.jsx +103 -0
- package/dist/cases/plan-picker.md +297 -0
- package/dist/cases/pricing-section/cards.d.ts +1 -0
- package/dist/cases/pricing-section/cards.jsx +40 -0
- package/dist/cases/pricing-section.md +85 -0
- package/dist/cases/product-cards/grid.d.ts +1 -0
- package/dist/cases/product-cards/grid.jsx +20 -0
- package/dist/cases/product-cards.md +71 -0
- package/dist/cases/range-switch/segmented.jsx +11 -7
- package/dist/cases/range-switch.md +16 -11
- package/dist/cases/reply-feedback/thumbs.jsx +11 -8
- package/dist/cases/reply-feedback/with-reason.jsx +11 -8
- package/dist/cases/reply-feedback.md +20 -14
- package/dist/cases/section-index/cards.d.ts +1 -0
- package/dist/cases/section-index/cards.jsx +25 -0
- package/dist/cases/section-index/list.d.ts +1 -0
- package/dist/cases/section-index/list.jsx +56 -0
- package/dist/cases/section-index.md +140 -0
- package/dist/cases/settings-page/top-tabs.jsx +4 -3
- package/dist/cases/settings-page.md +5 -4
- package/dist/cases/site-header.md +1 -1
- package/dist/cases/site-search/dialog.d.ts +1 -0
- package/dist/cases/site-search/dialog.jsx +131 -0
- package/dist/cases/site-search.md +176 -0
- package/dist/cases/stat-row/featured.d.ts +1 -0
- package/dist/cases/stat-row/featured.jsx +17 -0
- package/dist/cases/stat-row/tiles.d.ts +1 -0
- package/dist/cases/stat-row/tiles.jsx +34 -0
- package/dist/cases/stat-row.md +104 -0
- package/dist/cases/status-label/dot.d.ts +1 -0
- package/dist/cases/status-label/dot.jsx +39 -0
- package/dist/cases/status-label/text.d.ts +1 -0
- package/dist/cases/status-label/text.jsx +44 -0
- package/dist/cases/status-label.md +143 -0
- package/dist/cases/tabbed-panels/tabs.d.ts +1 -0
- package/dist/cases/tabbed-panels/tabs.jsx +40 -0
- package/dist/cases/tabbed-panels.md +81 -0
- package/dist/cases/upgrade-prompt/inline.jsx +4 -2
- package/dist/cases/upgrade-prompt/modal.jsx +2 -1
- package/dist/cases/upgrade-prompt.md +10 -6
- package/dist/cases/usage-meters/by-person.d.ts +1 -0
- package/dist/cases/usage-meters/by-person.jsx +72 -0
- package/dist/cases/usage-meters/meters.d.ts +1 -0
- package/dist/cases/usage-meters/meters.jsx +49 -0
- package/dist/cases/usage-meters/with-cap.d.ts +1 -0
- package/dist/cases/usage-meters/with-cap.jsx +73 -0
- package/dist/cases/usage-meters.md +303 -0
- package/dist/cases.json +2178 -97
- package/dist/components/accordion.d.ts +31 -0
- package/dist/components/accordion.jsx +103 -0
- package/dist/components/button.d.ts +1 -1
- package/dist/components/button.jsx +11 -5
- package/dist/components/codeBlock.d.ts +26 -0
- package/dist/components/codeBlock.jsx +101 -0
- package/dist/components/formatNumber.d.ts +25 -0
- package/dist/components/formatNumber.js +125 -0
- package/dist/components/iconButton.jsx +12 -7
- package/dist/components/lightbox.d.ts +31 -0
- package/dist/components/lightbox.jsx +161 -0
- package/dist/components/linkCard.d.ts +10 -1
- package/dist/components/linkCard.jsx +32 -6
- package/dist/components/modal.d.ts +10 -2
- package/dist/components/modal.jsx +17 -12
- package/dist/components/pageHeader.jsx +1 -1
- package/dist/components/pagination.d.ts +28 -0
- package/dist/components/pagination.jsx +89 -0
- package/dist/components/progress.d.ts +33 -0
- package/dist/components/progress.jsx +50 -0
- package/dist/components/searchDialog.d.ts +44 -0
- package/dist/components/searchDialog.jsx +152 -0
- package/dist/components/skeleton.d.ts +21 -0
- package/dist/components/skeleton.jsx +41 -0
- package/dist/components/statTile.d.ts +32 -0
- package/dist/components/statTile.jsx +61 -0
- package/dist/components/tab.d.ts +5 -1
- package/dist/components/tab.jsx +2 -2
- package/dist/components/tabPanel.d.ts +16 -0
- package/dist/components/tabPanel.jsx +12 -0
- package/dist/components/tableContainer.d.ts +5 -1
- package/dist/components/tableContainer.jsx +9 -1
- package/dist/components/tableHeaderCell.d.ts +3 -1
- package/dist/components/tableHeaderCell.jsx +2 -2
- package/dist/components/tabsContainer.d.ts +5 -1
- package/dist/components/tabsContainer.jsx +2 -2
- package/dist/components/titleBar.d.ts +3 -1
- package/dist/components/titleBar.jsx +4 -3
- package/dist/index.d.ts +10 -0
- package/dist/index.js +10 -0
- package/dist/internal/accordion.d.ts +4 -0
- package/dist/internal/accordion.js +53 -0
- package/dist/internal/combobox.d.ts +20 -0
- package/dist/internal/combobox.js +28 -0
- package/dist/internal/highlight.d.ts +5 -0
- package/dist/internal/highlight.js +18 -0
- package/dist/native-mapping.json +57 -3
- package/dist/stories/Accordion.stories.d.ts +11 -0
- package/dist/stories/Accordion.stories.jsx +93 -0
- package/dist/stories/Button.stories.d.ts +1 -0
- package/dist/stories/Button.stories.jsx +19 -1
- package/dist/stories/Cases.generated.stories.d.ts +60 -0
- package/dist/stories/Cases.generated.stories.jsx +120 -0
- package/dist/stories/CodeBlock.stories.d.ts +12 -0
- package/dist/stories/CodeBlock.stories.jsx +65 -0
- package/dist/stories/Lightbox.stories.d.ts +8 -0
- package/dist/stories/Lightbox.stories.jsx +40 -0
- package/dist/stories/LinkCard.stories.d.ts +6 -0
- package/dist/stories/LinkCard.stories.jsx +17 -0
- package/dist/stories/PageHeader.stories.d.ts +2 -0
- package/dist/stories/PageHeader.stories.jsx +13 -0
- package/dist/stories/Pagination.stories.d.ts +9 -0
- package/dist/stories/Pagination.stories.jsx +75 -0
- package/dist/stories/Progress.stories.d.ts +9 -0
- package/dist/stories/Progress.stories.jsx +43 -0
- package/dist/stories/SearchDialog.stories.d.ts +17 -0
- package/dist/stories/SearchDialog.stories.jsx +111 -0
- package/dist/stories/Skeleton.stories.d.ts +7 -0
- package/dist/stories/Skeleton.stories.jsx +27 -0
- package/dist/stories/StatTile.stories.d.ts +10 -0
- package/dist/stories/StatTile.stories.jsx +55 -0
- package/dist/stories/TabPanel.stories.d.ts +7 -0
- package/dist/stories/TabPanel.stories.jsx +31 -0
- package/dist/stories/Table.stories.d.ts +1 -0
- package/dist/stories/Table.stories.jsx +49 -1
- package/dist/stories/TitleBar.stories.d.ts +1 -0
- package/dist/stories/TitleBar.stories.jsx +7 -0
- package/package.json +5 -1
|
@@ -35,6 +35,7 @@ import Tag from '../../components/tag';
|
|
|
35
35
|
import Button from '../../components/button';
|
|
36
36
|
import UserImage from '../../components/userImage';
|
|
37
37
|
import { Center, Cluster, Stack } from '../../components/layout';
|
|
38
|
+
import { formatMoney } from '../../components/formatNumber';
|
|
38
39
|
// A real app reads these from the signed-in person and the plan.
|
|
39
40
|
var youId = 'dana';
|
|
40
41
|
var canManage = true;
|
|
@@ -312,7 +313,7 @@ export default function MembersListRows() {
|
|
|
312
313
|
<Button size="small" type="tertiary" state="enabled" label="Not Now" onClickButton={function () { return setUpgradeOpen(false); }}/>
|
|
313
314
|
<Button size="small" type="primary" state="enabled" label="Upgrade to Pro" onClickButton={function () { return setUpgradeOpen(false); }}/>
|
|
314
315
|
</>}>
|
|
315
|
-
<Paragraph measure="none">All {seatLimit} seats on the Free plan are filled. Pro adds seats for
|
|
316
|
+
<Paragraph measure="none">All {seatLimit} seats on the Free plan are filled. Pro adds seats for {formatMoney(8)} per member each month.</Paragraph>
|
|
316
317
|
</Modal>
|
|
317
318
|
</Center>);
|
|
318
319
|
}
|
|
@@ -37,6 +37,7 @@ import Tag from '../../components/tag';
|
|
|
37
37
|
import Button from '../../components/button';
|
|
38
38
|
import UserImage from '../../components/userImage';
|
|
39
39
|
import { Center, Cluster, Stack } from '../../components/layout';
|
|
40
|
+
import { formatMoney } from '../../components/formatNumber';
|
|
40
41
|
// A real app reads these from the signed-in person and the plan.
|
|
41
42
|
var youId = 'dana';
|
|
42
43
|
var canManage = true;
|
|
@@ -124,12 +125,10 @@ export default function MembersListTable() {
|
|
|
124
125
|
var order = sort.by === 'name' ? byName : roleRank(roles[a.id]) - roleRank(roles[b.id]) || byName;
|
|
125
126
|
return sort.dir === 'ascending' ? order : -order;
|
|
126
127
|
});
|
|
127
|
-
// The header cell has
|
|
128
|
+
// The sorted column's header cell has `sort`; the other cells leave it unset. The Button is named by its label alone.
|
|
128
129
|
function sortButton(by, label) {
|
|
129
130
|
var active = sort.by === by;
|
|
130
|
-
|
|
131
|
-
var now = active ? "sorted ".concat(sort.dir) : 'not sorted';
|
|
132
|
-
return (<Button size="small" type="tertiary" state={active ? 'selected' : 'enabled'} label={label} aria-label={"".concat(label, ", ").concat(now, ". Sort ").concat(next, ".")} decoIcon={active ? (sort.dir === 'ascending' ? 'ArrowUp' : 'ArrowDown') : undefined} onClickButton={function () { return handleSort(by); }}/>);
|
|
131
|
+
return (<Button size="small" type="tertiary" state={active ? 'selected' : 'enabled'} label={label} decoIcon={active ? (sort.dir === 'ascending' ? 'ArrowUp' : 'ArrowDown') : undefined} onClickButton={function () { return handleSort(by); }}/>);
|
|
133
132
|
}
|
|
134
133
|
// The role is one control on its own, so it saves as soon as it changes. Nothing shows when it works.
|
|
135
134
|
function handleRoleChange(member, next) {
|
|
@@ -259,11 +258,11 @@ export default function MembersListTable() {
|
|
|
259
258
|
{!canManage && <Paragraph tone="secondary" size="body2" measure="none">Only admins can change this.</Paragraph>}
|
|
260
259
|
</Stack>
|
|
261
260
|
|
|
262
|
-
<TableContainer>
|
|
261
|
+
<TableContainer aria-label="Members" minWidth="720px">
|
|
263
262
|
<TableHeader>
|
|
264
263
|
<TableRow>
|
|
265
|
-
<TableHeaderCell>{sortButton('name', 'Name')}</TableHeaderCell>
|
|
266
|
-
<TableHeaderCell width="170px">{sortButton('role', 'Role')}</TableHeaderCell>
|
|
264
|
+
<TableHeaderCell sort={sort.by === 'name' ? sort.dir : undefined}>{sortButton('name', 'Name')}</TableHeaderCell>
|
|
265
|
+
<TableHeaderCell width="170px" sort={sort.by === 'role' ? sort.dir : undefined}>{sortButton('role', 'Role')}</TableHeaderCell>
|
|
267
266
|
<TableHeaderCell width="340px">Actions</TableHeaderCell>
|
|
268
267
|
</TableRow>
|
|
269
268
|
</TableHeader>
|
|
@@ -304,7 +303,7 @@ export default function MembersListTable() {
|
|
|
304
303
|
|
|
305
304
|
{canManage && invites.length > 0 && (<Stack gap="small">
|
|
306
305
|
<Heading level={2} size="subtitle1">Pending invites</Heading>
|
|
307
|
-
<TableContainer>
|
|
306
|
+
<TableContainer aria-label="Pending invites" minWidth="720px">
|
|
308
307
|
{invites.map(function (i) { return (<TableRow key={i.id}>
|
|
309
308
|
<TableCell>
|
|
310
309
|
<Cluster gap="small">
|
|
@@ -345,7 +344,7 @@ export default function MembersListTable() {
|
|
|
345
344
|
<Button size="small" type="tertiary" state="enabled" label="Not Now" onClickButton={function () { return setUpgradeOpen(false); }}/>
|
|
346
345
|
<Button size="small" type="primary" state="enabled" label="Upgrade to Pro" onClickButton={function () { return setUpgradeOpen(false); }}/>
|
|
347
346
|
</>}>
|
|
348
|
-
<Paragraph measure="none">All {seatLimit} seats on the Free plan are filled. Pro adds seats for
|
|
347
|
+
<Paragraph measure="none">All {seatLimit} seats on the Free plan are filled. Pro adds seats for {formatMoney(8)} per member each month.</Paragraph>
|
|
349
348
|
</Modal>
|
|
350
349
|
</Center>);
|
|
351
350
|
}
|
|
@@ -17,7 +17,7 @@ An admin sees who is in the workspace, changes their roles, removes people and i
|
|
|
17
17
|
- Open the Modal of the case 'Member invite' from an 'Invite Member' Button. Count a pending invite as a seat, because it holds one until it is accepted or revoked.
|
|
18
18
|
- Keep 'Invite Member' pressable at the seat limit. Open the Modal of the case 'Upgrade prompt', titled 'Upgrade to Pro', that says all the seats are filled.
|
|
19
19
|
- Say how many seats are used under the title: '7 of 8 seats used on the Free plan.'
|
|
20
|
-
- Sort a table by a Button in the header cell. `
|
|
20
|
+
- Sort a table by a Button in the header cell. Set `sort` on the `TableHeaderCell` of the sorted column only, and leave it unset on the others. The Button is named by its label alone: 'Name'.
|
|
21
21
|
- Use `state="selected"` and an arrow on the Button of the column that is sorted. The first press sorts A to Z and the next one reverses it.
|
|
22
22
|
|
|
23
23
|
## Don't
|
|
@@ -34,7 +34,7 @@ An admin sees who is in the workspace, changes their roles, removes people and i
|
|
|
34
34
|
|
|
35
35
|
Use when: A workspace of a few dozen people, so the whole list fits and a person finds someone by looking.
|
|
36
36
|
|
|
37
|
-
Uses: `Alert`, `Button`, `Center`, `Cluster`, `Form`, `Heading`, `Modal`, `Paragraph`, `Select`, `Stack`, `TableCell`, `TableContainer`, `TableRow`, `Tag`, `TextField`, `Toaster`, `UserImage`, `dismissToast`, `toast`
|
|
37
|
+
Uses: `Alert`, `Button`, `Center`, `Cluster`, `Form`, `Heading`, `Modal`, `Paragraph`, `Select`, `Stack`, `TableCell`, `TableContainer`, `TableRow`, `Tag`, `TextField`, `Toaster`, `UserImage`, `dismissToast`, `formatMoney`, `toast`
|
|
38
38
|
|
|
39
39
|
```tsx
|
|
40
40
|
'use client';
|
|
@@ -54,6 +54,7 @@ import Tag from 'oneslash-design-system/components/tag';
|
|
|
54
54
|
import Button from 'oneslash-design-system/components/button';
|
|
55
55
|
import UserImage from 'oneslash-design-system/components/userImage';
|
|
56
56
|
import { Center, Cluster, Stack } from 'oneslash-design-system/components/layout';
|
|
57
|
+
import { formatMoney } from 'oneslash-design-system/components/formatNumber';
|
|
57
58
|
|
|
58
59
|
type Member = { id: string; name: string; email: string; role: string };
|
|
59
60
|
type Invite = { id: string; email: string; sent: string; link: string };
|
|
@@ -382,7 +383,7 @@ export default function MembersListRows() {
|
|
|
382
383
|
</>
|
|
383
384
|
}
|
|
384
385
|
>
|
|
385
|
-
<Paragraph measure="none">All {seatLimit} seats on the Free plan are filled. Pro adds seats for
|
|
386
|
+
<Paragraph measure="none">All {seatLimit} seats on the Free plan are filled. Pro adds seats for {formatMoney(8)} per member each month.</Paragraph>
|
|
386
387
|
</Modal>
|
|
387
388
|
</Center>
|
|
388
389
|
);
|
|
@@ -393,7 +394,7 @@ export default function MembersListRows() {
|
|
|
393
394
|
|
|
394
395
|
Use when: More people than a person can scan. The columns Name and Role sort.
|
|
395
396
|
|
|
396
|
-
Uses: `Alert`, `Button`, `Center`, `Cluster`, `Form`, `Heading`, `Modal`, `Paragraph`, `Select`, `Stack`, `TableCell`, `TableContainer`, `TableHeader`, `TableHeaderCell`, `TableRow`, `Tag`, `TextField`, `Toaster`, `UserImage`, `dismissToast`, `toast`
|
|
397
|
+
Uses: `Alert`, `Button`, `Center`, `Cluster`, `Form`, `Heading`, `Modal`, `Paragraph`, `Select`, `Stack`, `TableCell`, `TableContainer`, `TableHeader`, `TableHeaderCell`, `TableRow`, `Tag`, `TextField`, `Toaster`, `UserImage`, `dismissToast`, `formatMoney`, `toast`
|
|
397
398
|
|
|
398
399
|
```tsx
|
|
399
400
|
'use client';
|
|
@@ -415,6 +416,7 @@ import Tag from 'oneslash-design-system/components/tag';
|
|
|
415
416
|
import Button from 'oneslash-design-system/components/button';
|
|
416
417
|
import UserImage from 'oneslash-design-system/components/userImage';
|
|
417
418
|
import { Center, Cluster, Stack } from 'oneslash-design-system/components/layout';
|
|
419
|
+
import { formatMoney } from 'oneslash-design-system/components/formatNumber';
|
|
418
420
|
|
|
419
421
|
type Member = { id: string; name: string; email: string; role: string };
|
|
420
422
|
type Invite = { id: string; email: string; sent: string; link: string };
|
|
@@ -520,18 +522,15 @@ export default function MembersListTable() {
|
|
|
520
522
|
return sort.dir === 'ascending' ? order : -order;
|
|
521
523
|
});
|
|
522
524
|
|
|
523
|
-
// The header cell has
|
|
525
|
+
// The sorted column's header cell has `sort`; the other cells leave it unset. The Button is named by its label alone.
|
|
524
526
|
function sortButton(by: 'name' | 'role', label: string) {
|
|
525
527
|
const active = sort.by === by;
|
|
526
|
-
const next = active && sort.dir === 'ascending' ? 'descending' : 'ascending';
|
|
527
|
-
const now = active ? `sorted ${sort.dir}` : 'not sorted';
|
|
528
528
|
return (
|
|
529
529
|
<Button
|
|
530
530
|
size="small"
|
|
531
531
|
type="tertiary"
|
|
532
532
|
state={active ? 'selected' : 'enabled'}
|
|
533
533
|
label={label}
|
|
534
|
-
aria-label={`${label}, ${now}. Sort ${next}.`}
|
|
535
534
|
decoIcon={active ? (sort.dir === 'ascending' ? 'ArrowUp' : 'ArrowDown') : undefined}
|
|
536
535
|
onClickButton={() => handleSort(by)}
|
|
537
536
|
/>
|
|
@@ -656,11 +655,11 @@ export default function MembersListTable() {
|
|
|
656
655
|
{!canManage && <Paragraph tone="secondary" size="body2" measure="none">Only admins can change this.</Paragraph>}
|
|
657
656
|
</Stack>
|
|
658
657
|
|
|
659
|
-
<TableContainer>
|
|
658
|
+
<TableContainer aria-label="Members" minWidth="720px">
|
|
660
659
|
<TableHeader>
|
|
661
660
|
<TableRow>
|
|
662
|
-
<TableHeaderCell>{sortButton('name', 'Name')}</TableHeaderCell>
|
|
663
|
-
<TableHeaderCell width="170px">{sortButton('role', 'Role')}</TableHeaderCell>
|
|
661
|
+
<TableHeaderCell sort={sort.by === 'name' ? sort.dir : undefined}>{sortButton('name', 'Name')}</TableHeaderCell>
|
|
662
|
+
<TableHeaderCell width="170px" sort={sort.by === 'role' ? sort.dir : undefined}>{sortButton('role', 'Role')}</TableHeaderCell>
|
|
664
663
|
<TableHeaderCell width="340px">Actions</TableHeaderCell>
|
|
665
664
|
</TableRow>
|
|
666
665
|
</TableHeader>
|
|
@@ -722,7 +721,7 @@ export default function MembersListTable() {
|
|
|
722
721
|
{canManage && invites.length > 0 && (
|
|
723
722
|
<Stack gap="small">
|
|
724
723
|
<Heading level={2} size="subtitle1">Pending invites</Heading>
|
|
725
|
-
<TableContainer>
|
|
724
|
+
<TableContainer aria-label="Pending invites" minWidth="720px">
|
|
726
725
|
{invites.map((i) => (
|
|
727
726
|
<TableRow key={i.id}>
|
|
728
727
|
<TableCell>
|
|
@@ -787,7 +786,7 @@ export default function MembersListTable() {
|
|
|
787
786
|
</>
|
|
788
787
|
}
|
|
789
788
|
>
|
|
790
|
-
<Paragraph measure="none">All {seatLimit} seats on the Free plan are filled. Pro adds seats for
|
|
789
|
+
<Paragraph measure="none">All {seatLimit} seats on the Free plan are filled. Pro adds seats for {formatMoney(8)} per member each month.</Paragraph>
|
|
791
790
|
</Modal>
|
|
792
791
|
</Center>
|
|
793
792
|
);
|
|
@@ -67,14 +67,17 @@ export default function MessageActionsHoverToolbar() {
|
|
|
67
67
|
// The clipboard answers later; by then the example may be gone.
|
|
68
68
|
var mounted = useRef(true);
|
|
69
69
|
// On unmount it stops the timers and closes every toast it opened.
|
|
70
|
-
useEffect(function () {
|
|
71
|
-
mounted.current =
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
70
|
+
useEffect(function () {
|
|
71
|
+
mounted.current = true;
|
|
72
|
+
return function () {
|
|
73
|
+
mounted.current = false;
|
|
74
|
+
clearTimeout(copyTimer.current);
|
|
75
|
+
clearTimeout(saveTimer.current);
|
|
76
|
+
clearTimeout(deleteTimer.current);
|
|
77
|
+
toastIds.current.forEach(function (id) { return dismissToast(id); });
|
|
78
|
+
toastIds.current = [];
|
|
79
|
+
};
|
|
80
|
+
}, []);
|
|
78
81
|
useEffect(function () {
|
|
79
82
|
var move = focusNext.current;
|
|
80
83
|
focusNext.current = undefined;
|
|
@@ -70,13 +70,16 @@ export default function MessageActionsMenu() {
|
|
|
70
70
|
// The clipboard answers later; by then the example may be gone.
|
|
71
71
|
var mounted = useRef(true);
|
|
72
72
|
// On unmount it stops the timers and closes every toast it opened.
|
|
73
|
-
useEffect(function () {
|
|
74
|
-
mounted.current =
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
73
|
+
useEffect(function () {
|
|
74
|
+
mounted.current = true;
|
|
75
|
+
return function () {
|
|
76
|
+
mounted.current = false;
|
|
77
|
+
clearTimeout(saveTimer.current);
|
|
78
|
+
clearTimeout(deleteTimer.current);
|
|
79
|
+
toastIds.current.forEach(function (id) { return dismissToast(id); });
|
|
80
|
+
toastIds.current = [];
|
|
81
|
+
};
|
|
82
|
+
}, []);
|
|
80
83
|
useEffect(function () {
|
|
81
84
|
var move = focusNext.current;
|
|
82
85
|
focusNext.current = undefined;
|
|
@@ -95,13 +95,16 @@ export default function MessageActionsHoverToolbar() {
|
|
|
95
95
|
const mounted = useRef(true);
|
|
96
96
|
|
|
97
97
|
// On unmount it stops the timers and closes every toast it opened.
|
|
98
|
-
useEffect(() =>
|
|
99
|
-
mounted.current =
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
98
|
+
useEffect(() => {
|
|
99
|
+
mounted.current = true;
|
|
100
|
+
return () => {
|
|
101
|
+
mounted.current = false;
|
|
102
|
+
clearTimeout(copyTimer.current);
|
|
103
|
+
clearTimeout(saveTimer.current);
|
|
104
|
+
clearTimeout(deleteTimer.current);
|
|
105
|
+
toastIds.current.forEach((id) => dismissToast(id));
|
|
106
|
+
toastIds.current = [];
|
|
107
|
+
};
|
|
105
108
|
}, []);
|
|
106
109
|
|
|
107
110
|
useEffect(() => {
|
|
@@ -387,12 +390,15 @@ export default function MessageActionsMenu() {
|
|
|
387
390
|
const mounted = useRef(true);
|
|
388
391
|
|
|
389
392
|
// On unmount it stops the timers and closes every toast it opened.
|
|
390
|
-
useEffect(() =>
|
|
391
|
-
mounted.current =
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
393
|
+
useEffect(() => {
|
|
394
|
+
mounted.current = true;
|
|
395
|
+
return () => {
|
|
396
|
+
mounted.current = false;
|
|
397
|
+
clearTimeout(saveTimer.current);
|
|
398
|
+
clearTimeout(deleteTimer.current);
|
|
399
|
+
toastIds.current.forEach((id) => dismissToast(id));
|
|
400
|
+
toastIds.current = [];
|
|
401
|
+
};
|
|
396
402
|
}, []);
|
|
397
403
|
|
|
398
404
|
useEffect(() => {
|
|
@@ -34,8 +34,8 @@ import { Center, Cluster, Stack } from '../../components/layout';
|
|
|
34
34
|
var me = 'Dana Lee';
|
|
35
35
|
var MAX_FILES = 5;
|
|
36
36
|
var firstThread = [
|
|
37
|
-
{ id: 'm1', from: 'Ben Carter', at: new Date('
|
|
38
|
-
{ id: 'm2', from: 'Omar Reyes', at: new Date('
|
|
37
|
+
{ id: 'm1', from: 'Ben Carter', at: new Date('2026-11-16T11:40:00Z'), text: 'Can someone send the launch assets?' },
|
|
38
|
+
{ id: 'm2', from: 'Omar Reyes', at: new Date('2026-11-16T11:42:00Z'), text: 'Dana has the final versions.' },
|
|
39
39
|
];
|
|
40
40
|
// Opens with one file ready, one still uploading and one the server refused.
|
|
41
41
|
var firstFiles = [
|
|
@@ -1,19 +1,25 @@
|
|
|
1
1
|
'use client';
|
|
2
|
+
import { useState } from 'react';
|
|
2
3
|
import Message from '../../components/message';
|
|
3
4
|
import UserImage from '../../components/userImage';
|
|
4
5
|
import TimeStamp from '../../components/timeStamp';
|
|
5
6
|
import Heading from '../../components/heading';
|
|
6
7
|
import Paragraph from '../../components/paragraph';
|
|
7
8
|
import FileChip from '../../components/fileChip';
|
|
8
|
-
import
|
|
9
|
-
import Image from '../../components/image';
|
|
9
|
+
import Lightbox, { LightboxThumbnail } from '../../components/lightbox';
|
|
10
10
|
import { Center, Cluster, Grid, Stack } from '../../components/layout';
|
|
11
11
|
// Two small drawings stand in for the uploaded photos.
|
|
12
12
|
var hillside = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 160 120'%3E%3Crect width='160' height='120' fill='%23dfe9f2'/%3E%3Ccircle cx='120' cy='32' r='14' fill='%23f2c46d'/%3E%3Cpath d='M0 90 50 60l40 22 30-18 40 24v32H0z' fill='%232f6b4f'/%3E%3C/svg%3E";
|
|
13
13
|
var desk = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 160 120'%3E%3Crect width='160' height='120' fill='%23efe6da'/%3E%3Crect x='30' y='30' width='100' height='60' rx='6' fill='%23333d47'/%3E%3Crect x='38' y='38' width='84' height='44' rx='2' fill='%2389b4d9'/%3E%3Crect x='20' y='92' width='120' height='6' rx='3' fill='%238a6d4b'/%3E%3C/svg%3E";
|
|
14
|
-
var
|
|
15
|
-
|
|
14
|
+
var photos = [
|
|
15
|
+
{ src: hillside, alt: 'Hero option A, a green hillside under a pale sky with the sun on the right' },
|
|
16
|
+
{ src: desk, alt: 'Hero option B, a laptop on a wooden desk, its screen blue' },
|
|
17
|
+
];
|
|
18
|
+
var before = { id: 'm1', from: 'Ben Carter', at: new Date('2026-11-16T11:40:00Z'), text: 'Can someone send the launch assets?' };
|
|
19
|
+
var withFiles = { id: 'm2', from: 'Dana Lee', at: new Date('2026-11-16T11:44:00Z'), text: 'Here are the two hero options and the brief.' };
|
|
16
20
|
export default function MessageAttachmentsInMessage() {
|
|
21
|
+
var _a = useState(false), open = _a[0], setOpen = _a[1];
|
|
22
|
+
var _b = useState(0), index = _b[0], setIndex = _b[1];
|
|
17
23
|
return (<Center width="page">
|
|
18
24
|
<Stack gap="large">
|
|
19
25
|
<Heading level={1} size="h5">Launch plan</Heading>
|
|
@@ -23,14 +29,12 @@ export default function MessageAttachmentsInMessage() {
|
|
|
23
29
|
<Paragraph measure="none">{before.text}</Paragraph>
|
|
24
30
|
</Message>
|
|
25
31
|
<Message aria-label={withFiles.from} avatar={<UserImage userHandle={withFiles.from} decorative/>} name={withFiles.from} meta={<TimeStamp createdAt={withFiles.at} dateFormat="absolute" data="time"/>} footer={<Stack gap="small">
|
|
26
|
-
{/* Small thumbnails: four columns, two of them used.
|
|
32
|
+
{/* Small thumbnails: four columns, two of them used. Each opens the Lightbox; closing it gives focus back to that thumbnail. */}
|
|
27
33
|
<Grid columns={4} compact gap="small">
|
|
28
|
-
<
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
<Image src={desk} alt="Hero option B: a laptop on a wooden desk, its screen blue" width={160} height={120}/>
|
|
33
|
-
</Figure>
|
|
34
|
+
{photos.map(function (photo, i) { return (<LightboxThumbnail key={photo.alt} image={photo} onOpen={function () {
|
|
35
|
+
setIndex(i);
|
|
36
|
+
setOpen(true);
|
|
37
|
+
}}/>); })}
|
|
34
38
|
</Grid>
|
|
35
39
|
<Cluster gap="small">
|
|
36
40
|
{/* Each chip opens the file. */}
|
|
@@ -42,5 +46,6 @@ export default function MessageAttachmentsInMessage() {
|
|
|
42
46
|
</Message>
|
|
43
47
|
</Stack>
|
|
44
48
|
</Stack>
|
|
49
|
+
<Lightbox images={photos} index={index} onIndexChange={setIndex} isOpen={open} onClose={function () { return setOpen(false); }} aria-label="Launch images"/>
|
|
45
50
|
</Center>);
|
|
46
51
|
}
|
|
@@ -15,10 +15,10 @@ A person adds files to a message, and people open the files in a message that wa
|
|
|
15
15
|
- Pass `canSubmit` so a message with files and no text can be sent.
|
|
16
16
|
- Keep the files and the text when a send fails. Show an inline error Alert above the message box, as the rule 'A form error shows next to the problem' says.
|
|
17
17
|
- Move focus to the next chip after a chip is removed, or to the message box when none is left, since the chip that had it is gone.
|
|
18
|
-
- Show images in a sent message as thumbnails: a `Grid` of
|
|
18
|
+
- Show images in a sent message as thumbnails: a `Grid` of `LightboxThumbnail`s. Write `alt` text that says what the image shows.
|
|
19
19
|
- Show other files as `FileChip`s that open the file, with the kind ('PDF'), the name and the size.
|
|
20
|
-
-
|
|
21
|
-
-
|
|
20
|
+
- Keep each image's file reachable: when an image fails to load, the `Lightbox` shows 'This image could not be loaded.' with its alt text.
|
|
21
|
+
- Open an image at full size in a `Lightbox`: render one with the list of images, the `index`, `onIndexChange`, `isOpen` and `onClose`, as the case 'Image viewer' says. Closing it gives focus back to the thumbnail.
|
|
22
22
|
|
|
23
23
|
## Don't
|
|
24
24
|
|
|
@@ -55,8 +55,8 @@ type Upload = { id: string; name: string; kind: string; size: string; state: 're
|
|
|
55
55
|
type Row = { id: string; from: string; at: Date; text: string; files?: Upload[] };
|
|
56
56
|
|
|
57
57
|
const firstThread: Row[] = [
|
|
58
|
-
{ id: 'm1', from: 'Ben Carter', at: new Date('
|
|
59
|
-
{ id: 'm2', from: 'Omar Reyes', at: new Date('
|
|
58
|
+
{ id: 'm1', from: 'Ben Carter', at: new Date('2026-11-16T11:40:00Z'), text: 'Can someone send the launch assets?' },
|
|
59
|
+
{ id: 'm2', from: 'Omar Reyes', at: new Date('2026-11-16T11:42:00Z'), text: 'Dana has the final versions.' },
|
|
60
60
|
];
|
|
61
61
|
|
|
62
62
|
// Opens with one file ready, one still uploading and one the server refused.
|
|
@@ -228,18 +228,18 @@ export default function MessageAttachmentsInComposer() {
|
|
|
228
228
|
|
|
229
229
|
Use when: Files are part of a message in the thread.
|
|
230
230
|
|
|
231
|
-
Uses: `Center`, `Cluster`, `
|
|
231
|
+
Uses: `Center`, `Cluster`, `FileChip`, `Grid`, `Heading`, `Lightbox`, `LightboxThumbnail`, `Message`, `Paragraph`, `Stack`, `TimeStamp`, `UserImage`
|
|
232
232
|
|
|
233
233
|
```tsx
|
|
234
234
|
'use client';
|
|
235
|
+
import { useState } from 'react';
|
|
235
236
|
import Message from 'oneslash-design-system/components/message';
|
|
236
237
|
import UserImage from 'oneslash-design-system/components/userImage';
|
|
237
238
|
import TimeStamp from 'oneslash-design-system/components/timeStamp';
|
|
238
239
|
import Heading from 'oneslash-design-system/components/heading';
|
|
239
240
|
import Paragraph from 'oneslash-design-system/components/paragraph';
|
|
240
241
|
import FileChip from 'oneslash-design-system/components/fileChip';
|
|
241
|
-
import
|
|
242
|
-
import Image from 'oneslash-design-system/components/image';
|
|
242
|
+
import Lightbox, { LightboxThumbnail } from 'oneslash-design-system/components/lightbox';
|
|
243
243
|
import { Center, Cluster, Grid, Stack } from 'oneslash-design-system/components/layout';
|
|
244
244
|
|
|
245
245
|
// Two small drawings stand in for the uploaded photos.
|
|
@@ -248,12 +248,19 @@ const hillside =
|
|
|
248
248
|
const desk =
|
|
249
249
|
"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 160 120'%3E%3Crect width='160' height='120' fill='%23efe6da'/%3E%3Crect x='30' y='30' width='100' height='60' rx='6' fill='%23333d47'/%3E%3Crect x='38' y='38' width='84' height='44' rx='2' fill='%2389b4d9'/%3E%3Crect x='20' y='92' width='120' height='6' rx='3' fill='%238a6d4b'/%3E%3C/svg%3E";
|
|
250
250
|
|
|
251
|
+
const photos = [
|
|
252
|
+
{ src: hillside, alt: 'Hero option A, a green hillside under a pale sky with the sun on the right' },
|
|
253
|
+
{ src: desk, alt: 'Hero option B, a laptop on a wooden desk, its screen blue' },
|
|
254
|
+
];
|
|
255
|
+
|
|
251
256
|
type Row = { id: string; from: string; at: Date; text: string };
|
|
252
257
|
|
|
253
|
-
const before: Row = { id: 'm1', from: 'Ben Carter', at: new Date('
|
|
254
|
-
const withFiles: Row = { id: 'm2', from: 'Dana Lee', at: new Date('
|
|
258
|
+
const before: Row = { id: 'm1', from: 'Ben Carter', at: new Date('2026-11-16T11:40:00Z'), text: 'Can someone send the launch assets?' };
|
|
259
|
+
const withFiles: Row = { id: 'm2', from: 'Dana Lee', at: new Date('2026-11-16T11:44:00Z'), text: 'Here are the two hero options and the brief.' };
|
|
255
260
|
|
|
256
261
|
export default function MessageAttachmentsInMessage() {
|
|
262
|
+
const [open, setOpen] = useState(false);
|
|
263
|
+
const [index, setIndex] = useState(0);
|
|
257
264
|
return (
|
|
258
265
|
<Center width="page">
|
|
259
266
|
<Stack gap="large">
|
|
@@ -275,14 +282,18 @@ export default function MessageAttachmentsInMessage() {
|
|
|
275
282
|
meta={<TimeStamp createdAt={withFiles.at} dateFormat="absolute" data="time" />}
|
|
276
283
|
footer={
|
|
277
284
|
<Stack gap="small">
|
|
278
|
-
{/* Small thumbnails: four columns, two of them used.
|
|
285
|
+
{/* Small thumbnails: four columns, two of them used. Each opens the Lightbox; closing it gives focus back to that thumbnail. */}
|
|
279
286
|
<Grid columns={4} compact gap="small">
|
|
280
|
-
|
|
281
|
-
<
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
287
|
+
{photos.map((photo, i) => (
|
|
288
|
+
<LightboxThumbnail
|
|
289
|
+
key={photo.alt}
|
|
290
|
+
image={photo}
|
|
291
|
+
onOpen={() => {
|
|
292
|
+
setIndex(i);
|
|
293
|
+
setOpen(true);
|
|
294
|
+
}}
|
|
295
|
+
/>
|
|
296
|
+
))}
|
|
286
297
|
</Grid>
|
|
287
298
|
<Cluster gap="small">
|
|
288
299
|
{/* Each chip opens the file. */}
|
|
@@ -296,6 +307,7 @@ export default function MessageAttachmentsInMessage() {
|
|
|
296
307
|
</Message>
|
|
297
308
|
</Stack>
|
|
298
309
|
</Stack>
|
|
310
|
+
<Lightbox images={photos} index={index} onIndexChange={setIndex} isOpen={open} onClose={() => setOpen(false)} aria-label="Launch images" />
|
|
299
311
|
</Center>
|
|
300
312
|
);
|
|
301
313
|
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# A number shows its unit and never shows 0 for unknown
|
|
2
|
+
|
|
3
|
+
A page shows counts, money, sizes, shares or changes.
|
|
4
|
+
|
|
5
|
+
## Answer
|
|
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. Money has its symbol and two decimals: '$1,240.00'. A cost under a cent 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. It 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
|
+
|
|
9
|
+
## Why
|
|
10
|
+
|
|
11
|
+
One page that rounds a cost to four decimals and another that rounds it to two make the same bill look like two different amounts. A 0 shown while a number loads reads as a real answer, so the person believes something that is not true.
|
|
12
|
+
|
|
13
|
+
## Do
|
|
14
|
+
|
|
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
|
+
- Show the exact number in a table, right-aligned.
|
|
17
|
+
- Show money with its symbol and two decimals, and a cost under a cent as '< $0.01'.
|
|
18
|
+
- 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'.
|
|
19
|
+
- Put the unit in the label or after the number in words: 'Responses', '7 of 8 seats', '340 responses, no limit'.
|
|
20
|
+
- Match the noun to the count: '1 invoice', '290 invoices'.
|
|
21
|
+
- Say a change's direction, size and comparison: 'Up 12% from last week'. Say 'New this week' when there was nothing before.
|
|
22
|
+
- Show a `Skeleton` while a number loads, 'No data yet' when there is none, and the case 'Load failure' when it could not load.
|
|
23
|
+
- Use the helpers in `formatNumber` (`formatCount`, `formatMoney`, `formatPercent`, `formatBytes`, `formatDuration`), `StatTile` and `Progress`. Do not format a number by hand.
|
|
24
|
+
|
|
25
|
+
## Don't
|
|
26
|
+
|
|
27
|
+
- Do not show 0 for a number that is loading, missing or failed.
|
|
28
|
+
- Do not show a bare number, or a unit only in a tooltip.
|
|
29
|
+
- Do not round a cost to four decimals in one place and two in another.
|
|
30
|
+
- Do not color a change green or red. More is not good or bad by itself.
|
|
31
|
+
- Do not show the compact form ('12.4K') in a table, or give a screen reader only the compact form.
|
|
32
|
+
- Do not show 100% for a share that is not the whole.
|
|
33
|
+
|
|
34
|
+
## Native
|
|
35
|
+
|
|
36
|
+
On Apple use `FormatStyle` for numbers, money and percents, and `ByteCountFormatStyle` with the `.memory` style for sizes, which is base 1024. On Android use `NumberFormat`.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# A marketing page asks for one main action, in the same words everywhere
|
|
2
|
+
|
|
3
|
+
A marketing page asks the visitor to do something: sign up, open the app, buy a plan.
|
|
4
|
+
|
|
5
|
+
## Answer
|
|
6
|
+
|
|
7
|
+
A page has one main action. It is a primary `Button` with the same label in the header, the hero, the pricing section and the end of the page: 'Sign Up', or 'Sign Up for Pro' on a plan. A second action is a secondary `Button`, or a `Link` that teaches, such as 'See How It Works'. It is never a second primary. Write the label as the move, in Title Case, with short prepositions lowercase. Do not write 'Get Started Free' in one place and 'Try It' in another. The main action and the second action open in the same tab, unless one goes to a store or starts a download. A link to another site, in a list or a footer, uses `external`, as the case 'Site footer' says.
|
|
8
|
+
|
|
9
|
+
## Why
|
|
10
|
+
|
|
11
|
+
A visitor who sees three names for one move wonders if they are three moves. One label everywhere tells them where every button goes, and one primary Button tells them which one matters.
|
|
12
|
+
|
|
13
|
+
## Do
|
|
14
|
+
|
|
15
|
+
- Give the page one primary `Button`: 'Sign Up'. Use the same label in the header, the hero, the pricing section and the end of the page.
|
|
16
|
+
- Name the action for a plan with the plan: 'Sign Up for Pro'. Keep short prepositions lowercase.
|
|
17
|
+
- Make a second action a secondary `Button` or a `Link` that teaches: 'See How It Works'.
|
|
18
|
+
- Write each label as the move, in Title Case, and use the same words for the same move on every page.
|
|
19
|
+
- Name where an action goes when it leaves the site: 'Download the Desktop App'. Keep the main and second action in the same tab, unless one goes to a store or starts a download. Then use `openInNewTab`.
|
|
20
|
+
- Put the header's main action in `SiteHeader` as `phoneAction`, as the case 'Site header' says, so it stays in the bar on a phone.
|
|
21
|
+
- Use a `Button` with `href` for an action that goes to a page. Use `onClickButton` only for an action that stays on the page.
|
|
22
|
+
|
|
23
|
+
## Don't
|
|
24
|
+
|
|
25
|
+
- Do not call one move 'Get Started Free' in one place and 'Try It' in another.
|
|
26
|
+
- Do not give a second, different move a primary Button. The header and the hero may both show 'Sign Up'.
|
|
27
|
+
- Do not open the main action or the second action in a new tab, unless it goes to a store or starts a download.
|
|
28
|
+
- Do not build your own call-to-action button for one section. Use `Button`.
|
|
29
|
+
- Do not leave a Button with no action. If it has nowhere to go, it is not on the page yet.
|
|
30
|
+
|
|
31
|
+
## Native
|
|
32
|
+
|
|
33
|
+
On Apple an app has no marketing page. A product page in the App Store is the store. On Android the same holds for Google Play.
|
|
@@ -29,12 +29,15 @@ export default function OverflowMenuInAHeader() {
|
|
|
29
29
|
// The clipboard answers later; by then the example may be gone.
|
|
30
30
|
var mounted = useRef(true);
|
|
31
31
|
// On unmount it stops the request and closes every toast it opened.
|
|
32
|
-
useEffect(function () {
|
|
33
|
-
mounted.current =
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
32
|
+
useEffect(function () {
|
|
33
|
+
mounted.current = true;
|
|
34
|
+
return function () {
|
|
35
|
+
mounted.current = false;
|
|
36
|
+
clearTimeout(timer.current);
|
|
37
|
+
toastIds.current.forEach(function (id) { return dismissToast(id); });
|
|
38
|
+
toastIds.current = [];
|
|
39
|
+
};
|
|
40
|
+
}, []);
|
|
38
41
|
useEffect(function () {
|
|
39
42
|
var move = focusNext.current;
|
|
40
43
|
focusNext.current = undefined;
|
|
@@ -52,12 +52,15 @@ export default function OverflowMenuOnARow() {
|
|
|
52
52
|
// Gives each copy its own id, so no two rows share a key.
|
|
53
53
|
var copies = useRef(0);
|
|
54
54
|
// On unmount it stops the request and closes every toast it opened.
|
|
55
|
-
useEffect(function () {
|
|
56
|
-
mounted.current =
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
55
|
+
useEffect(function () {
|
|
56
|
+
mounted.current = true;
|
|
57
|
+
return function () {
|
|
58
|
+
mounted.current = false;
|
|
59
|
+
clearTimeout(timer.current);
|
|
60
|
+
toastIds.current.forEach(function (id) { return dismissToast(id); });
|
|
61
|
+
toastIds.current = [];
|
|
62
|
+
};
|
|
63
|
+
}, []);
|
|
61
64
|
useEffect(function () {
|
|
62
65
|
var move = focusNext.current;
|
|
63
66
|
focusNext.current = undefined;
|
|
@@ -84,11 +84,14 @@ export default function OverflowMenuOnARow() {
|
|
|
84
84
|
const copies = useRef(0);
|
|
85
85
|
|
|
86
86
|
// On unmount it stops the request and closes every toast it opened.
|
|
87
|
-
useEffect(() =>
|
|
88
|
-
mounted.current =
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
87
|
+
useEffect(() => {
|
|
88
|
+
mounted.current = true;
|
|
89
|
+
return () => {
|
|
90
|
+
mounted.current = false;
|
|
91
|
+
clearTimeout(timer.current);
|
|
92
|
+
toastIds.current.forEach((id) => dismissToast(id));
|
|
93
|
+
toastIds.current = [];
|
|
94
|
+
};
|
|
92
95
|
}, []);
|
|
93
96
|
|
|
94
97
|
useEffect(() => {
|
|
@@ -280,11 +283,14 @@ export default function OverflowMenuInAHeader() {
|
|
|
280
283
|
const mounted = useRef(true);
|
|
281
284
|
|
|
282
285
|
// On unmount it stops the request and closes every toast it opened.
|
|
283
|
-
useEffect(() =>
|
|
284
|
-
mounted.current =
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
286
|
+
useEffect(() => {
|
|
287
|
+
mounted.current = true;
|
|
288
|
+
return () => {
|
|
289
|
+
mounted.current = false;
|
|
290
|
+
clearTimeout(timer.current);
|
|
291
|
+
toastIds.current.forEach((id) => dismissToast(id));
|
|
292
|
+
toastIds.current = [];
|
|
293
|
+
};
|
|
288
294
|
}, []);
|
|
289
295
|
|
|
290
296
|
useEffect(() => {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function PageEndCtaBand(): import("react").JSX.Element;
|