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
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
# Billing page
|
|
2
|
+
|
|
3
|
+
A workspace pays for a plan. One page says what it pays for, what it has used, how it pays and what it has paid.
|
|
4
|
+
|
|
5
|
+
## Do
|
|
6
|
+
|
|
7
|
+
- Follow the rule 'A number shows its unit and never shows 0 for unknown'.
|
|
8
|
+
- Put these `SettingsSection`s in this order under a `TitleBar` named 'Billing': Plan, Usage, Payment method, Invoices. The danger section, if any, comes last.
|
|
9
|
+
- Show in Plan the plan's name, its price, 'Renews on Dec 1, 2026.' and one 'Change Plan' Button. The price names its unit: '$8.00 per member per month'.
|
|
10
|
+
- Show the usage as the case 'Usage against limits' says, and the payment method as the case 'Payment method' says.
|
|
11
|
+
- Show the last three invoices in a short table with a Download link on each row, and a 'See All Invoices' link to the case 'Invoices'.
|
|
12
|
+
- Show a plan that ends as a `warning` dot `Tag` 'Canceling'. Add the line 'Pro ends on Dec 1, 2026.' and a primary 'Resume Plan' Button in place of 'Change Plan'.
|
|
13
|
+
- Show a payment that failed as an `error` inline `Alert` at the top, with the date to fix it by: 'Your last payment did not go through. Update the payment method by Nov 30, 2026 to keep Pro.'
|
|
14
|
+
- Add an error dot `Tag` 'Past due' by the plan name.
|
|
15
|
+
- Put 'End plan' in a `SettingsSection tone="danger"` as the case 'Danger zone' says. Confirm 'End Plan' in a small `Modal` that says what stays on until when and what is kept. It is confirmed because paid features stop on a date the person must see.
|
|
16
|
+
- Show a person who cannot change billing every section as text, with no Buttons, and one line: 'Only admins can change billing.'
|
|
17
|
+
- Say who pays and where for a plan billed elsewhere: 'Ben Carter pays for this plan through an app store.' Say who can change it.
|
|
18
|
+
- Leave out every control, price, card and invoice on a plan billed elsewhere.
|
|
19
|
+
- Show a status as the case 'Status in a row' says: 'Past due' and 'Canceling' as dots, 'Paid' as text.
|
|
20
|
+
|
|
21
|
+
## Don't
|
|
22
|
+
|
|
23
|
+
- Do not collect or show a card number. A card is only 'Visa ending in 4821', and it changes on the payment provider's own page.
|
|
24
|
+
- Do not show Change Plan, Update or End Plan to someone who cannot use them. Show the text and the line that says who can.
|
|
25
|
+
- Do not leave a failed payment without the date it must be fixed by.
|
|
26
|
+
- Do not end the plan on the first click. Ask in a Modal first.
|
|
27
|
+
- Do not name the action 'Cancel Plan'. It would sit beside 'Cancel' in the confirm.
|
|
28
|
+
- Do not show a plan billed elsewhere with a 'Change Plan' Button that does nothing. Say where to change it.
|
|
29
|
+
- Do not write 'Canceled' for a plan that is still on. Say 'Canceling' and when it ends.
|
|
30
|
+
|
|
31
|
+
## Option: An admin pays here
|
|
32
|
+
|
|
33
|
+
Use when: The person who manages billing changes the plan, the card and the cancel on this page.
|
|
34
|
+
|
|
35
|
+
Uses: `Alert`, `Button`, `Center`, `Cluster`, `Heading`, `Link`, `Modal`, `Paragraph`, `Progress`, `SettingsSection`, `Stack`, `Surface`, `TableCell`, `TableContainer`, `TableHeader`, `TableHeaderCell`, `TableRow`, `Tag`, `TitleBar`, `formatMoney`
|
|
36
|
+
|
|
37
|
+
```tsx
|
|
38
|
+
'use client';
|
|
39
|
+
import { useEffect, useRef, useState } from 'react';
|
|
40
|
+
import Modal from 'oneslash-design-system/components/modal';
|
|
41
|
+
import Alert from 'oneslash-design-system/components/alert';
|
|
42
|
+
import Surface from 'oneslash-design-system/components/surface';
|
|
43
|
+
import Heading from 'oneslash-design-system/components/heading';
|
|
44
|
+
import Paragraph from 'oneslash-design-system/components/paragraph';
|
|
45
|
+
import Progress from 'oneslash-design-system/components/progress';
|
|
46
|
+
import Tag from 'oneslash-design-system/components/tag';
|
|
47
|
+
import Link from 'oneslash-design-system/components/link';
|
|
48
|
+
import Button from 'oneslash-design-system/components/button';
|
|
49
|
+
import SettingsSection from 'oneslash-design-system/components/settingsSection';
|
|
50
|
+
import TitleBar from 'oneslash-design-system/components/titleBar';
|
|
51
|
+
import TableContainer from 'oneslash-design-system/components/tableContainer';
|
|
52
|
+
import TableHeader from 'oneslash-design-system/components/tableHeader';
|
|
53
|
+
import TableHeaderCell from 'oneslash-design-system/components/tableHeaderCell';
|
|
54
|
+
import TableRow from 'oneslash-design-system/components/tableRow';
|
|
55
|
+
import TableCell from 'oneslash-design-system/components/tableCell';
|
|
56
|
+
import { formatMoney } from 'oneslash-design-system/components/formatNumber';
|
|
57
|
+
import { Center, Cluster, Stack } from 'oneslash-design-system/components/layout';
|
|
58
|
+
|
|
59
|
+
// A real app passes the router from its framework, such as Next's useRouter().
|
|
60
|
+
const router = { push: (url: string) => console.info(`Go to ${url}`) };
|
|
61
|
+
|
|
62
|
+
// A real app reads this from the person's role. Only an admin can change billing.
|
|
63
|
+
const isAdmin = true;
|
|
64
|
+
|
|
65
|
+
// A real app reads this from the server: set when the last payment failed.
|
|
66
|
+
const failedPayment: { fixBy: string } | null = { fixBy: 'Nov 30, 2026' };
|
|
67
|
+
|
|
68
|
+
const invoices = [
|
|
69
|
+
{ id: 'inv-0', date: 'Nov 1, 2026', amount: 24, status: 'Paid' },
|
|
70
|
+
{ id: 'inv-1', date: 'Oct 1, 2026', amount: 24, status: 'Paid' },
|
|
71
|
+
{ id: 'inv-2', date: 'Sep 1, 2026', amount: 24, status: 'Paid' },
|
|
72
|
+
];
|
|
73
|
+
|
|
74
|
+
export default function BillingPageSelfServe() {
|
|
75
|
+
const [canceling, setCanceling] = useState(false);
|
|
76
|
+
const [confirmOpen, setConfirmOpen] = useState(false);
|
|
77
|
+
const [busy, setBusy] = useState(false);
|
|
78
|
+
const timer = useRef<ReturnType<typeof setTimeout>>();
|
|
79
|
+
|
|
80
|
+
// Stops the request if the example goes away before it ends.
|
|
81
|
+
useEffect(() => () => clearTimeout(timer.current), []);
|
|
82
|
+
|
|
83
|
+
// Stands in for the request to the server.
|
|
84
|
+
function request(done: () => void) {
|
|
85
|
+
if (busy) return;
|
|
86
|
+
setBusy(true);
|
|
87
|
+
timer.current = setTimeout(() => {
|
|
88
|
+
setBusy(false);
|
|
89
|
+
done();
|
|
90
|
+
}, 1200);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// Escape, a click outside and Cancel all close it, except while the request runs.
|
|
94
|
+
function handleClose() {
|
|
95
|
+
if (busy) return;
|
|
96
|
+
setConfirmOpen(false);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return (
|
|
100
|
+
<Center width="page">
|
|
101
|
+
<Stack gap="xlarge">
|
|
102
|
+
<TitleBar title="Billing" />
|
|
103
|
+
{failedPayment && (
|
|
104
|
+
<Alert type="error" variant="inline" autoDismiss={false} message={`Your last payment did not go through. Update the payment method by ${failedPayment.fixBy} to keep Pro.`} />
|
|
105
|
+
)}
|
|
106
|
+
<SettingsSection id="billing-page-plan" title="Plan" description="What Acme pays for.">
|
|
107
|
+
<Stack gap="small">
|
|
108
|
+
<Cluster gap="small">
|
|
109
|
+
<Heading level={3} size="h6">Pro</Heading>
|
|
110
|
+
{failedPayment && <Tag variant="dot" size="small" color="error" label="Past due" />}
|
|
111
|
+
{canceling && <Tag variant="dot" size="small" color="warning" label="Canceling" />}
|
|
112
|
+
</Cluster>
|
|
113
|
+
<Paragraph size="body2" measure="none">{`${formatMoney(8)} per member per month`}</Paragraph>
|
|
114
|
+
<Paragraph tone="secondary" size="body2" measure="none">{canceling ? 'Pro ends on Dec 1, 2026.' : 'Renews on Dec 1, 2026.'}</Paragraph>
|
|
115
|
+
</Stack>
|
|
116
|
+
{isAdmin ? (
|
|
117
|
+
<Cluster gap="small">
|
|
118
|
+
{canceling ? (
|
|
119
|
+
<Button size="small" type="primary" state="enabled" label="Resume Plan" loading={busy} onClickButton={() => request(() => setCanceling(false))} />
|
|
120
|
+
) : (
|
|
121
|
+
<Button size="small" type="secondary" state="enabled" label="Change Plan" onClickButton={() => router.push('/settings/billing/plans')} />
|
|
122
|
+
)}
|
|
123
|
+
</Cluster>
|
|
124
|
+
) : (
|
|
125
|
+
<Paragraph tone="secondary" size="body2" measure="none">Only admins can change billing.</Paragraph>
|
|
126
|
+
)}
|
|
127
|
+
</SettingsSection>
|
|
128
|
+
<SettingsSection id="billing-page-usage" title="Usage" description="This month.">
|
|
129
|
+
<Stack gap="medium">
|
|
130
|
+
<Progress label="AI agent responses" value={312} max={1000} unit="responses" />
|
|
131
|
+
<Paragraph tone="secondary" size="body2" measure="none">Resets on Dec 1.</Paragraph>
|
|
132
|
+
<Progress label="Members" value={3} max={null} unit="members" />
|
|
133
|
+
</Stack>
|
|
134
|
+
</SettingsSection>
|
|
135
|
+
<SettingsSection id="billing-page-payment" title="Payment method" description="Pays for Acme's plan.">
|
|
136
|
+
<Surface padding="small">
|
|
137
|
+
<Cluster justify="between" gap="medium">
|
|
138
|
+
<Stack gap="small">
|
|
139
|
+
<Paragraph measure="none">Visa ending in 4821</Paragraph>
|
|
140
|
+
<Paragraph tone="secondary" size="body2" measure="none">Expires 08/28</Paragraph>
|
|
141
|
+
</Stack>
|
|
142
|
+
{isAdmin && (
|
|
143
|
+
// A real app hands off to its payment provider's own page here. The page never takes card details.
|
|
144
|
+
<Button size="small" type="tertiary" state="enabled" label="Update" aria-label="Update Visa ending in 4821, opens in a new tab" actionIcon="ExternalLink" href="https://acme.example/billing/payment-method" openInNewTab />
|
|
145
|
+
)}
|
|
146
|
+
</Cluster>
|
|
147
|
+
</Surface>
|
|
148
|
+
{/* Pro needs a card, so there is no Remove here. */}
|
|
149
|
+
<Paragraph tone="secondary" size="body2" measure="none">Pro needs a card on file. Downgrade to Free to remove it.</Paragraph>
|
|
150
|
+
</SettingsSection>
|
|
151
|
+
<SettingsSection id="billing-page-invoices" title="Invoices" description="The last three.">
|
|
152
|
+
<TableContainer aria-label="Recent invoices" minWidth="520px">
|
|
153
|
+
<TableHeader>
|
|
154
|
+
<TableRow>
|
|
155
|
+
<TableHeaderCell width="140px">Date</TableHeaderCell>
|
|
156
|
+
<TableHeaderCell width="110px" align="right">Amount</TableHeaderCell>
|
|
157
|
+
<TableHeaderCell>Status</TableHeaderCell>
|
|
158
|
+
<TableHeaderCell width="130px">Download</TableHeaderCell>
|
|
159
|
+
</TableRow>
|
|
160
|
+
</TableHeader>
|
|
161
|
+
{invoices.map((inv) => (
|
|
162
|
+
<TableRow key={inv.id}>
|
|
163
|
+
<TableCell width="140px">{inv.date}</TableCell>
|
|
164
|
+
<TableCell width="110px" align="right">{formatMoney(inv.amount)}</TableCell>
|
|
165
|
+
<TableCell><Tag variant="textOnly" size="small" label={inv.status} /></TableCell>
|
|
166
|
+
<TableCell width="130px">
|
|
167
|
+
{/* A real app links to the file on its own server. */}
|
|
168
|
+
<Button size="small" type="tertiary" state="enabled" label="Download" aria-label={`Download invoice for ${inv.date}, opens in a new tab`} actionIcon="ExternalLink" href={`https://acme.example/invoices/${inv.id}.pdf`} openInNewTab />
|
|
169
|
+
</TableCell>
|
|
170
|
+
</TableRow>
|
|
171
|
+
))}
|
|
172
|
+
</TableContainer>
|
|
173
|
+
<Link href="/settings/billing/invoices" size="body2">See All Invoices</Link>
|
|
174
|
+
</SettingsSection>
|
|
175
|
+
{isAdmin && !canceling && (
|
|
176
|
+
// The last section on the page, in the danger color, as the case 'Danger zone' says.
|
|
177
|
+
<SettingsSection id="billing-page-cancel" tone="danger" title="End plan" description="Pro stays on until Dec 1, 2026.">
|
|
178
|
+
<Paragraph size="body2" measure="none">Acme goes back to Free on Dec 1, 2026. Its members and messages stay.</Paragraph>
|
|
179
|
+
<Cluster>
|
|
180
|
+
<Button size="small" type="secondary" state="enabled" label="End Plan" onClickButton={() => setConfirmOpen(true)} />
|
|
181
|
+
</Cluster>
|
|
182
|
+
</SettingsSection>
|
|
183
|
+
)}
|
|
184
|
+
</Stack>
|
|
185
|
+
<Modal
|
|
186
|
+
isOpen={confirmOpen}
|
|
187
|
+
size="small"
|
|
188
|
+
title="End Plan"
|
|
189
|
+
onClose={handleClose}
|
|
190
|
+
actions={
|
|
191
|
+
<>
|
|
192
|
+
<Button size="small" type="tertiary" state={busy ? 'disabled' : 'enabled'} label="Cancel" onClickButton={handleClose} />
|
|
193
|
+
<Button size="small" type="primary" state="enabled" label="End Plan" loading={busy} onClickButton={() => request(() => { setConfirmOpen(false); setCanceling(true); })} />
|
|
194
|
+
</>
|
|
195
|
+
}
|
|
196
|
+
>
|
|
197
|
+
<Paragraph measure="none">Pro stays on until Dec 1, 2026. After that Acme is on Free, which allows 3 members and 50 AI agent responses a month.</Paragraph>
|
|
198
|
+
<Paragraph tone="secondary" size="body2" measure="none">Nothing is deleted. You can resume the plan until then.</Paragraph>
|
|
199
|
+
</Modal>
|
|
200
|
+
</Center>
|
|
201
|
+
);
|
|
202
|
+
}
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
## Option: Billed elsewhere
|
|
206
|
+
|
|
207
|
+
Use when: An app store bills the plan, or another person pays for it, so this page only says who pays and where to change it.
|
|
208
|
+
|
|
209
|
+
Uses: `Center`, `Heading`, `Paragraph`, `Progress`, `SettingsSection`, `Stack`, `TitleBar`
|
|
210
|
+
|
|
211
|
+
```tsx
|
|
212
|
+
'use client';
|
|
213
|
+
import Heading from 'oneslash-design-system/components/heading';
|
|
214
|
+
import Paragraph from 'oneslash-design-system/components/paragraph';
|
|
215
|
+
import Progress from 'oneslash-design-system/components/progress';
|
|
216
|
+
import SettingsSection from 'oneslash-design-system/components/settingsSection';
|
|
217
|
+
import TitleBar from 'oneslash-design-system/components/titleBar';
|
|
218
|
+
import { Center, Stack } from 'oneslash-design-system/components/layout';
|
|
219
|
+
|
|
220
|
+
export default function BillingPageBilledElsewhere() {
|
|
221
|
+
return (
|
|
222
|
+
<Center width="page">
|
|
223
|
+
<Stack gap="xlarge">
|
|
224
|
+
<TitleBar title="Billing" />
|
|
225
|
+
<SettingsSection id="billing-elsewhere-plan" title="Plan" description="What Acme pays for.">
|
|
226
|
+
<Stack gap="small">
|
|
227
|
+
<Heading level={3} size="h6">Pro</Heading>
|
|
228
|
+
<Paragraph tone="secondary" size="body2" measure="none">Renews on Dec 1, 2026.</Paragraph>
|
|
229
|
+
</Stack>
|
|
230
|
+
{/* No price, card or invoice: the app store that bills this plan keeps them. The page says who pays, where, and who can change it. */}
|
|
231
|
+
<Paragraph size="body2" measure="none">Ben Carter pays for this plan through an app store. Only Ben Carter can change or cancel it, in the app store settings on the device that bought it.</Paragraph>
|
|
232
|
+
</SettingsSection>
|
|
233
|
+
<SettingsSection id="billing-elsewhere-usage" title="Usage" description="This month.">
|
|
234
|
+
<Stack gap="medium">
|
|
235
|
+
<Progress label="AI agent responses" value={312} max={1000} unit="responses" />
|
|
236
|
+
<Paragraph tone="secondary" size="body2" measure="none">Resets on Dec 1.</Paragraph>
|
|
237
|
+
</Stack>
|
|
238
|
+
</SettingsSection>
|
|
239
|
+
</Stack>
|
|
240
|
+
</Center>
|
|
241
|
+
);
|
|
242
|
+
}
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
## Native
|
|
246
|
+
|
|
247
|
+
On Apple a plan bought in the app is managed in the system subscription sheet. Show who pays and open that sheet from one Button, never a card form.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function BlogIndexCards(): import("react").JSX.Element;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import PageShell from '../../components/pageShell';
|
|
4
|
+
import PageHeader from '../../components/pageHeader';
|
|
5
|
+
import LinkCard from '../../components/linkCard';
|
|
6
|
+
import Pagination from '../../components/pagination';
|
|
7
|
+
import { Grid, Stack } from '../../components/layout';
|
|
8
|
+
// Stand-ins for the covers. A real post has its own picture.
|
|
9
|
+
var cover = function (fill) {
|
|
10
|
+
return "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 640 360'%3E%3Crect width='640' height='360' fill='".concat(fill, "'/%3E%3Crect x='80' y='80' width='300' height='200' rx='20' fill='%23ffffff'/%3E%3Crect x='420' y='120' width='140' height='140' rx='70' fill='%232f6b4f'/%3E%3C/svg%3E");
|
|
11
|
+
};
|
|
12
|
+
var fills = ['%23eef2f6', '%23e6efe9', '%23f1ece4'];
|
|
13
|
+
// Made-up posts, newest first. A real site loads one page of them from its own data.
|
|
14
|
+
var posts = [
|
|
15
|
+
{ id: 'task-threads', date: 'Nov 12, 2026', title: 'How task threads work', line: 'One piece of work and all of its talk, in one thread.' },
|
|
16
|
+
{ id: 'pinning', date: 'Nov 5, 2026', title: 'Pin what people need to find again', line: 'Pins stay at the top of a channel until you remove them.' },
|
|
17
|
+
{ id: 'agent-sources', date: 'Oct 29, 2026', title: 'Why the agent names its sources', line: 'An answer you can check is an answer you can use.' },
|
|
18
|
+
{ id: 'notes-export', date: 'Oct 22, 2026', title: 'Take your notes with you', line: 'Export a note or a whole workspace as PDF.' },
|
|
19
|
+
{ id: 'members', date: 'Oct 15, 2026', title: 'Inviting people to a workspace', line: 'Invite by email and choose what each person can do.' },
|
|
20
|
+
{ id: 'plans', date: 'Oct 8, 2026', title: 'Choosing a plan', line: 'What each plan includes, and when to move up.' },
|
|
21
|
+
{ id: 'search', date: 'Oct 1, 2026', title: 'Finding an old message', line: 'Search reads messages, notes and files together.' },
|
|
22
|
+
{ id: 'channels', date: 'Sep 24, 2026', title: 'How channels work', line: 'Make a channel for each team or project.' },
|
|
23
|
+
{ id: 'billing', date: 'Sep 17, 2026', title: 'Where your invoices are', line: 'Download any invoice from the billing page.' },
|
|
24
|
+
{ id: 'dark-mode', date: 'Sep 10, 2026', title: 'Light, dark or follow the system', line: 'Pick a theme once and every page follows it.' },
|
|
25
|
+
{ id: 'shortcuts', date: 'Sep 3, 2026', title: 'Keyboard shortcuts worth learning', line: 'Five keys that save the most time.' },
|
|
26
|
+
{ id: 'welcome', date: 'Aug 27, 2026', title: 'Welcome to the Acme blog', line: 'What we will write about here.' },
|
|
27
|
+
{ id: 'roadmap', date: 'Aug 20, 2026', title: 'What we are building next', line: 'A short look at the next three months.' },
|
|
28
|
+
{ id: 'hello', date: 'Aug 13, 2026', title: 'Hello from the team', line: 'Who we are and why we started.' },
|
|
29
|
+
];
|
|
30
|
+
var PAGE_SIZE = 12;
|
|
31
|
+
export default function BlogIndexCards() {
|
|
32
|
+
var _a = useState(1), page = _a[0], setPage = _a[1];
|
|
33
|
+
var pageCount = Math.ceil(posts.length / PAGE_SIZE);
|
|
34
|
+
var shown = posts.slice((page - 1) * PAGE_SIZE, page * PAGE_SIZE);
|
|
35
|
+
return (<PageShell>
|
|
36
|
+
<Stack gap="giant">
|
|
37
|
+
<PageHeader level={1} title="Blog" lede="Notes from the team on how Acme works and why."/>
|
|
38
|
+
<Grid columns={2}>
|
|
39
|
+
{shown.map(function (post, i) { return (<LinkCard key={post.id} href={"#".concat(post.id)} title={post.title} description={post.line} caption={post.date} image={{ src: cover(fills[((page - 1) * PAGE_SIZE + i) % fills.length]), alt: '' }}/>); })}
|
|
40
|
+
</Grid>
|
|
41
|
+
{/* A real blog passes an address that works without script, such as '/blog?page=2'. The example keeps the page in its hash. */}
|
|
42
|
+
<Pagination page={page} pageCount={pageCount} onPageChange={setPage} getHref={function (p) { return "#page-".concat(p); }} aria-label="Blog pages"/>
|
|
43
|
+
</Stack>
|
|
44
|
+
</PageShell>);
|
|
45
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function BlogIndexList(): import("react").JSX.Element;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import PageShell from '../../components/pageShell';
|
|
4
|
+
import PageHeader from '../../components/pageHeader';
|
|
5
|
+
import Link from '../../components/link';
|
|
6
|
+
import Paragraph from '../../components/paragraph';
|
|
7
|
+
import Pagination from '../../components/pagination';
|
|
8
|
+
import EmptyBox from '../../components/emptyBox';
|
|
9
|
+
import { Stack } from '../../components/layout';
|
|
10
|
+
// Made-up posts, newest first. A real site loads one page of them from its own data.
|
|
11
|
+
var posts = [
|
|
12
|
+
{ id: 'task-threads', date: 'Nov 12, 2026', title: 'How task threads work', line: 'One piece of work and all of its talk, in one thread.' },
|
|
13
|
+
{ id: 'pinning', date: 'Nov 5, 2026', title: 'Pin what people need to find again', line: 'Pins stay at the top of a channel until you remove them.' },
|
|
14
|
+
{ id: 'agent-sources', date: 'Oct 29, 2026', title: 'Why the agent names its sources', line: 'An answer you can check is an answer you can use.' },
|
|
15
|
+
{ id: 'notes-export', date: 'Oct 22, 2026', title: 'Take your notes with you', line: 'Export a note or a whole workspace as PDF.' },
|
|
16
|
+
{ id: 'members', date: 'Oct 15, 2026', title: 'Inviting people to a workspace', line: 'Invite by email and choose what each person can do.' },
|
|
17
|
+
{ id: 'plans', date: 'Oct 8, 2026', title: 'Choosing a plan', line: 'What each plan includes, and when to move up.' },
|
|
18
|
+
{ id: 'search', date: 'Oct 1, 2026', title: 'Finding an old message', line: 'Search reads messages, notes and files together.' },
|
|
19
|
+
{ id: 'channels', date: 'Sep 24, 2026', title: 'How channels work', line: 'Make a channel for each team or project.' },
|
|
20
|
+
{ id: 'billing', date: 'Sep 17, 2026', title: 'Where your invoices are', line: 'Download any invoice from the billing page.' },
|
|
21
|
+
{ id: 'dark-mode', date: 'Sep 10, 2026', title: 'Light, dark or follow the system', line: 'Pick a theme once and every page follows it.' },
|
|
22
|
+
{ id: 'shortcuts', date: 'Sep 3, 2026', title: 'Keyboard shortcuts worth learning', line: 'Five keys that save the most time.' },
|
|
23
|
+
{ id: 'welcome', date: 'Aug 27, 2026', title: 'Welcome to the Acme blog', line: 'What we will write about here.' },
|
|
24
|
+
{ id: 'roadmap', date: 'Aug 20, 2026', title: 'What we are building next', line: 'A short look at the next three months.' },
|
|
25
|
+
{ id: 'hello', date: 'Aug 13, 2026', title: 'Hello from the team', line: 'Who we are and why we started.' },
|
|
26
|
+
];
|
|
27
|
+
var PAGE_SIZE = 12;
|
|
28
|
+
export default function BlogIndexList() {
|
|
29
|
+
var _a = useState(1), page = _a[0], setPage = _a[1];
|
|
30
|
+
var pageCount = Math.ceil(posts.length / PAGE_SIZE);
|
|
31
|
+
var shown = posts.slice((page - 1) * PAGE_SIZE, page * PAGE_SIZE);
|
|
32
|
+
return (<PageShell>
|
|
33
|
+
<Stack gap="giant">
|
|
34
|
+
<PageHeader level={1} title="Blog" lede="Notes from the team on how Acme works and why."/>
|
|
35
|
+
{shown.length === 0 ? (<EmptyBox size="large" text="No posts yet" secondText="New posts appear here."/>) : (<Stack gap="xlarge">
|
|
36
|
+
{shown.map(function (post) { return (<Stack key={post.id} gap="small">
|
|
37
|
+
<Paragraph tone="secondary" size="caption" measure="none">{post.date}</Paragraph>
|
|
38
|
+
<Link href={"#".concat(post.id)} size="subtitle1">{post.title}</Link>
|
|
39
|
+
<Paragraph tone="secondary" size="body2">{post.line}</Paragraph>
|
|
40
|
+
</Stack>); })}
|
|
41
|
+
</Stack>)}
|
|
42
|
+
{/* A real blog passes an address that works without script, such as '/blog?page=2'. The example keeps the page in its hash. */}
|
|
43
|
+
<Pagination page={page} pageCount={pageCount} onPageChange={setPage} getHref={function (p) { return "#page-".concat(p); }} aria-label="Blog pages"/>
|
|
44
|
+
</Stack>
|
|
45
|
+
</PageShell>);
|
|
46
|
+
}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
# Blog index
|
|
2
|
+
|
|
3
|
+
A visitor opens the blog to see what was written lately and to pick a post to read.
|
|
4
|
+
|
|
5
|
+
## Do
|
|
6
|
+
|
|
7
|
+
- Use `PageHeader` with `level={1}`: the title 'Blog' is the one level 1 heading, with a `lede` of one sentence about what the blog is for.
|
|
8
|
+
- Put the newest post first and say so nowhere. The order is the date.
|
|
9
|
+
- Make each row of `list` the date as 'Nov 12, 2026' in a secondary caption `Paragraph`, the title as a `Link` and one line of `Paragraph` under it. A row is one link, so the title is the link and the line is not.
|
|
10
|
+
- Use `LinkCard` for `cards`, with `image`, `title`, `description` and the date as `caption`, in `Grid columns={2}`. Give the cover `alt=""` when the title says what the post is about, because a cover's alt text joins the link's name.
|
|
11
|
+
- Show 12 posts to a page. Past 12, add `Pagination` with `getHref`, such as `(p) => '/blog?page=' + p`, so each page has an address that works without script. Name it 'Blog pages'.
|
|
12
|
+
- Show `EmptyBox` with `size="large"` when there are no posts yet: 'No posts yet', with `secondText` 'New posts appear here.' and no action.
|
|
13
|
+
- Follow the cases 'Empty search' and 'Load failure' for a search or a filter on the blog.
|
|
14
|
+
|
|
15
|
+
## Don't
|
|
16
|
+
|
|
17
|
+
- Do not use `TimeStamp` for a post date. It writes '11/12/2026 Thu', and the site writes dates as 'Nov 12, 2026'.
|
|
18
|
+
- Do not show a post count or a count of readers.
|
|
19
|
+
- Do not mix a list and cards on one page. Pick the one that fits the posts.
|
|
20
|
+
- Do not put the whole text of a post in the index. One line is enough to choose.
|
|
21
|
+
- Do not use a picture of a person as a cover. A cover is a picture of the subject.
|
|
22
|
+
- Do not page by infinite scroll. A person cannot reach the footer, or come back to the same place.
|
|
23
|
+
|
|
24
|
+
## Option: A list of posts, newest first
|
|
25
|
+
|
|
26
|
+
Use when: The posts have no pictures, and a person scans the titles and the dates.
|
|
27
|
+
|
|
28
|
+
Uses: `EmptyBox`, `Link`, `PageHeader`, `PageShell`, `Pagination`, `Paragraph`, `Stack`
|
|
29
|
+
|
|
30
|
+
```tsx
|
|
31
|
+
'use client';
|
|
32
|
+
import { useState } from 'react';
|
|
33
|
+
import PageShell from 'oneslash-design-system/components/pageShell';
|
|
34
|
+
import PageHeader from 'oneslash-design-system/components/pageHeader';
|
|
35
|
+
import Link from 'oneslash-design-system/components/link';
|
|
36
|
+
import Paragraph from 'oneslash-design-system/components/paragraph';
|
|
37
|
+
import Pagination from 'oneslash-design-system/components/pagination';
|
|
38
|
+
import EmptyBox from 'oneslash-design-system/components/emptyBox';
|
|
39
|
+
import { Stack } from 'oneslash-design-system/components/layout';
|
|
40
|
+
|
|
41
|
+
// Made-up posts, newest first. A real site loads one page of them from its own data.
|
|
42
|
+
const posts = [
|
|
43
|
+
{ id: 'task-threads', date: 'Nov 12, 2026', title: 'How task threads work', line: 'One piece of work and all of its talk, in one thread.' },
|
|
44
|
+
{ id: 'pinning', date: 'Nov 5, 2026', title: 'Pin what people need to find again', line: 'Pins stay at the top of a channel until you remove them.' },
|
|
45
|
+
{ id: 'agent-sources', date: 'Oct 29, 2026', title: 'Why the agent names its sources', line: 'An answer you can check is an answer you can use.' },
|
|
46
|
+
{ id: 'notes-export', date: 'Oct 22, 2026', title: 'Take your notes with you', line: 'Export a note or a whole workspace as PDF.' },
|
|
47
|
+
{ id: 'members', date: 'Oct 15, 2026', title: 'Inviting people to a workspace', line: 'Invite by email and choose what each person can do.' },
|
|
48
|
+
{ id: 'plans', date: 'Oct 8, 2026', title: 'Choosing a plan', line: 'What each plan includes, and when to move up.' },
|
|
49
|
+
{ id: 'search', date: 'Oct 1, 2026', title: 'Finding an old message', line: 'Search reads messages, notes and files together.' },
|
|
50
|
+
{ id: 'channels', date: 'Sep 24, 2026', title: 'How channels work', line: 'Make a channel for each team or project.' },
|
|
51
|
+
{ id: 'billing', date: 'Sep 17, 2026', title: 'Where your invoices are', line: 'Download any invoice from the billing page.' },
|
|
52
|
+
{ id: 'dark-mode', date: 'Sep 10, 2026', title: 'Light, dark or follow the system', line: 'Pick a theme once and every page follows it.' },
|
|
53
|
+
{ id: 'shortcuts', date: 'Sep 3, 2026', title: 'Keyboard shortcuts worth learning', line: 'Five keys that save the most time.' },
|
|
54
|
+
{ id: 'welcome', date: 'Aug 27, 2026', title: 'Welcome to the Acme blog', line: 'What we will write about here.' },
|
|
55
|
+
{ id: 'roadmap', date: 'Aug 20, 2026', title: 'What we are building next', line: 'A short look at the next three months.' },
|
|
56
|
+
{ id: 'hello', date: 'Aug 13, 2026', title: 'Hello from the team', line: 'Who we are and why we started.' },
|
|
57
|
+
];
|
|
58
|
+
|
|
59
|
+
const PAGE_SIZE = 12;
|
|
60
|
+
|
|
61
|
+
export default function BlogIndexList() {
|
|
62
|
+
const [page, setPage] = useState(1);
|
|
63
|
+
const pageCount = Math.ceil(posts.length / PAGE_SIZE);
|
|
64
|
+
const shown = posts.slice((page - 1) * PAGE_SIZE, page * PAGE_SIZE);
|
|
65
|
+
return (
|
|
66
|
+
<PageShell>
|
|
67
|
+
<Stack gap="giant">
|
|
68
|
+
<PageHeader level={1} title="Blog" lede="Notes from the team on how Acme works and why." />
|
|
69
|
+
{shown.length === 0 ? (
|
|
70
|
+
<EmptyBox size="large" text="No posts yet" secondText="New posts appear here." />
|
|
71
|
+
) : (
|
|
72
|
+
<Stack gap="xlarge">
|
|
73
|
+
{shown.map((post) => (
|
|
74
|
+
<Stack key={post.id} gap="small">
|
|
75
|
+
<Paragraph tone="secondary" size="caption" measure="none">{post.date}</Paragraph>
|
|
76
|
+
<Link href={`#${post.id}`} size="subtitle1">{post.title}</Link>
|
|
77
|
+
<Paragraph tone="secondary" size="body2">{post.line}</Paragraph>
|
|
78
|
+
</Stack>
|
|
79
|
+
))}
|
|
80
|
+
</Stack>
|
|
81
|
+
)}
|
|
82
|
+
{/* A real blog passes an address that works without script, such as '/blog?page=2'. The example keeps the page in its hash. */}
|
|
83
|
+
<Pagination page={page} pageCount={pageCount} onPageChange={setPage} getHref={(p) => `#page-${p}`} aria-label="Blog pages" />
|
|
84
|
+
</Stack>
|
|
85
|
+
</PageShell>
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Option: Cards with a cover
|
|
91
|
+
|
|
92
|
+
Use when: Every post has a cover picture, and the picture helps a person choose.
|
|
93
|
+
|
|
94
|
+
Uses: `Grid`, `LinkCard`, `PageHeader`, `PageShell`, `Pagination`, `Stack`
|
|
95
|
+
|
|
96
|
+
```tsx
|
|
97
|
+
'use client';
|
|
98
|
+
import { useState } from 'react';
|
|
99
|
+
import PageShell from 'oneslash-design-system/components/pageShell';
|
|
100
|
+
import PageHeader from 'oneslash-design-system/components/pageHeader';
|
|
101
|
+
import LinkCard from 'oneslash-design-system/components/linkCard';
|
|
102
|
+
import Pagination from 'oneslash-design-system/components/pagination';
|
|
103
|
+
import { Grid, Stack } from 'oneslash-design-system/components/layout';
|
|
104
|
+
|
|
105
|
+
// Stand-ins for the covers. A real post has its own picture.
|
|
106
|
+
const cover = (fill: string) =>
|
|
107
|
+
`data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 640 360'%3E%3Crect width='640' height='360' fill='${fill}'/%3E%3Crect x='80' y='80' width='300' height='200' rx='20' fill='%23ffffff'/%3E%3Crect x='420' y='120' width='140' height='140' rx='70' fill='%232f6b4f'/%3E%3C/svg%3E`;
|
|
108
|
+
const fills = ['%23eef2f6', '%23e6efe9', '%23f1ece4'];
|
|
109
|
+
|
|
110
|
+
// Made-up posts, newest first. A real site loads one page of them from its own data.
|
|
111
|
+
const posts = [
|
|
112
|
+
{ id: 'task-threads', date: 'Nov 12, 2026', title: 'How task threads work', line: 'One piece of work and all of its talk, in one thread.' },
|
|
113
|
+
{ id: 'pinning', date: 'Nov 5, 2026', title: 'Pin what people need to find again', line: 'Pins stay at the top of a channel until you remove them.' },
|
|
114
|
+
{ id: 'agent-sources', date: 'Oct 29, 2026', title: 'Why the agent names its sources', line: 'An answer you can check is an answer you can use.' },
|
|
115
|
+
{ id: 'notes-export', date: 'Oct 22, 2026', title: 'Take your notes with you', line: 'Export a note or a whole workspace as PDF.' },
|
|
116
|
+
{ id: 'members', date: 'Oct 15, 2026', title: 'Inviting people to a workspace', line: 'Invite by email and choose what each person can do.' },
|
|
117
|
+
{ id: 'plans', date: 'Oct 8, 2026', title: 'Choosing a plan', line: 'What each plan includes, and when to move up.' },
|
|
118
|
+
{ id: 'search', date: 'Oct 1, 2026', title: 'Finding an old message', line: 'Search reads messages, notes and files together.' },
|
|
119
|
+
{ id: 'channels', date: 'Sep 24, 2026', title: 'How channels work', line: 'Make a channel for each team or project.' },
|
|
120
|
+
{ id: 'billing', date: 'Sep 17, 2026', title: 'Where your invoices are', line: 'Download any invoice from the billing page.' },
|
|
121
|
+
{ id: 'dark-mode', date: 'Sep 10, 2026', title: 'Light, dark or follow the system', line: 'Pick a theme once and every page follows it.' },
|
|
122
|
+
{ id: 'shortcuts', date: 'Sep 3, 2026', title: 'Keyboard shortcuts worth learning', line: 'Five keys that save the most time.' },
|
|
123
|
+
{ id: 'welcome', date: 'Aug 27, 2026', title: 'Welcome to the Acme blog', line: 'What we will write about here.' },
|
|
124
|
+
{ id: 'roadmap', date: 'Aug 20, 2026', title: 'What we are building next', line: 'A short look at the next three months.' },
|
|
125
|
+
{ id: 'hello', date: 'Aug 13, 2026', title: 'Hello from the team', line: 'Who we are and why we started.' },
|
|
126
|
+
];
|
|
127
|
+
|
|
128
|
+
const PAGE_SIZE = 12;
|
|
129
|
+
|
|
130
|
+
export default function BlogIndexCards() {
|
|
131
|
+
const [page, setPage] = useState(1);
|
|
132
|
+
const pageCount = Math.ceil(posts.length / PAGE_SIZE);
|
|
133
|
+
const shown = posts.slice((page - 1) * PAGE_SIZE, page * PAGE_SIZE);
|
|
134
|
+
return (
|
|
135
|
+
<PageShell>
|
|
136
|
+
<Stack gap="giant">
|
|
137
|
+
<PageHeader level={1} title="Blog" lede="Notes from the team on how Acme works and why." />
|
|
138
|
+
<Grid columns={2}>
|
|
139
|
+
{shown.map((post, i) => (
|
|
140
|
+
<LinkCard
|
|
141
|
+
key={post.id}
|
|
142
|
+
href={`#${post.id}`}
|
|
143
|
+
title={post.title}
|
|
144
|
+
description={post.line}
|
|
145
|
+
caption={post.date}
|
|
146
|
+
image={{ src: cover(fills[((page - 1) * PAGE_SIZE + i) % fills.length]), alt: '' }}
|
|
147
|
+
/>
|
|
148
|
+
))}
|
|
149
|
+
</Grid>
|
|
150
|
+
{/* A real blog passes an address that works without script, such as '/blog?page=2'. The example keeps the page in its hash. */}
|
|
151
|
+
<Pagination page={page} pageCount={pageCount} onPageChange={setPage} getHref={(p) => `#page-${p}`} aria-label="Blog pages" />
|
|
152
|
+
</Stack>
|
|
153
|
+
</PageShell>
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
## Native
|
|
159
|
+
|
|
160
|
+
On Apple use a `List` of `NavigationLink`s for posts, or a `LazyVGrid` of cards for covers. On Android use a `LazyColumn` or `LazyVerticalGrid`.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function BreakdownListBars(): import("react").JSX.Element;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
3
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
4
|
+
if (ar || !(i in from)) {
|
|
5
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
6
|
+
ar[i] = from[i];
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
10
|
+
};
|
|
11
|
+
import Heading from '../../components/heading';
|
|
12
|
+
import Paragraph from '../../components/paragraph';
|
|
13
|
+
import Progress from '../../components/progress';
|
|
14
|
+
import List from '../../components/list';
|
|
15
|
+
import { formatCount } from '../../components/formatNumber';
|
|
16
|
+
import { Center, Stack } from '../../components/layout';
|
|
17
|
+
// A real app counts these on the server.
|
|
18
|
+
var models = [
|
|
19
|
+
{ name: 'Atlas Large', count: 512 },
|
|
20
|
+
{ name: 'Atlas Medium', count: 301 },
|
|
21
|
+
{ name: 'Birch 4', count: 168 },
|
|
22
|
+
{ name: 'Birch 4 Mini', count: 96 },
|
|
23
|
+
{ name: 'Cedar Pro', count: 62 },
|
|
24
|
+
{ name: 'Cedar Lite', count: 41 },
|
|
25
|
+
{ name: 'Delta 2', count: 28 },
|
|
26
|
+
{ name: 'Delta 1', count: 17 },
|
|
27
|
+
{ name: 'Elm', count: 9 },
|
|
28
|
+
{ name: 'Fern', count: 6 },
|
|
29
|
+
];
|
|
30
|
+
// The largest seven are listed and the rest fold into 'Other', so the list is never longer than eight rows.
|
|
31
|
+
var sorted = __spreadArray([], models, true).sort(function (a, b) { return b.count - a.count; });
|
|
32
|
+
var total = sorted.reduce(function (sum, m) { return sum + m.count; }, 0);
|
|
33
|
+
var rest = sorted.slice(7).reduce(function (sum, m) { return sum + m.count; }, 0);
|
|
34
|
+
var parts = __spreadArray(__spreadArray([], sorted.slice(0, 7), true), (rest > 0 ? [{ name: 'Other', count: rest }] : []), true);
|
|
35
|
+
export default function BreakdownListBars() {
|
|
36
|
+
return (<Center width="page">
|
|
37
|
+
<Stack gap="large">
|
|
38
|
+
<Stack gap="small">
|
|
39
|
+
<Heading level={2} size="h6">Responses by model</Heading>
|
|
40
|
+
<Paragraph tone="secondary" size="body2" measure="none">{formatCount(total)} responses this week.</Paragraph>
|
|
41
|
+
</Stack>
|
|
42
|
+
<List size="body2" items={parts.map(function (p) { return (
|
|
43
|
+
// `max` is the total, so each bar is the part's share. A share is not a limit, so it never turns to a warning.
|
|
44
|
+
<Progress key={p.name} kind="share" label={p.name} value={p.count} max={total} unit="responses"/>); })}/>
|
|
45
|
+
</Stack>
|
|
46
|
+
</Center>);
|
|
47
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function BreakdownListTable(): import("react").JSX.Element;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
3
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
4
|
+
if (ar || !(i in from)) {
|
|
5
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
6
|
+
ar[i] = from[i];
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
10
|
+
};
|
|
11
|
+
import Heading from '../../components/heading';
|
|
12
|
+
import Paragraph from '../../components/paragraph';
|
|
13
|
+
import TableContainer from '../../components/tableContainer';
|
|
14
|
+
import TableHeader from '../../components/tableHeader';
|
|
15
|
+
import TableHeaderCell from '../../components/tableHeaderCell';
|
|
16
|
+
import TableRow from '../../components/tableRow';
|
|
17
|
+
import TableCell from '../../components/tableCell';
|
|
18
|
+
import { formatCount, formatMoney, formatPercent } from '../../components/formatNumber';
|
|
19
|
+
import { Center, Stack } from '../../components/layout';
|
|
20
|
+
// A real app counts these on the server.
|
|
21
|
+
var models = [
|
|
22
|
+
{ name: 'Atlas Large', responses: 5120, cost: 61.4 },
|
|
23
|
+
{ name: 'Atlas Medium', responses: 3010, cost: 18.06 },
|
|
24
|
+
{ name: 'Birch 4', responses: 1680, cost: 12.3 },
|
|
25
|
+
{ name: 'Birch 4 Mini', responses: 960, cost: 1.92 },
|
|
26
|
+
{ name: 'Cedar Pro', responses: 620, cost: 4.65 },
|
|
27
|
+
{ name: 'Cedar Lite', responses: 410, cost: 0.41 },
|
|
28
|
+
{ name: 'Delta 2', responses: 280, cost: 0.84 },
|
|
29
|
+
{ name: 'Delta 1', responses: 170, cost: 0.17 },
|
|
30
|
+
{ name: 'Elm', responses: 90, cost: 0.004 },
|
|
31
|
+
{ name: 'Fern', responses: 60, cost: 0 },
|
|
32
|
+
];
|
|
33
|
+
// Largest first: the table is sorted by its main number.
|
|
34
|
+
var rows = __spreadArray([], models, true).sort(function (a, b) { return b.responses - a.responses; });
|
|
35
|
+
var total = rows.reduce(function (sum, m) { return sum + m.responses; }, 0);
|
|
36
|
+
var totalCost = rows.reduce(function (sum, m) { return sum + m.cost; }, 0);
|
|
37
|
+
export default function BreakdownListTable() {
|
|
38
|
+
return (<Center width="page">
|
|
39
|
+
<Stack gap="large">
|
|
40
|
+
<Stack gap="small">
|
|
41
|
+
<Heading level={2} size="h6">Responses and cost by model</Heading>
|
|
42
|
+
<Paragraph tone="secondary" size="body2" measure="none">{formatCount(total)} responses this month, largest first.</Paragraph>
|
|
43
|
+
</Stack>
|
|
44
|
+
{/* A named table sits in a region that scrolls sideways by itself, so the page never does. */}
|
|
45
|
+
<TableContainer aria-label="Responses and cost by model" minWidth="520px">
|
|
46
|
+
<TableHeader>
|
|
47
|
+
<TableRow>
|
|
48
|
+
<TableHeaderCell>Model</TableHeaderCell>
|
|
49
|
+
<TableHeaderCell align="right" width="120px" sort="descending">Responses</TableHeaderCell>
|
|
50
|
+
<TableHeaderCell align="right" width="90px">Share</TableHeaderCell>
|
|
51
|
+
<TableHeaderCell align="right" width="110px">Cost</TableHeaderCell>
|
|
52
|
+
</TableRow>
|
|
53
|
+
</TableHeader>
|
|
54
|
+
{rows.map(function (m) { return (<TableRow key={m.name}>
|
|
55
|
+
<TableCell>{m.name}</TableCell>
|
|
56
|
+
<TableCell align="right" width="120px">{formatCount(m.responses)}</TableCell>
|
|
57
|
+
<TableCell align="right" width="90px">{formatPercent(m.responses / total)}</TableCell>
|
|
58
|
+
<TableCell align="right" width="110px">{formatMoney(m.cost)}</TableCell>
|
|
59
|
+
</TableRow>); })}
|
|
60
|
+
<TableRow>
|
|
61
|
+
<TableCell>Total</TableCell>
|
|
62
|
+
<TableCell align="right" width="120px">{formatCount(total)}</TableCell>
|
|
63
|
+
<TableCell align="right" width="90px">{formatPercent(1)}</TableCell>
|
|
64
|
+
<TableCell align="right" width="110px">{formatMoney(totalCost)}</TableCell>
|
|
65
|
+
</TableRow>
|
|
66
|
+
</TableContainer>
|
|
67
|
+
</Stack>
|
|
68
|
+
</Center>);
|
|
69
|
+
}
|