oneslash-design-system 2.20.0 → 2.22.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 +34 -1
- 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/app-shell/top-tabs.jsx +10 -4
- package/dist/cases/app-shell.md +13 -5
- 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/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/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/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/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/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/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/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/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/pricing-section/cards.d.ts +1 -0
- package/dist/cases/pricing-section/cards.jsx +41 -0
- package/dist/cases/pricing-section.md +87 -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/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 +9 -6
- package/dist/cases/settings-page.md +13 -7
- 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/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.json +1177 -31
- package/dist/components/accordion.d.ts +31 -0
- package/dist/components/accordion.jsx +103 -0
- package/dist/components/button.d.ts +2 -0
- package/dist/components/button.jsx +2 -2
- package/dist/components/codeBlock.d.ts +26 -0
- package/dist/components/codeBlock.jsx +101 -0
- package/dist/components/lightbox.d.ts +34 -0
- package/dist/components/lightbox.jsx +206 -0
- package/dist/components/linkCard.d.ts +10 -1
- package/dist/components/linkCard.jsx +32 -6
- package/dist/components/menuItem.jsx +1 -1
- 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/searchDialog.d.ts +44 -0
- package/dist/components/searchDialog.jsx +152 -0
- package/dist/components/siteHeader.d.ts +13 -2
- package/dist/components/siteHeader.jsx +21 -12
- 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/tabsContainer.d.ts +5 -1
- package/dist/components/tabsContainer.jsx +2 -2
- package/dist/components/tag.d.ts +6 -1
- package/dist/components/tag.jsx +10 -5
- package/dist/index.d.ts +5 -0
- package/dist/index.js +5 -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 +31 -1
- package/dist/stories/Accordion.stories.d.ts +11 -0
- package/dist/stories/Accordion.stories.jsx +93 -0
- package/dist/stories/Button.stories.jsx +12 -8
- package/dist/stories/Cases.generated.stories.d.ts +34 -0
- package/dist/stories/Cases.generated.stories.jsx +68 -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 +11 -0
- package/dist/stories/Lightbox.stories.jsx +83 -0
- package/dist/stories/LinkCard.stories.d.ts +6 -0
- package/dist/stories/LinkCard.stories.jsx +17 -0
- package/dist/stories/MenuItem.stories.d.ts +1 -0
- package/dist/stories/MenuItem.stories.jsx +8 -0
- package/dist/stories/PageHeader.stories.d.ts +2 -0
- package/dist/stories/PageHeader.stories.jsx +13 -0
- package/dist/stories/SearchDialog.stories.d.ts +17 -0
- package/dist/stories/SearchDialog.stories.jsx +111 -0
- package/dist/stories/SiteHeader.stories.d.ts +4 -0
- package/dist/stories/SiteHeader.stories.jsx +89 -0
- package/dist/stories/TabPanel.stories.d.ts +7 -0
- package/dist/stories/TabPanel.stories.jsx +31 -0
- package/package.json +1 -1
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
# Admin inbox
|
|
2
|
+
|
|
3
|
+
The owner of a site reads the messages that visitors sent through its contact form.
|
|
4
|
+
|
|
5
|
+
## Do
|
|
6
|
+
|
|
7
|
+
- Open with a `PageHeader` titled 'Messages' and a lede that counts what is unread: '3 of 12 unread'.
|
|
8
|
+
- Show the sender, the date and the first lines of each message. Write the date as plain text, such as Nov 12, 2026.
|
|
9
|
+
- Mark an unread message with a `Tag` that says 'Unread', so it does not rely on color.
|
|
10
|
+
- Give each row an `IconButton` that toggles read and unread, in a `Tooltip` with its name. Name it for the row's message: 'Mark message from Ben Carter as read'.
|
|
11
|
+
- Follow the case 'List and detail' for `split`. Name its Button 'Mark as Read' or 'Mark as Unread'.
|
|
12
|
+
- Keep the header while the list loads, and show `Skeleton` rows with one label: 'Loading messages'.
|
|
13
|
+
- Follow the case 'Load failure' when the list fails to load: `EmptyBox` 'Could not load messages' with a 'Try Again' Button that is `loading` while it retries.
|
|
14
|
+
- Show `EmptyBox` as the case 'Empty list' says when there are no messages: `size="large"` in `list`, `size="small"` in the list column of `split`. Text 'No messages yet', `secondText` 'Messages from the contact form appear here.'
|
|
15
|
+
|
|
16
|
+
## Don't
|
|
17
|
+
|
|
18
|
+
- Do not replace the whole page with a loading screen while the list loads.
|
|
19
|
+
- Do not show 'No messages yet' when the list failed to load.
|
|
20
|
+
- Do not name every IconButton 'Mark as read'. Name the message it acts on.
|
|
21
|
+
- Do not mark a message read only by opening it, with no way to undo.
|
|
22
|
+
- Do not leave a failed read or unread change with no message.
|
|
23
|
+
|
|
24
|
+
## Option: One column of messages
|
|
25
|
+
|
|
26
|
+
Use when: A few messages arrive each week, and each one is read in full in the list.
|
|
27
|
+
|
|
28
|
+
Uses: `Button`, `Cluster`, `EmptyBox`, `Heading`, `IconButton`, `PageHeader`, `PageShell`, `Paragraph`, `Skeleton`, `Stack`, `Surface`, `Tag`, `Tooltip`
|
|
29
|
+
|
|
30
|
+
```tsx
|
|
31
|
+
'use client';
|
|
32
|
+
import { useEffect, useRef, useState } from 'react';
|
|
33
|
+
import PageShell from 'oneslash-design-system/components/pageShell';
|
|
34
|
+
import PageHeader from 'oneslash-design-system/components/pageHeader';
|
|
35
|
+
import Surface from 'oneslash-design-system/components/surface';
|
|
36
|
+
import Heading from 'oneslash-design-system/components/heading';
|
|
37
|
+
import Paragraph from 'oneslash-design-system/components/paragraph';
|
|
38
|
+
import Tag from 'oneslash-design-system/components/tag';
|
|
39
|
+
import IconButton from 'oneslash-design-system/components/iconButton';
|
|
40
|
+
import Button from 'oneslash-design-system/components/button';
|
|
41
|
+
import Tooltip from 'oneslash-design-system/components/tooltip';
|
|
42
|
+
import Skeleton from 'oneslash-design-system/components/skeleton';
|
|
43
|
+
import EmptyBox from 'oneslash-design-system/components/emptyBox';
|
|
44
|
+
import { Cluster, Stack } from 'oneslash-design-system/components/layout';
|
|
45
|
+
|
|
46
|
+
type Message = { id: string; from: string; date: string; text: string; read: boolean };
|
|
47
|
+
|
|
48
|
+
const first: Message[] = [
|
|
49
|
+
{ id: 'm1', from: 'Ben Carter', date: 'Nov 16, 2026', text: 'I saw your page about error messages. Do you give talks? We are planning a day for our design team in January.', read: false },
|
|
50
|
+
{ id: 'm2', from: 'Omar Reyes', date: 'Nov 15, 2026', text: 'Is the plan changes case study open to everyone? I would like to share it with my team.', read: false },
|
|
51
|
+
{ id: 'm3', from: 'Maya Brooks', date: 'Nov 14, 2026', text: 'Thank you for the reading list. I read the piece on poor connections twice.', read: false },
|
|
52
|
+
{ id: 'm4', from: 'Leo Park', date: 'Nov 12, 2026', text: 'Could you share the password for the case studies? I would like to show it to my team.', read: true },
|
|
53
|
+
{ id: 'm5', from: 'Sara Idris', date: 'Nov 10, 2026', text: 'We are hiring a designer in the spring. Would you like to talk?', read: true },
|
|
54
|
+
{ id: 'm6', from: 'Noah Quinn', date: 'Nov 9, 2026', text: 'Your design system notes helped our team. Is there a newsletter?', read: true },
|
|
55
|
+
{ id: 'm7', from: 'Ana Silva', date: 'Nov 7, 2026', text: 'A small thing: the link to the second case study on the About page does not open.', read: true },
|
|
56
|
+
{ id: 'm8', from: 'Tom Hale', date: 'Nov 6, 2026', text: 'Can I use one of your diagrams in a talk? I will credit you.', read: true },
|
|
57
|
+
{ id: 'm9', from: 'Iris Chen', date: 'Nov 4, 2026', text: 'I would like to ask about the tools you use for prototyping.', read: true },
|
|
58
|
+
{ id: 'm10', from: 'Sam Ortiz', date: 'Nov 2, 2026', text: 'Congratulations on the new page. The facts row is very clear.', read: true },
|
|
59
|
+
{ id: 'm11', from: 'Eve Lund', date: 'Oct 29, 2026', text: 'We met at the meetup in October. I would like to stay in touch.', read: true },
|
|
60
|
+
{ id: 'm12', from: 'Raj Patel', date: 'Oct 22, 2026', text: 'Is the About page available as a printable resume?', read: true },
|
|
61
|
+
];
|
|
62
|
+
|
|
63
|
+
export default function AdminInboxList() {
|
|
64
|
+
const [messages, setMessages] = useState(first);
|
|
65
|
+
const [failed, setFailed] = useState(false);
|
|
66
|
+
const [busy, setBusy] = useState(false);
|
|
67
|
+
const [refreshes, setRefreshes] = useState(0);
|
|
68
|
+
const timer = useRef<ReturnType<typeof setTimeout>>();
|
|
69
|
+
|
|
70
|
+
// Stops the request if the example goes away before it ends.
|
|
71
|
+
useEffect(() => () => clearTimeout(timer.current), []);
|
|
72
|
+
|
|
73
|
+
const unread = messages.filter((m) => !m.read).length;
|
|
74
|
+
|
|
75
|
+
function toggle(id: string) {
|
|
76
|
+
setMessages((list) => list.map((m) => (m.id === id ? { ...m, read: !m.read } : m)));
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function load() {
|
|
80
|
+
if (busy) return;
|
|
81
|
+
const attempt = refreshes + 1;
|
|
82
|
+
setRefreshes(attempt);
|
|
83
|
+
setBusy(true);
|
|
84
|
+
// Stands in for the request to the server. The second refresh fails, so you can see Try Again.
|
|
85
|
+
timer.current = setTimeout(() => {
|
|
86
|
+
setBusy(false);
|
|
87
|
+
setFailed(attempt === 2);
|
|
88
|
+
}, 1000);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return (
|
|
92
|
+
<PageShell>
|
|
93
|
+
<Stack gap="xlarge">
|
|
94
|
+
{/* The header stays while the list loads or fails. */}
|
|
95
|
+
<PageHeader level={1} title="Messages" lede={`${unread} of ${messages.length} unread`} />
|
|
96
|
+
<Cluster>
|
|
97
|
+
<Button size="small" type="secondary" state="enabled" label="Refresh" decoIcon="RefreshCw" loading={busy && !failed} onClickButton={load} />
|
|
98
|
+
</Cluster>
|
|
99
|
+
{busy && !failed && (
|
|
100
|
+
<Stack gap="small">
|
|
101
|
+
<Skeleton variant="block" height="large" label="Loading messages" />
|
|
102
|
+
<Skeleton variant="block" height="large" />
|
|
103
|
+
<Skeleton variant="block" height="large" />
|
|
104
|
+
</Stack>
|
|
105
|
+
)}
|
|
106
|
+
{failed && (
|
|
107
|
+
// The list fails as a region, as the case 'Load failure' shows: it stays until the list loads.
|
|
108
|
+
<Surface minHeight="tall" align="center">
|
|
109
|
+
<EmptyBox
|
|
110
|
+
size="large"
|
|
111
|
+
icon="CloudOff"
|
|
112
|
+
text="Could not load messages"
|
|
113
|
+
secondText="Check your connection and try again."
|
|
114
|
+
action={<Button size="medium" type="primary" state="enabled" label="Try Again" loading={busy} onClickButton={load} />}
|
|
115
|
+
/>
|
|
116
|
+
</Surface>
|
|
117
|
+
)}
|
|
118
|
+
{!busy && !failed && messages.length === 0 && <EmptyBox size="large" text="No messages yet" secondText="Messages from the contact form appear here." />}
|
|
119
|
+
{!busy && !failed && (
|
|
120
|
+
<Stack gap="small">
|
|
121
|
+
{messages.map((m) => (
|
|
122
|
+
<Surface key={m.id} padding="small" align="start">
|
|
123
|
+
<Stack gap="small">
|
|
124
|
+
<Cluster justify="between">
|
|
125
|
+
<Cluster gap="small">
|
|
126
|
+
<Heading level={2} size="subtitle1">{m.from}</Heading>
|
|
127
|
+
{!m.read && <Tag variant="dot" size="small" color="info" label="Unread" />}
|
|
128
|
+
</Cluster>
|
|
129
|
+
<Cluster gap="small">
|
|
130
|
+
<Paragraph tone="secondary" size="caption">{m.date}</Paragraph>
|
|
131
|
+
{/* The icon shows what the Button does: an open envelope marks the message read, a closed one marks it unread. */}
|
|
132
|
+
<Tooltip title={`Mark message from ${m.from} as ${m.read ? 'unread' : 'read'}`}>
|
|
133
|
+
<IconButton
|
|
134
|
+
iconName={m.read ? 'Mail' : 'MailOpen'}
|
|
135
|
+
ariaLabel={`Mark message from ${m.from} as ${m.read ? 'unread' : 'read'}`}
|
|
136
|
+
color={m.read ? 'iconOnly' : 'primary'}
|
|
137
|
+
state="enabled"
|
|
138
|
+
size="medium"
|
|
139
|
+
onClick={() => toggle(m.id)}
|
|
140
|
+
/>
|
|
141
|
+
</Tooltip>
|
|
142
|
+
</Cluster>
|
|
143
|
+
</Cluster>
|
|
144
|
+
<Paragraph size="body2" measure="none">{m.text}</Paragraph>
|
|
145
|
+
</Stack>
|
|
146
|
+
</Surface>
|
|
147
|
+
))}
|
|
148
|
+
</Stack>
|
|
149
|
+
)}
|
|
150
|
+
</Stack>
|
|
151
|
+
</PageShell>
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
## Option: List beside the message
|
|
157
|
+
|
|
158
|
+
Use when: Many messages arrive, and the owner works down them one after another.
|
|
159
|
+
|
|
160
|
+
Uses: `Button`, `Cluster`, `Heading`, `MenuItem`, `Navigation`, `PageHeader`, `PageShell`, `Paragraph`, `SettingsLayout`, `Stack`
|
|
161
|
+
|
|
162
|
+
```tsx
|
|
163
|
+
'use client';
|
|
164
|
+
import { useState } from 'react';
|
|
165
|
+
import PageShell from 'oneslash-design-system/components/pageShell';
|
|
166
|
+
import PageHeader from 'oneslash-design-system/components/pageHeader';
|
|
167
|
+
import Navigation from 'oneslash-design-system/components/navigation';
|
|
168
|
+
import MenuItem from 'oneslash-design-system/components/menuItem';
|
|
169
|
+
import { SettingsLayout } from 'oneslash-design-system/components/settingsSection';
|
|
170
|
+
import Heading from 'oneslash-design-system/components/heading';
|
|
171
|
+
import Paragraph from 'oneslash-design-system/components/paragraph';
|
|
172
|
+
import Button from 'oneslash-design-system/components/button';
|
|
173
|
+
import { Cluster, Stack } from 'oneslash-design-system/components/layout';
|
|
174
|
+
|
|
175
|
+
type Message = { id: string; from: string; subject: string; date: string; body: string[]; read: boolean };
|
|
176
|
+
|
|
177
|
+
const first: Message[] = [
|
|
178
|
+
{ id: 'talk', from: 'Ben Carter', subject: 'A talk in January?', date: 'Nov 16, 2026', body: ['I saw your page about error messages. Do you give talks?', 'We are planning a day for our design team in January.'], read: false },
|
|
179
|
+
{ id: 'share', from: 'Omar Reyes', subject: 'Sharing the case study', date: 'Nov 15, 2026', body: ['Is the plan changes case study open to everyone?', 'I would like to share it with my team.'], read: false },
|
|
180
|
+
{ id: 'thanks', from: 'Maya Brooks', subject: 'Thank you for the reading list', date: 'Nov 14, 2026', body: ['I read the piece on poor connections twice.'], read: false },
|
|
181
|
+
{ id: 'password', from: 'Leo Park', subject: 'The case study password', date: 'Nov 12, 2026', body: ['Could you share the password for the case studies?', 'I would like to show it to my team.'], read: true },
|
|
182
|
+
{ id: 'hiring', from: 'Sara Idris', subject: 'We are hiring in the spring', date: 'Nov 10, 2026', body: ['We are hiring a designer in the spring. Would you like to talk?'], read: true },
|
|
183
|
+
{ id: 'newsletter', from: 'Noah Quinn', subject: 'Is there a newsletter?', date: 'Nov 9, 2026', body: ['Your design system notes helped our team.'], read: true },
|
|
184
|
+
];
|
|
185
|
+
|
|
186
|
+
export default function AdminInboxSplit() {
|
|
187
|
+
const [messages, setMessages] = useState(first);
|
|
188
|
+
// One message is always open, the first at the start.
|
|
189
|
+
const [openId, setOpenId] = useState(first[0].id);
|
|
190
|
+
// On a phone the list is the screen until a message is chosen, and Back returns to it.
|
|
191
|
+
const [showDetail, setShowDetail] = useState(false);
|
|
192
|
+
|
|
193
|
+
const message = messages.find((m) => m.id === openId) ?? messages[0];
|
|
194
|
+
const unread = messages.filter((m) => !m.read).length;
|
|
195
|
+
|
|
196
|
+
function toggle(id: string) {
|
|
197
|
+
setMessages((list) => list.map((m) => (m.id === id ? { ...m, read: !m.read } : m)));
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
const list = (
|
|
201
|
+
<Navigation aria-label="Messages">
|
|
202
|
+
{messages.map((m) => (
|
|
203
|
+
<MenuItem
|
|
204
|
+
key={m.id}
|
|
205
|
+
size="medium"
|
|
206
|
+
label={m.from}
|
|
207
|
+
secondLabel={m.subject}
|
|
208
|
+
tag={m.read ? undefined : { label: 'Unread', color: 'info' }}
|
|
209
|
+
href={`/admin/messages/${m.id}`}
|
|
210
|
+
isSelected={m.id === message.id}
|
|
211
|
+
aria-current={m.id === message.id ? 'page' : undefined}
|
|
212
|
+
onClick={(event: { preventDefault: () => void }) => {
|
|
213
|
+
// A real app lets the link go to the message's own address, so it can be shared and reloaded. The example keeps the choice in state.
|
|
214
|
+
event.preventDefault();
|
|
215
|
+
setOpenId(m.id);
|
|
216
|
+
setShowDetail(true);
|
|
217
|
+
}}
|
|
218
|
+
/>
|
|
219
|
+
))}
|
|
220
|
+
</Navigation>
|
|
221
|
+
);
|
|
222
|
+
|
|
223
|
+
return (
|
|
224
|
+
<PageShell>
|
|
225
|
+
<Stack gap="xlarge">
|
|
226
|
+
<PageHeader level={1} title="Messages" lede={`${unread} of ${messages.length} unread`} />
|
|
227
|
+
<SettingsLayout
|
|
228
|
+
navWidth="wide"
|
|
229
|
+
nav={list}
|
|
230
|
+
showContent={showDetail}
|
|
231
|
+
back={<Button size="small" type="tertiary" state="enabled" decoIcon="ChevronLeft" label="Back to Messages" onClickButton={() => setShowDetail(false)} />}
|
|
232
|
+
>
|
|
233
|
+
<Stack gap="small">
|
|
234
|
+
<Heading level={2} size="h6">{message.subject}</Heading>
|
|
235
|
+
<Paragraph tone="secondary" size="body2" measure="none">{message.from}, {message.date}</Paragraph>
|
|
236
|
+
</Stack>
|
|
237
|
+
<Stack gap="medium">
|
|
238
|
+
{message.body.map((paragraph) => (
|
|
239
|
+
<Paragraph key={paragraph} measure="none">{paragraph}</Paragraph>
|
|
240
|
+
))}
|
|
241
|
+
</Stack>
|
|
242
|
+
<Cluster>
|
|
243
|
+
<Button size="medium" type="secondary" state="enabled" decoIcon="CircleCheck" label={message.read ? 'Mark as Unread' : 'Mark as Read'} onClickButton={() => toggle(message.id)} />
|
|
244
|
+
</Cluster>
|
|
245
|
+
</SettingsLayout>
|
|
246
|
+
</Stack>
|
|
247
|
+
</PageShell>
|
|
248
|
+
);
|
|
249
|
+
}
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
## Native
|
|
253
|
+
|
|
254
|
+
On Apple use a `List` with a swipe action to mark a message read or unread, and a `NavigationSplitView` for many messages.
|
package/dist/cases/api-keys.md
CHANGED
|
@@ -12,7 +12,7 @@ A person makes keys that let a script or a service use the product as them, and
|
|
|
12
12
|
- Give the Modal one Button, 'Done'. Ignore Escape and a click outside while the key shows, so a stray click cannot lose it.
|
|
13
13
|
- Confirm 'Revoke' in the row, as the case 'Delete confirm' does: the row asks 'Revoke CI pipeline?' and shows 'Cancel' and a danger 'Revoke'. Then show a toast: 'CI pipeline key revoked.'
|
|
14
14
|
- Give each row's 'Revoke', and the confirm's 'Cancel' and 'Revoke', an `aria-label` that names the key: 'Revoke CI pipeline' and 'Cancel revoking CI pipeline'.
|
|
15
|
-
- Show `EmptyBox` with 'No API keys' when the list is empty, as the rule 'An empty list says what
|
|
15
|
+
- Show `EmptyBox` with 'No API keys' when the list is empty, as the rule 'An empty list says what will fill it' says.
|
|
16
16
|
- Disable the name field while the key is made, and show `loading` on the Button without changing its label.
|
|
17
17
|
|
|
18
18
|
## Don't
|
|
@@ -3,6 +3,7 @@ import { useEffect, useRef, useState } from 'react';
|
|
|
3
3
|
import TitleBar from '../../components/titleBar';
|
|
4
4
|
import TabsContainer from '../../components/tabsContainer';
|
|
5
5
|
import Tab from '../../components/tab';
|
|
6
|
+
import TabPanel from '../../components/tabPanel';
|
|
6
7
|
import Modal from '../../components/modal';
|
|
7
8
|
import Heading from '../../components/heading';
|
|
8
9
|
import Paragraph from '../../components/paragraph';
|
|
@@ -82,11 +83,16 @@ export default function AppShellTopTabs() {
|
|
|
82
83
|
setAccountOpen(function (o) { return !o; });
|
|
83
84
|
}}/>
|
|
84
85
|
</Cluster>
|
|
85
|
-
<TabsContainer fill>
|
|
86
|
-
{places.map(function (p) { return (<Tab key={p.id} label={p.label} href={"/".concat(p.id)} router={router} isSelected={p.id === place.id} onClickTab={function () { return setPlaceId(p.id); }}/>); })}
|
|
86
|
+
<TabsContainer fill aria-label="Main">
|
|
87
|
+
{places.map(function (p) { return (<Tab key={p.id} id={"app-shell-tab-".concat(p.id)} controls={"app-shell-panel-".concat(p.id)} label={p.label} href={"/".concat(p.id)} router={router} isSelected={p.id === place.id} onClickTab={function () { return setPlaceId(p.id); }}/>); })}
|
|
87
88
|
</TabsContainer>
|
|
88
|
-
|
|
89
|
-
<
|
|
89
|
+
{/* Every place is in the page. Only the open one shows. */}
|
|
90
|
+
{places.map(function (p) { return (<TabPanel key={p.id} id={"app-shell-panel-".concat(p.id)} labelledBy={"app-shell-tab-".concat(p.id)} selected={p.id === place.id}>
|
|
91
|
+
<Stack gap="large">
|
|
92
|
+
<TitleBar title={p.page} actions={<Button size="medium" type="primary" state="enabled" label="New Message" decoIcon="Plus"/>}/>
|
|
93
|
+
<Paragraph tone="secondary" measure="none">{p.text}</Paragraph>
|
|
94
|
+
</Stack>
|
|
95
|
+
</TabPanel>); })}
|
|
90
96
|
</Stack>
|
|
91
97
|
<Popover open={accountOpen} anchorEl={accountAnchor} onClose={function () { return setAccountOpen(false); }} returnFocus>
|
|
92
98
|
<Menu navigable aria-label="Account" width={200}>
|
package/dist/cases/app-shell.md
CHANGED
|
@@ -214,7 +214,7 @@ export default function AppShellSidebar() {
|
|
|
214
214
|
|
|
215
215
|
Use when: There are four places or fewer, all fixed, each with a short name that fits on a phone.
|
|
216
216
|
|
|
217
|
-
Uses: `Button`, `Center`, `Cluster`, `Heading`, `Line`, `Menu`, `MenuItem`, `Modal`, `PageShell`, `Paragraph`, `Popover`, `Stack`, `Tab`, `TabsContainer`, `TitleBar`, `UserImage`
|
|
217
|
+
Uses: `Button`, `Center`, `Cluster`, `Heading`, `Line`, `Menu`, `MenuItem`, `Modal`, `PageShell`, `Paragraph`, `Popover`, `Stack`, `Tab`, `TabPanel`, `TabsContainer`, `TitleBar`, `UserImage`
|
|
218
218
|
|
|
219
219
|
```tsx
|
|
220
220
|
'use client';
|
|
@@ -222,6 +222,7 @@ import { useEffect, useRef, useState } from 'react';
|
|
|
222
222
|
import TitleBar from 'oneslash-design-system/components/titleBar';
|
|
223
223
|
import TabsContainer from 'oneslash-design-system/components/tabsContainer';
|
|
224
224
|
import Tab from 'oneslash-design-system/components/tab';
|
|
225
|
+
import TabPanel from 'oneslash-design-system/components/tabPanel';
|
|
225
226
|
import Modal from 'oneslash-design-system/components/modal';
|
|
226
227
|
import Heading from 'oneslash-design-system/components/heading';
|
|
227
228
|
import Paragraph from 'oneslash-design-system/components/paragraph';
|
|
@@ -324,13 +325,20 @@ export default function AppShellTopTabs() {
|
|
|
324
325
|
}}
|
|
325
326
|
/>
|
|
326
327
|
</Cluster>
|
|
327
|
-
<TabsContainer fill>
|
|
328
|
+
<TabsContainer fill aria-label="Main">
|
|
328
329
|
{places.map((p) => (
|
|
329
|
-
<Tab key={p.id} label={p.label} href={`/${p.id}`} router={router} isSelected={p.id === place.id} onClickTab={() => setPlaceId(p.id)} />
|
|
330
|
+
<Tab key={p.id} id={`app-shell-tab-${p.id}`} controls={`app-shell-panel-${p.id}`} label={p.label} href={`/${p.id}`} router={router} isSelected={p.id === place.id} onClickTab={() => setPlaceId(p.id)} />
|
|
330
331
|
))}
|
|
331
332
|
</TabsContainer>
|
|
332
|
-
|
|
333
|
-
|
|
333
|
+
{/* Every place is in the page. Only the open one shows. */}
|
|
334
|
+
{places.map((p) => (
|
|
335
|
+
<TabPanel key={p.id} id={`app-shell-panel-${p.id}`} labelledBy={`app-shell-tab-${p.id}`} selected={p.id === place.id}>
|
|
336
|
+
<Stack gap="large">
|
|
337
|
+
<TitleBar title={p.page} actions={<Button size="medium" type="primary" state="enabled" label="New Message" decoIcon="Plus" />} />
|
|
338
|
+
<Paragraph tone="secondary" measure="none">{p.text}</Paragraph>
|
|
339
|
+
</Stack>
|
|
340
|
+
</TabPanel>
|
|
341
|
+
))}
|
|
334
342
|
</Stack>
|
|
335
343
|
<Popover open={accountOpen} anchorEl={accountAnchor} onClose={() => setAccountOpen(false)} returnFocus>
|
|
336
344
|
<Menu navigable aria-label="Account" width={200}>
|
|
@@ -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 ChangelogByMonth(): import("react").JSX.Element;
|