oneslash-design-system 2.20.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 +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/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 +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/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/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 +1173 -29
- package/dist/components/accordion.d.ts +31 -0
- package/dist/components/accordion.jsx +103 -0
- package/dist/components/codeBlock.d.ts +26 -0
- package/dist/components/codeBlock.jsx +101 -0
- 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/searchDialog.d.ts +44 -0
- package/dist/components/searchDialog.jsx +152 -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/tabsContainer.d.ts +5 -1
- package/dist/components/tabsContainer.jsx +2 -2
- 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/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 +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/SearchDialog.stories.d.ts +17 -0
- package/dist/stories/SearchDialog.stories.jsx +111 -0
- package/dist/stories/TabPanel.stories.d.ts +7 -0
- package/dist/stories/TabPanel.stories.jsx +31 -0
- package/package.json +1 -1
|
@@ -117,13 +117,16 @@ export default function ReplyFeedbackThumbs() {
|
|
|
117
117
|
const mounted = useRef(true);
|
|
118
118
|
|
|
119
119
|
// On unmount it stops every timer and the run.
|
|
120
|
-
useEffect(() =>
|
|
121
|
-
mounted.current =
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
120
|
+
useEffect(() => {
|
|
121
|
+
mounted.current = true;
|
|
122
|
+
return () => {
|
|
123
|
+
mounted.current = false;
|
|
124
|
+
clearTimeout(thanksTimer.current);
|
|
125
|
+
clearTimeout(copyTimer.current);
|
|
126
|
+
clearInterval(tick.current);
|
|
127
|
+
clearTimeout(step.current);
|
|
128
|
+
clearTimeout(cancel.current);
|
|
129
|
+
};
|
|
127
130
|
}, []);
|
|
128
131
|
|
|
129
132
|
useEffect(() => {
|
|
@@ -364,13 +367,16 @@ export default function ReplyFeedbackWithReason() {
|
|
|
364
367
|
const mounted = useRef(true);
|
|
365
368
|
|
|
366
369
|
// On unmount it stops every timer and the run.
|
|
367
|
-
useEffect(() =>
|
|
368
|
-
mounted.current =
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
370
|
+
useEffect(() => {
|
|
371
|
+
mounted.current = true;
|
|
372
|
+
return () => {
|
|
373
|
+
mounted.current = false;
|
|
374
|
+
clearTimeout(thanksTimer.current);
|
|
375
|
+
clearTimeout(copyTimer.current);
|
|
376
|
+
clearInterval(tick.current);
|
|
377
|
+
clearTimeout(step.current);
|
|
378
|
+
clearTimeout(cancel.current);
|
|
379
|
+
};
|
|
374
380
|
}, []);
|
|
375
381
|
|
|
376
382
|
useEffect(() => {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function SectionIndexCards(): import("react").JSX.Element;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import PageShell from '../../components/pageShell';
|
|
3
|
+
import PageHeader from '../../components/pageHeader';
|
|
4
|
+
import LinkCard from '../../components/linkCard';
|
|
5
|
+
import { Grid, Stack } from '../../components/layout';
|
|
6
|
+
// Six places, each with a line that says what is there. A real site lists its own pages.
|
|
7
|
+
var guides = [
|
|
8
|
+
{ id: 'start', title: 'Get started', line: 'Name your workspace and add the first people.' },
|
|
9
|
+
{ id: 'channels', title: 'Channels', line: 'One place for the talk about each subject.' },
|
|
10
|
+
{ id: 'tasks', title: 'Tasks', line: 'Give work an owner and a due date.' },
|
|
11
|
+
{ id: 'notes', title: 'Notes', line: 'Write a decision once and find it later.' },
|
|
12
|
+
{ id: 'agent', title: 'The agent', line: 'Ask a question and see the sources it used.' },
|
|
13
|
+
{ id: 'billing', title: 'Plans and billing', line: 'Change plan and download invoices.' },
|
|
14
|
+
];
|
|
15
|
+
export default function SectionIndexCards() {
|
|
16
|
+
return (<PageShell>
|
|
17
|
+
<Stack gap="giant">
|
|
18
|
+
<PageHeader level={1} title="Guides" lede="How to do each thing in Acme, one page for each."/>
|
|
19
|
+
{/* Three across from md, one on a phone. Every card is one link, named by its title and its line. */}
|
|
20
|
+
<Grid columns={3}>
|
|
21
|
+
{guides.map(function (g) { return (<LinkCard key={g.id} href={"#".concat(g.id)} title={g.title} description={g.line}/>); })}
|
|
22
|
+
</Grid>
|
|
23
|
+
</Stack>
|
|
24
|
+
</PageShell>);
|
|
25
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function SectionIndexList(): import("react").JSX.Element;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import PageShell from '../../components/pageShell';
|
|
3
|
+
import PageHeader from '../../components/pageHeader';
|
|
4
|
+
import SectionIntro from '../../components/sectionIntro';
|
|
5
|
+
import Link from '../../components/link';
|
|
6
|
+
import List from '../../components/list';
|
|
7
|
+
import Paragraph from '../../components/paragraph';
|
|
8
|
+
import { PageSection, Stack } from '../../components/layout';
|
|
9
|
+
// Many places, in groups. A real site builds this from its own list of pages.
|
|
10
|
+
var groups = [
|
|
11
|
+
{
|
|
12
|
+
id: 'section-index-start',
|
|
13
|
+
name: 'Start here',
|
|
14
|
+
pages: [
|
|
15
|
+
{ id: 'workspace', title: 'Make a workspace', line: 'Name it and choose a plan.' },
|
|
16
|
+
{ id: 'invite', title: 'Invite people', line: 'Invite by email and choose what each person can do.' },
|
|
17
|
+
{ id: 'tour', title: 'A tour of Acme', line: 'Channels, tasks, notes and the agent in one page.' },
|
|
18
|
+
],
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
id: 'section-index-work',
|
|
22
|
+
name: 'Everyday work',
|
|
23
|
+
pages: [
|
|
24
|
+
{ id: 'channels', title: 'Channels', line: 'One place for the talk about each subject.' },
|
|
25
|
+
{ id: 'threads', title: 'Threads', line: 'Reply to one message without filling the channel.' },
|
|
26
|
+
{ id: 'tasks', title: 'Tasks', line: 'Give work an owner and a due date.' },
|
|
27
|
+
{ id: 'notes', title: 'Notes', line: 'Write a decision once and find it later.' },
|
|
28
|
+
{ id: 'search', title: 'Search', line: 'Find a message, a note or a file from one box.' },
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
id: 'section-index-admin',
|
|
33
|
+
name: 'Run a workspace',
|
|
34
|
+
pages: [
|
|
35
|
+
{ id: 'members', title: 'Members and roles', line: 'Who can read, write and change settings.' },
|
|
36
|
+
{ id: 'billing', title: 'Plans and billing', line: 'Change plan and download invoices.' },
|
|
37
|
+
{ id: 'export', title: 'Export your notes', line: 'Take a note or a whole workspace as PDF.' },
|
|
38
|
+
{ id: 'delete', title: 'Delete a workspace', line: 'What is removed, and what you can get back.' },
|
|
39
|
+
],
|
|
40
|
+
},
|
|
41
|
+
];
|
|
42
|
+
export default function SectionIndexList() {
|
|
43
|
+
return (<PageShell>
|
|
44
|
+
<Stack gap="giant">
|
|
45
|
+
<PageHeader level={1} title="Guides" lede="How to do each thing in Acme, one page for each."/>
|
|
46
|
+
{groups.map(function (group) { return (<PageSection key={group.id} gap="xlarge">
|
|
47
|
+
{/* The group's name is the level 2 heading. Each link has its line under it. */}
|
|
48
|
+
<SectionIntro id={group.id} name={group.name}/>
|
|
49
|
+
<List items={group.pages.map(function (p) { return (<Stack key={p.id} gap="small">
|
|
50
|
+
<Link href={"#".concat(p.id)} size="subtitle1">{p.title}</Link>
|
|
51
|
+
<Paragraph tone="secondary" size="body2" measure="none">{p.line}</Paragraph>
|
|
52
|
+
</Stack>); })}/>
|
|
53
|
+
</PageSection>); })}
|
|
54
|
+
</Stack>
|
|
55
|
+
</PageShell>);
|
|
56
|
+
}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
# Section index
|
|
2
|
+
|
|
3
|
+
A section of a site, such as the guides, has its own first page that shows the places inside it, so a person can pick one.
|
|
4
|
+
|
|
5
|
+
## Do
|
|
6
|
+
|
|
7
|
+
- Use `PageHeader` with `level={1}`: the section's name is the one level 1 heading, with a `lede` of one sentence.
|
|
8
|
+
- Put the places in a `Grid columns={3}` for `cards`: three across from the medium breakpoint, one on a phone. Make each a `LinkCard` with a `title` and a `description` of one short line.
|
|
9
|
+
- Write the title as the name of the page it goes to, and the description as what a person finds there, not as a call to action.
|
|
10
|
+
- Keep a card that leaves the site, a `LinkCard` with `external`, in a group of its own, so a person is not sent away by surprise.
|
|
11
|
+
- Group the places under level 2 `SectionIntro`s for `list`, and put the places of each group in a `List`, each a `Link` with `size="subtitle1"` and a `Paragraph` line under it. Put the places a new person needs first.
|
|
12
|
+
- Order the places the way a person does the work, not alphabetically, unless there are more than about twenty.
|
|
13
|
+
- Pass `image` to the `LinkCard` when a place has an image, with alt text that says what it shows, or `alt=""` when the title says it all.
|
|
14
|
+
|
|
15
|
+
## Don't
|
|
16
|
+
|
|
17
|
+
- Do not put more than about nine cards in a grid. A person cannot compare more, so use `list`.
|
|
18
|
+
- Do not repeat the section name in every title.
|
|
19
|
+
- Do not write a description that repeats its title.
|
|
20
|
+
- Do not make a card out of a place with nothing in it yet. Leave it out until it has a page.
|
|
21
|
+
- Do not wrap a `LinkCard` in a second link or put a Button inside it.
|
|
22
|
+
|
|
23
|
+
## Option: Cards with a line each
|
|
24
|
+
|
|
25
|
+
Use when: Up to about nine places, each with a short line that says what is there.
|
|
26
|
+
|
|
27
|
+
Uses: `Grid`, `LinkCard`, `PageHeader`, `PageShell`, `Stack`
|
|
28
|
+
|
|
29
|
+
```tsx
|
|
30
|
+
'use client';
|
|
31
|
+
import PageShell from 'oneslash-design-system/components/pageShell';
|
|
32
|
+
import PageHeader from 'oneslash-design-system/components/pageHeader';
|
|
33
|
+
import LinkCard from 'oneslash-design-system/components/linkCard';
|
|
34
|
+
import { Grid, Stack } from 'oneslash-design-system/components/layout';
|
|
35
|
+
|
|
36
|
+
// Six places, each with a line that says what is there. A real site lists its own pages.
|
|
37
|
+
const guides = [
|
|
38
|
+
{ id: 'start', title: 'Get started', line: 'Name your workspace and add the first people.' },
|
|
39
|
+
{ id: 'channels', title: 'Channels', line: 'One place for the talk about each subject.' },
|
|
40
|
+
{ id: 'tasks', title: 'Tasks', line: 'Give work an owner and a due date.' },
|
|
41
|
+
{ id: 'notes', title: 'Notes', line: 'Write a decision once and find it later.' },
|
|
42
|
+
{ id: 'agent', title: 'The agent', line: 'Ask a question and see the sources it used.' },
|
|
43
|
+
{ id: 'billing', title: 'Plans and billing', line: 'Change plan and download invoices.' },
|
|
44
|
+
];
|
|
45
|
+
|
|
46
|
+
export default function SectionIndexCards() {
|
|
47
|
+
return (
|
|
48
|
+
<PageShell>
|
|
49
|
+
<Stack gap="giant">
|
|
50
|
+
<PageHeader level={1} title="Guides" lede="How to do each thing in Acme, one page for each." />
|
|
51
|
+
{/* Three across from md, one on a phone. Every card is one link, named by its title and its line. */}
|
|
52
|
+
<Grid columns={3}>
|
|
53
|
+
{guides.map((g) => (
|
|
54
|
+
<LinkCard key={g.id} href={`#${g.id}`} title={g.title} description={g.line} />
|
|
55
|
+
))}
|
|
56
|
+
</Grid>
|
|
57
|
+
</Stack>
|
|
58
|
+
</PageShell>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Option: A list of links in groups
|
|
64
|
+
|
|
65
|
+
Use when: More places than nine, or names that say enough without a line of their own.
|
|
66
|
+
|
|
67
|
+
Uses: `Link`, `List`, `PageHeader`, `PageSection`, `PageShell`, `Paragraph`, `SectionIntro`, `Stack`
|
|
68
|
+
|
|
69
|
+
```tsx
|
|
70
|
+
'use client';
|
|
71
|
+
import PageShell from 'oneslash-design-system/components/pageShell';
|
|
72
|
+
import PageHeader from 'oneslash-design-system/components/pageHeader';
|
|
73
|
+
import SectionIntro from 'oneslash-design-system/components/sectionIntro';
|
|
74
|
+
import Link from 'oneslash-design-system/components/link';
|
|
75
|
+
import List from 'oneslash-design-system/components/list';
|
|
76
|
+
import Paragraph from 'oneslash-design-system/components/paragraph';
|
|
77
|
+
import { PageSection, Stack } from 'oneslash-design-system/components/layout';
|
|
78
|
+
|
|
79
|
+
// Many places, in groups. A real site builds this from its own list of pages.
|
|
80
|
+
const groups = [
|
|
81
|
+
{
|
|
82
|
+
id: 'section-index-start',
|
|
83
|
+
name: 'Start here',
|
|
84
|
+
pages: [
|
|
85
|
+
{ id: 'workspace', title: 'Make a workspace', line: 'Name it and choose a plan.' },
|
|
86
|
+
{ id: 'invite', title: 'Invite people', line: 'Invite by email and choose what each person can do.' },
|
|
87
|
+
{ id: 'tour', title: 'A tour of Acme', line: 'Channels, tasks, notes and the agent in one page.' },
|
|
88
|
+
],
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
id: 'section-index-work',
|
|
92
|
+
name: 'Everyday work',
|
|
93
|
+
pages: [
|
|
94
|
+
{ id: 'channels', title: 'Channels', line: 'One place for the talk about each subject.' },
|
|
95
|
+
{ id: 'threads', title: 'Threads', line: 'Reply to one message without filling the channel.' },
|
|
96
|
+
{ id: 'tasks', title: 'Tasks', line: 'Give work an owner and a due date.' },
|
|
97
|
+
{ id: 'notes', title: 'Notes', line: 'Write a decision once and find it later.' },
|
|
98
|
+
{ id: 'search', title: 'Search', line: 'Find a message, a note or a file from one box.' },
|
|
99
|
+
],
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
id: 'section-index-admin',
|
|
103
|
+
name: 'Run a workspace',
|
|
104
|
+
pages: [
|
|
105
|
+
{ id: 'members', title: 'Members and roles', line: 'Who can read, write and change settings.' },
|
|
106
|
+
{ id: 'billing', title: 'Plans and billing', line: 'Change plan and download invoices.' },
|
|
107
|
+
{ id: 'export', title: 'Export your notes', line: 'Take a note or a whole workspace as PDF.' },
|
|
108
|
+
{ id: 'delete', title: 'Delete a workspace', line: 'What is removed, and what you can get back.' },
|
|
109
|
+
],
|
|
110
|
+
},
|
|
111
|
+
];
|
|
112
|
+
|
|
113
|
+
export default function SectionIndexList() {
|
|
114
|
+
return (
|
|
115
|
+
<PageShell>
|
|
116
|
+
<Stack gap="giant">
|
|
117
|
+
<PageHeader level={1} title="Guides" lede="How to do each thing in Acme, one page for each." />
|
|
118
|
+
{groups.map((group) => (
|
|
119
|
+
<PageSection key={group.id} gap="xlarge">
|
|
120
|
+
{/* The group's name is the level 2 heading. Each link has its line under it. */}
|
|
121
|
+
<SectionIntro id={group.id} name={group.name} />
|
|
122
|
+
<List
|
|
123
|
+
items={group.pages.map((p) => (
|
|
124
|
+
<Stack key={p.id} gap="small">
|
|
125
|
+
<Link href={`#${p.id}`} size="subtitle1">{p.title}</Link>
|
|
126
|
+
<Paragraph tone="secondary" size="body2" measure="none">{p.line}</Paragraph>
|
|
127
|
+
</Stack>
|
|
128
|
+
))}
|
|
129
|
+
/>
|
|
130
|
+
</PageSection>
|
|
131
|
+
))}
|
|
132
|
+
</Stack>
|
|
133
|
+
</PageShell>
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## Native
|
|
139
|
+
|
|
140
|
+
On Apple use a `List` of `NavigationLink` rows with a subtitle, grouped in `Section`s. On Android use a `LazyColumn` of list items with supporting text, or a grid of cards for a few places.
|
|
@@ -12,7 +12,7 @@ A site's pages name the site at the top and show the person where to go and what
|
|
|
12
12
|
- Give a site with sections one `TabsContainer` of `Tab`s with `href`, four sections or fewer and one short word each. Pass it as `nav` to `SiteHeader` with `links` empty: it is a second row of the bar at every width.
|
|
13
13
|
- Pass search and the theme menu as `phoneAction`, so they stay at the end of the bar on a phone. With no `links` and no `actions` there is no menu.
|
|
14
14
|
- Keep the section tabs in the bar, so no section is hidden. On a phone, put the pages of the open section in a menu, as the case 'Menu on a phone' shows in 'Sections with their pages'.
|
|
15
|
-
- Open the theme menu as the case 'Theme switcher' says, and
|
|
15
|
+
- Open the theme menu as the case 'Theme switcher' says, and open search as the case 'Site search' says.
|
|
16
16
|
|
|
17
17
|
## Don't
|
|
18
18
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function SiteSearchDialog(): import("react").JSX.Element;
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
+
var t = {};
|
|
15
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
+
t[p] = s[p];
|
|
17
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
+
t[p[i]] = s[p[i]];
|
|
21
|
+
}
|
|
22
|
+
return t;
|
|
23
|
+
};
|
|
24
|
+
import { useEffect, useRef, useState } from 'react';
|
|
25
|
+
import SiteHeader from '../../components/siteHeader';
|
|
26
|
+
import SearchDialog from '../../components/searchDialog';
|
|
27
|
+
import useHotkey from '../../components/useHotkey';
|
|
28
|
+
import Button from '../../components/button';
|
|
29
|
+
import PageShell from '../../components/pageShell';
|
|
30
|
+
import Heading from '../../components/heading';
|
|
31
|
+
import Paragraph from '../../components/paragraph';
|
|
32
|
+
import { Stack } from '../../components/layout';
|
|
33
|
+
// A real site asks its server, which has every page. These are the pages of a made-up docs site.
|
|
34
|
+
var entries = [
|
|
35
|
+
{ id: 'button', group: 'Components', title: 'Button', secondLabel: 'Components', href: '#button', iconName: 'MousePointerClick', text: 'The control that starts an action, in four sizes.' },
|
|
36
|
+
{ id: 'tag', group: 'Components', title: 'Tag', secondLabel: 'Components', href: '#tag', iconName: 'Tag', text: 'A short label for a state, such as Paid or Draft.' },
|
|
37
|
+
{ id: 'tabs', group: 'Components', title: 'Tabs', secondLabel: 'Components', href: '#tabs', iconName: 'PanelTop', text: 'Switch between views of one thing on one page.' },
|
|
38
|
+
{ id: 'table', group: 'Components', title: 'Table', secondLabel: 'Components', href: '#table', iconName: 'Table', text: 'Rows and columns that scroll inside their own region.' },
|
|
39
|
+
{ id: 'accordion', group: 'Components', title: 'Accordion', secondLabel: 'Components', href: '#accordion', iconName: 'ChevronsUpDown', text: 'Headings that open a panel under them.' },
|
|
40
|
+
{ id: 'faq', group: 'Cases', title: 'FAQ', secondLabel: 'Cases', href: '#faq', iconName: 'CircleHelp', text: 'Answer the questions a visitor asks before signing up.' },
|
|
41
|
+
{ id: 'pricing', group: 'Cases', title: 'Pricing section', secondLabel: 'Cases', href: '#pricing', iconName: 'CreditCard', text: 'Show the plans side by side with one price each.' },
|
|
42
|
+
{ id: 'login', group: 'Cases', title: 'Login page', secondLabel: 'Cases', href: '#login', iconName: 'LogIn', text: 'Let a person log in with an email or a provider.' },
|
|
43
|
+
{ id: 'tabbed', group: 'Cases', title: 'Tabbed panels', secondLabel: 'Cases', href: '#tabbed', iconName: 'PanelTop', text: 'Four views of one thing, and a visitor reads one.' },
|
|
44
|
+
];
|
|
45
|
+
var SEARCH_MS = 300;
|
|
46
|
+
// A stand-in for the request. A real site calls its server here and may fail.
|
|
47
|
+
function searchPages(query, keep) {
|
|
48
|
+
return new Promise(function (resolve) {
|
|
49
|
+
keep(setTimeout(function () {
|
|
50
|
+
var words = query.toLowerCase().split(/\s+/).filter(Boolean);
|
|
51
|
+
var found = entries.filter(function (e) { return words.every(function (w) { return "".concat(e.title, " ").concat(e.text).toLowerCase().includes(w); }); });
|
|
52
|
+
var groups = ['Components', 'Cases']
|
|
53
|
+
.map(function (label) { return ({ label: label, items: found.filter(function (e) { return e.group === label; }).map(function (_a) {
|
|
54
|
+
var group = _a.group, text = _a.text, item = __rest(_a, ["group", "text"]);
|
|
55
|
+
return (__assign(__assign({}, item), { excerpt: text }));
|
|
56
|
+
}) }); })
|
|
57
|
+
.filter(function (g) { return g.items.length > 0; });
|
|
58
|
+
resolve(groups);
|
|
59
|
+
}, SEARCH_MS));
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
// Visited pages, most recent first. A real site keeps them for the person.
|
|
63
|
+
var recent = entries.slice(0, 3).map(function (_a) {
|
|
64
|
+
var group = _a.group, text = _a.text, item = __rest(_a, ["group", "text"]);
|
|
65
|
+
return item;
|
|
66
|
+
});
|
|
67
|
+
export default function SiteSearchDialog() {
|
|
68
|
+
var _a = useState(false), open = _a[0], setOpen = _a[1];
|
|
69
|
+
var _b = useState(''), query = _b[0], setQuery = _b[1];
|
|
70
|
+
var _c = useState([]), groups = _c[0], setGroups = _c[1];
|
|
71
|
+
var _d = useState('idle'), status = _d[0], setStatus = _d[1];
|
|
72
|
+
// Each request has a number; only the newest one may answer.
|
|
73
|
+
var latest = useRef(0);
|
|
74
|
+
var timer = useRef();
|
|
75
|
+
useEffect(function () { return function () { return clearTimeout(timer.current); }; }, []);
|
|
76
|
+
function run(next) {
|
|
77
|
+
var id = ++latest.current;
|
|
78
|
+
if (next.trim() === '') {
|
|
79
|
+
setStatus('idle');
|
|
80
|
+
setGroups([]);
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
setStatus('loading');
|
|
84
|
+
// An older request's timer is cleared, so only one is ever pending and unmount clears it
|
|
85
|
+
searchPages(next, function (t) {
|
|
86
|
+
clearTimeout(timer.current);
|
|
87
|
+
timer.current = t;
|
|
88
|
+
})
|
|
89
|
+
.then(function (found) {
|
|
90
|
+
// A reply for an older query is dropped
|
|
91
|
+
if (id !== latest.current)
|
|
92
|
+
return;
|
|
93
|
+
setGroups(found);
|
|
94
|
+
setStatus('done');
|
|
95
|
+
})
|
|
96
|
+
.catch(function () {
|
|
97
|
+
if (id !== latest.current)
|
|
98
|
+
return;
|
|
99
|
+
setStatus('error');
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
function change(next) {
|
|
103
|
+
setQuery(next);
|
|
104
|
+
run(next);
|
|
105
|
+
}
|
|
106
|
+
function show() {
|
|
107
|
+
setQuery('');
|
|
108
|
+
run('');
|
|
109
|
+
setOpen(true);
|
|
110
|
+
}
|
|
111
|
+
// Cmd+K, or Ctrl+K on Windows, from anywhere on the page except a text field
|
|
112
|
+
useHotkey('k', function () {
|
|
113
|
+
if (!open)
|
|
114
|
+
show();
|
|
115
|
+
});
|
|
116
|
+
return (<>
|
|
117
|
+
{/* The Search Button is the main action of the bar, so it stays beside the brand at every width. */}
|
|
118
|
+
<SiteHeader brand={{ href: '#top', name: 'Acme' }} links={[
|
|
119
|
+
{ label: 'Guides', href: '#guides' },
|
|
120
|
+
{ label: 'Components', href: '#components', current: true },
|
|
121
|
+
{ label: 'Cases', href: '#cases' },
|
|
122
|
+
]} phoneAction={<Button size="medium" type="secondary" state="enabled" label="Search" decoIcon="Search" aria-haspopup="dialog" aria-keyshortcuts="Meta+K Control+K" onClickButton={show}/>} mainId="site-search-main"/>
|
|
123
|
+
<PageShell id="site-search-main" tabIndex={-1}>
|
|
124
|
+
<Stack gap="large">
|
|
125
|
+
<Heading level={1} size="h5">Components</Heading>
|
|
126
|
+
<Paragraph tone="secondary" measure="none">Press Cmd+K, or Ctrl+K on Windows, to search every page.</Paragraph>
|
|
127
|
+
</Stack>
|
|
128
|
+
</PageShell>
|
|
129
|
+
<SearchDialog isOpen={open} onClose={function () { return setOpen(false); }} query={query} onQueryChange={change} groups={groups} status={status} onRetry={function () { return run(query); }} recent={recent} placeholder="Search components and cases"/>
|
|
130
|
+
</>);
|
|
131
|
+
}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
# Site search
|
|
2
|
+
|
|
3
|
+
A site has many pages, and a person wants to reach one by its name or by a word in it, from any page.
|
|
4
|
+
|
|
5
|
+
## Do
|
|
6
|
+
|
|
7
|
+
- Put a 'Search' `Button` with `decoIcon="Search"` in the `SiteHeader`, in `phoneAction`, so it stays in the bar at every width. Give it `aria-haspopup="dialog"` and `aria-keyshortcuts="Meta+K Control+K"`.
|
|
8
|
+
- Put Search before 'Sign Up' in `phoneAction` on a site with a main action, as an `IconButton` named 'Search', so both fit on a phone.
|
|
9
|
+
- Open the same dialog with Cmd+K, or Ctrl+K on Windows, using `useHotkey('k', …)`. The shortcut does nothing while a person types in a field. Say it on the page in words, as the case 'Quick switcher' does.
|
|
10
|
+
- Use `SearchDialog`. Keep the query and the results in your page and pass them in with `status`. Focus stays in the field; the arrow keys move the highlight, Enter follows the highlighted link and Escape closes it.
|
|
11
|
+
- Group the results under names such as 'Components' and 'Cases', and give each a `secondLabel` that says where it is and an `excerpt` of the text around the match. The words typed are marked in the title and the excerpt, as written, so 'c++ (beta)' is not read as a pattern.
|
|
12
|
+
- Set `status` to 'loading' when you ask and 'done' when the answer comes. After 300 ms the dialog says 'Searching' once and keeps the old results, marked `aria-busy`. A search that is faster than that shows no flash.
|
|
13
|
+
- Number each request and drop a reply for an older query. Keep timers in a ref and clear them on unmount.
|
|
14
|
+
- Show `recent` places before anything is typed, at most six, newest first.
|
|
15
|
+
- Let the dialog say what was searched when nothing matches, with 'Clear Search' that puts focus back in the field, as the case 'Empty search' says. Set `status` to 'error' when the request fails: it says 'Search is not working right now.' with 'Try Again'; pass `onRetry`.
|
|
16
|
+
- Use the case 'Quick switcher' instead inside an app, with workspaces, channels and people.
|
|
17
|
+
|
|
18
|
+
## Don't
|
|
19
|
+
|
|
20
|
+
- Do not put the Search Button in `actions`. On a phone it moves into the menu, which closes when it is chosen, so the dialog has no Button to give focus back to.
|
|
21
|
+
- Do not search on every key with no wait for the answer. Drop an answer that is out of date instead.
|
|
22
|
+
- Do not build the dialog, the list and the keys by hand. `SearchDialog` does the roles, the focus and the status.
|
|
23
|
+
- Do not write the match as a pattern. A person may type brackets or a plus sign.
|
|
24
|
+
- Do not show a spinner in place of the results. Keep the old results on screen while the new ones load.
|
|
25
|
+
- Do not close the dialog when 'Clear Search' is pressed. A person who cleared the words wants to search again.
|
|
26
|
+
|
|
27
|
+
## Example: Search in a dialog
|
|
28
|
+
|
|
29
|
+
Uses: `Button`, `Heading`, `PageShell`, `Paragraph`, `SearchDialog`, `SiteHeader`, `Stack`, `useHotkey`
|
|
30
|
+
|
|
31
|
+
```tsx
|
|
32
|
+
'use client';
|
|
33
|
+
import { useEffect, useRef, useState } from 'react';
|
|
34
|
+
import SiteHeader from 'oneslash-design-system/components/siteHeader';
|
|
35
|
+
import SearchDialog, { type SearchGroup, type SearchResult } from 'oneslash-design-system/components/searchDialog';
|
|
36
|
+
import useHotkey from 'oneslash-design-system/components/useHotkey';
|
|
37
|
+
import Button from 'oneslash-design-system/components/button';
|
|
38
|
+
import PageShell from 'oneslash-design-system/components/pageShell';
|
|
39
|
+
import Heading from 'oneslash-design-system/components/heading';
|
|
40
|
+
import Paragraph from 'oneslash-design-system/components/paragraph';
|
|
41
|
+
import { Stack } from 'oneslash-design-system/components/layout';
|
|
42
|
+
|
|
43
|
+
type Entry = SearchResult & { group: 'Components' | 'Cases'; text: string };
|
|
44
|
+
|
|
45
|
+
// A real site asks its server, which has every page. These are the pages of a made-up docs site.
|
|
46
|
+
const entries: Entry[] = [
|
|
47
|
+
{ id: 'button', group: 'Components', title: 'Button', secondLabel: 'Components', href: '#button', iconName: 'MousePointerClick', text: 'The control that starts an action, in four sizes.' },
|
|
48
|
+
{ id: 'tag', group: 'Components', title: 'Tag', secondLabel: 'Components', href: '#tag', iconName: 'Tag', text: 'A short label for a state, such as Paid or Draft.' },
|
|
49
|
+
{ id: 'tabs', group: 'Components', title: 'Tabs', secondLabel: 'Components', href: '#tabs', iconName: 'PanelTop', text: 'Switch between views of one thing on one page.' },
|
|
50
|
+
{ id: 'table', group: 'Components', title: 'Table', secondLabel: 'Components', href: '#table', iconName: 'Table', text: 'Rows and columns that scroll inside their own region.' },
|
|
51
|
+
{ id: 'accordion', group: 'Components', title: 'Accordion', secondLabel: 'Components', href: '#accordion', iconName: 'ChevronsUpDown', text: 'Headings that open a panel under them.' },
|
|
52
|
+
{ id: 'faq', group: 'Cases', title: 'FAQ', secondLabel: 'Cases', href: '#faq', iconName: 'CircleHelp', text: 'Answer the questions a visitor asks before signing up.' },
|
|
53
|
+
{ id: 'pricing', group: 'Cases', title: 'Pricing section', secondLabel: 'Cases', href: '#pricing', iconName: 'CreditCard', text: 'Show the plans side by side with one price each.' },
|
|
54
|
+
{ id: 'login', group: 'Cases', title: 'Login page', secondLabel: 'Cases', href: '#login', iconName: 'LogIn', text: 'Let a person log in with an email or a provider.' },
|
|
55
|
+
{ id: 'tabbed', group: 'Cases', title: 'Tabbed panels', secondLabel: 'Cases', href: '#tabbed', iconName: 'PanelTop', text: 'Four views of one thing, and a visitor reads one.' },
|
|
56
|
+
];
|
|
57
|
+
|
|
58
|
+
const SEARCH_MS = 300;
|
|
59
|
+
|
|
60
|
+
// A stand-in for the request. A real site calls its server here and may fail.
|
|
61
|
+
function searchPages(query: string, keep: (t: ReturnType<typeof setTimeout>) => void): Promise<SearchGroup[]> {
|
|
62
|
+
return new Promise((resolve) => {
|
|
63
|
+
keep(setTimeout(() => {
|
|
64
|
+
const words = query.toLowerCase().split(/\s+/).filter(Boolean);
|
|
65
|
+
const found = entries.filter((e) => words.every((w) => `${e.title} ${e.text}`.toLowerCase().includes(w)));
|
|
66
|
+
const groups = (['Components', 'Cases'] as const)
|
|
67
|
+
.map((label) => ({ label, items: found.filter((e) => e.group === label).map(({ group, text, ...item }) => ({ ...item, excerpt: text })) }))
|
|
68
|
+
.filter((g) => g.items.length > 0);
|
|
69
|
+
resolve(groups);
|
|
70
|
+
}, SEARCH_MS));
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Visited pages, most recent first. A real site keeps them for the person.
|
|
75
|
+
const recent: SearchResult[] = entries.slice(0, 3).map(({ group, text, ...item }) => item);
|
|
76
|
+
|
|
77
|
+
export default function SiteSearchDialog() {
|
|
78
|
+
const [open, setOpen] = useState(false);
|
|
79
|
+
const [query, setQuery] = useState('');
|
|
80
|
+
const [groups, setGroups] = useState<SearchGroup[]>([]);
|
|
81
|
+
const [status, setStatus] = useState<'idle' | 'loading' | 'done' | 'error'>('idle');
|
|
82
|
+
// Each request has a number; only the newest one may answer.
|
|
83
|
+
const latest = useRef(0);
|
|
84
|
+
const timer = useRef<ReturnType<typeof setTimeout>>();
|
|
85
|
+
useEffect(() => () => clearTimeout(timer.current), []);
|
|
86
|
+
|
|
87
|
+
function run(next: string) {
|
|
88
|
+
const id = ++latest.current;
|
|
89
|
+
if (next.trim() === '') {
|
|
90
|
+
setStatus('idle');
|
|
91
|
+
setGroups([]);
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
setStatus('loading');
|
|
95
|
+
// An older request's timer is cleared, so only one is ever pending and unmount clears it
|
|
96
|
+
searchPages(next, (t) => {
|
|
97
|
+
clearTimeout(timer.current);
|
|
98
|
+
timer.current = t;
|
|
99
|
+
})
|
|
100
|
+
.then((found) => {
|
|
101
|
+
// A reply for an older query is dropped
|
|
102
|
+
if (id !== latest.current) return;
|
|
103
|
+
setGroups(found);
|
|
104
|
+
setStatus('done');
|
|
105
|
+
})
|
|
106
|
+
.catch(() => {
|
|
107
|
+
if (id !== latest.current) return;
|
|
108
|
+
setStatus('error');
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function change(next: string) {
|
|
113
|
+
setQuery(next);
|
|
114
|
+
run(next);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function show() {
|
|
118
|
+
setQuery('');
|
|
119
|
+
run('');
|
|
120
|
+
setOpen(true);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// Cmd+K, or Ctrl+K on Windows, from anywhere on the page except a text field
|
|
124
|
+
useHotkey('k', () => {
|
|
125
|
+
if (!open) show();
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
return (
|
|
129
|
+
<>
|
|
130
|
+
{/* The Search Button is the main action of the bar, so it stays beside the brand at every width. */}
|
|
131
|
+
<SiteHeader
|
|
132
|
+
brand={{ href: '#top', name: 'Acme' }}
|
|
133
|
+
links={[
|
|
134
|
+
{ label: 'Guides', href: '#guides' },
|
|
135
|
+
{ label: 'Components', href: '#components', current: true },
|
|
136
|
+
{ label: 'Cases', href: '#cases' },
|
|
137
|
+
]}
|
|
138
|
+
phoneAction={
|
|
139
|
+
<Button
|
|
140
|
+
size="medium"
|
|
141
|
+
type="secondary"
|
|
142
|
+
state="enabled"
|
|
143
|
+
label="Search"
|
|
144
|
+
decoIcon="Search"
|
|
145
|
+
aria-haspopup="dialog"
|
|
146
|
+
aria-keyshortcuts="Meta+K Control+K"
|
|
147
|
+
onClickButton={show}
|
|
148
|
+
/>
|
|
149
|
+
}
|
|
150
|
+
mainId="site-search-main"
|
|
151
|
+
/>
|
|
152
|
+
<PageShell id="site-search-main" tabIndex={-1}>
|
|
153
|
+
<Stack gap="large">
|
|
154
|
+
<Heading level={1} size="h5">Components</Heading>
|
|
155
|
+
<Paragraph tone="secondary" measure="none">Press Cmd+K, or Ctrl+K on Windows, to search every page.</Paragraph>
|
|
156
|
+
</Stack>
|
|
157
|
+
</PageShell>
|
|
158
|
+
<SearchDialog
|
|
159
|
+
isOpen={open}
|
|
160
|
+
onClose={() => setOpen(false)}
|
|
161
|
+
query={query}
|
|
162
|
+
onQueryChange={change}
|
|
163
|
+
groups={groups}
|
|
164
|
+
status={status}
|
|
165
|
+
onRetry={() => run(query)}
|
|
166
|
+
recent={recent}
|
|
167
|
+
placeholder="Search components and cases"
|
|
168
|
+
/>
|
|
169
|
+
</>
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
## Native
|
|
175
|
+
|
|
176
|
+
On Apple use `searchable` on a `NavigationStack`, with `searchSuggestions` for recent places and `searchScopes` for the groups. On Android use a `SearchBar` with a `DockedSearchBar` or a full-screen search view.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function TabbedPanelsTabs(): import("react").JSX.Element;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import PageShell from '../../components/pageShell';
|
|
4
|
+
import SectionIntro from '../../components/sectionIntro';
|
|
5
|
+
import TabsContainer from '../../components/tabsContainer';
|
|
6
|
+
import Tab from '../../components/tab';
|
|
7
|
+
import TabPanel from '../../components/tabPanel';
|
|
8
|
+
import Heading from '../../components/heading';
|
|
9
|
+
import Paragraph from '../../components/paragraph';
|
|
10
|
+
import List from '../../components/list';
|
|
11
|
+
import { PageSection, Stack } from '../../components/layout';
|
|
12
|
+
// Four views of one thing, and a visitor reads one. The first is the one most visitors need.
|
|
13
|
+
var views = [
|
|
14
|
+
{ id: 'channels', label: 'Channels', title: 'One place for each subject', line: 'A channel holds the talk about one team or project.', points: ['Everyone in a channel sees every message.', 'Pin the messages people need again.', 'Turn a message into a task when it needs an owner.'] },
|
|
15
|
+
{ id: 'tasks', label: 'Tasks', title: 'A task and its talk together', line: 'A task keeps its owner, its status and its talk together.', points: ['Give a task one owner and one due date.', 'Reply in the task, not in the channel.', 'Close the task when the work is done.'] },
|
|
16
|
+
{ id: 'notes', label: 'Notes', title: 'Notes the whole team can search', line: 'Write a decision once and find it later.', points: ['Link a note to the task it came from.', 'Search every note from one box.', 'Export a note to PDF on Pro and Business.'] },
|
|
17
|
+
{ id: 'agent', label: 'Agent', title: 'Answers with their sources', line: 'Ask the agent a question in any channel or task.', points: ['It says which notes and messages it used.', 'It never reads a channel you are not in.', 'Each reply counts as one AI agent response.'] },
|
|
18
|
+
];
|
|
19
|
+
export default function TabbedPanelsTabs() {
|
|
20
|
+
var _a = useState('channels'), selected = _a[0], setSelected = _a[1];
|
|
21
|
+
return (<PageShell>
|
|
22
|
+
<PageSection gap="xxlarge">
|
|
23
|
+
<SectionIntro id="how-it-works" name="How it works" statement="Four parts, each for one kind of work."/>
|
|
24
|
+
<Stack gap="xlarge">
|
|
25
|
+
{/* Title Case, one short word each. The tablist is named by the section's heading, and each Tab controls its panel. */}
|
|
26
|
+
<TabsContainer aria-labelledby="how-it-works">
|
|
27
|
+
{views.map(function (v) { return (<Tab key={v.id} id={"tabbed-panels-tab-".concat(v.id)} controls={"tabbed-panels-panel-".concat(v.id)} size="small" label={v.label} isSelected={v.id === selected} onClickTab={function () { return setSelected(v.id); }}/>); })}
|
|
28
|
+
</TabsContainer>
|
|
29
|
+
{/* Every panel is in the page. Only the selected one shows. */}
|
|
30
|
+
{views.map(function (v) { return (<TabPanel key={v.id} id={"tabbed-panels-panel-".concat(v.id)} labelledBy={"tabbed-panels-tab-".concat(v.id)} selected={v.id === selected}>
|
|
31
|
+
<Stack gap="medium">
|
|
32
|
+
<Heading level={3} size="h5">{v.title}</Heading>
|
|
33
|
+
<Paragraph tone="secondary" measure="none">{v.line}</Paragraph>
|
|
34
|
+
<List items={v.points} marker="dot"/>
|
|
35
|
+
</Stack>
|
|
36
|
+
</TabPanel>); })}
|
|
37
|
+
</Stack>
|
|
38
|
+
</PageSection>
|
|
39
|
+
</PageShell>);
|
|
40
|
+
}
|