oneslash-design-system 2.17.0 → 2.19.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 +2 -2
- package/dist/DESIGN.md +55 -14
- package/dist/cases/accept-invite.md +1 -5
- package/dist/cases/account-menu/menu.d.ts +1 -0
- package/dist/cases/account-menu/menu.jsx +99 -0
- package/dist/cases/account-menu.md +164 -0
- package/dist/cases/agent-asks-before-risky-action.md +0 -4
- package/dist/cases/agent-cancels-when-unanswered.md +0 -4
- package/dist/cases/agent-options.md +0 -4
- package/dist/cases/agent-pending-reply.md +0 -4
- package/dist/cases/agent-plan-proposal.md +0 -4
- package/dist/cases/agent-question.md +0 -4
- package/dist/cases/agent-refuses-clearly.md +0 -4
- package/dist/cases/agent-says-what-it-is.md +0 -2
- package/dist/cases/agent-settings/form.d.ts +1 -0
- package/dist/cases/agent-settings/form.jsx +164 -0
- package/dist/cases/agent-settings.md +259 -0
- package/dist/cases/agent-shows-progress.md +0 -2
- package/dist/cases/agent-shows-sources.md +0 -2
- package/dist/cases/api-keys/list.d.ts +1 -0
- package/dist/cases/api-keys/list.jsx +162 -0
- package/dist/cases/api-keys.md +229 -0
- package/dist/cases/app-shell/sidebar.d.ts +1 -0
- package/dist/cases/app-shell/sidebar.jsx +124 -0
- package/dist/cases/app-shell/top-tabs.d.ts +1 -0
- package/dist/cases/app-shell/top-tabs.jsx +106 -0
- package/dist/cases/app-shell.md +364 -0
- package/dist/cases/artifact-card/card.jsx +32 -6
- package/dist/cases/artifact-card.md +55 -11
- package/dist/cases/auth-gate-loading.md +0 -4
- package/dist/cases/check-your-email.md +0 -4
- package/dist/cases/collapsible-search/popover.d.ts +1 -0
- package/dist/cases/collapsible-search/popover.jsx +74 -0
- package/dist/cases/collapsible-search.md +143 -0
- package/dist/cases/composer-limit.md +0 -4
- package/dist/cases/confirm-destructive-action.md +0 -4
- package/dist/cases/confirm-dialogs.md +0 -4
- package/dist/cases/conversation-starters.md +0 -4
- package/dist/cases/create-modal.md +0 -4
- package/dist/cases/danger-zone/collapsed.d.ts +1 -0
- package/dist/cases/danger-zone/collapsed.jsx +75 -0
- package/dist/cases/danger-zone/shown.d.ts +1 -0
- package/dist/cases/danger-zone/shown.jsx +95 -0
- package/dist/cases/danger-zone.md +263 -0
- package/dist/cases/device-login.md +0 -4
- package/dist/cases/email-confirmed.md +0 -4
- package/dist/cases/empty-list.md +0 -4
- package/dist/cases/empty-lists.md +0 -4
- package/dist/cases/empty-not-set-up.md +0 -4
- package/dist/cases/empty-search.md +0 -4
- package/dist/cases/error-page/in-shell.jsx +26 -17
- package/dist/cases/error-page.md +42 -25
- package/dist/cases/feedback-form.md +0 -4
- package/dist/cases/filter-menu/presets.d.ts +1 -0
- package/dist/cases/filter-menu/presets.jsx +53 -0
- package/dist/cases/filter-menu/with-clear.d.ts +1 -0
- package/dist/cases/filter-menu/with-clear.jsx +56 -0
- package/dist/cases/filter-menu.md +204 -0
- package/dist/cases/forgot-password.md +0 -4
- package/dist/cases/form-errors.md +0 -4
- package/dist/cases/import-checklist.md +0 -4
- package/dist/cases/inline-form-feedback.md +0 -4
- package/dist/cases/integrations-list/nested.d.ts +1 -0
- package/dist/cases/integrations-list/nested.jsx +164 -0
- package/dist/cases/integrations-list/rows.d.ts +1 -0
- package/dist/cases/integrations-list/rows.jsx +134 -0
- package/dist/cases/integrations-list.md +379 -0
- package/dist/cases/invite-member.md +0 -4
- package/dist/cases/load-failure.md +0 -4
- package/dist/cases/log-out-confirm.md +0 -4
- package/dist/cases/login-page.md +0 -4
- package/dist/cases/master-detail/list-then-page.d.ts +1 -0
- package/dist/cases/master-detail/list-then-page.jsx +65 -0
- package/dist/cases/master-detail/split.d.ts +1 -0
- package/dist/cases/master-detail/split.jsx +49 -0
- package/dist/cases/master-detail.md +213 -0
- package/dist/cases/members-list/rows.d.ts +1 -0
- package/dist/cases/members-list/rows.jsx +318 -0
- package/dist/cases/members-list/table.d.ts +1 -0
- package/dist/cases/members-list/table.jsx +351 -0
- package/dist/cases/members-list.md +799 -0
- package/dist/cases/mention-list.md +0 -4
- package/dist/cases/message-actions.md +0 -4
- package/dist/cases/message-attachments.md +0 -4
- package/dist/cases/message-composer.md +0 -4
- package/dist/cases/message-edit.md +0 -4
- package/dist/cases/message-reactions.md +0 -4
- package/dist/cases/message-row.md +0 -4
- package/dist/cases/mobile-menu/links.d.ts +1 -0
- package/dist/cases/mobile-menu/links.jsx +24 -0
- package/dist/cases/mobile-menu/sections.d.ts +1 -0
- package/dist/cases/mobile-menu/sections.jsx +61 -0
- package/dist/cases/mobile-menu.md +170 -0
- package/dist/cases/not-found-page/in-shell.jsx +26 -17
- package/dist/cases/not-found-page.md +41 -24
- package/dist/cases/notification-menu/menu.d.ts +1 -0
- package/dist/cases/notification-menu/menu.jsx +74 -0
- package/dist/cases/notification-menu.md +135 -0
- package/dist/cases/oauth-consent.md +0 -4
- package/dist/cases/on-off-settings/list.d.ts +1 -0
- package/dist/cases/on-off-settings/list.jsx +97 -0
- package/dist/cases/on-off-settings.md +116 -0
- package/dist/cases/on-this-page/aside.d.ts +1 -0
- package/dist/cases/on-this-page/aside.jsx +39 -0
- package/dist/cases/on-this-page.md +80 -0
- package/dist/cases/overflow-menu/in-a-header.d.ts +1 -0
- package/dist/cases/overflow-menu/in-a-header.jsx +128 -0
- package/dist/cases/overflow-menu/on-a-row.d.ts +1 -0
- package/dist/cases/overflow-menu/on-a-row.jsx +183 -0
- package/dist/cases/overflow-menu.md +410 -0
- package/dist/cases/page-header/actions.d.ts +1 -0
- package/dist/cases/page-header/actions.jsx +65 -0
- package/dist/cases/page-header/sub-page.d.ts +1 -0
- package/dist/cases/page-header/sub-page.jsx +37 -0
- package/dist/cases/page-header.md +195 -0
- package/dist/cases/phone-navigation.md +32 -0
- package/dist/cases/profile-form/form.d.ts +1 -0
- package/dist/cases/profile-form/form.jsx +153 -0
- package/dist/cases/profile-form.md +236 -0
- package/dist/cases/quick-switcher/modal.d.ts +1 -0
- package/dist/cases/quick-switcher/modal.jsx +114 -0
- package/dist/cases/quick-switcher.md +205 -0
- package/dist/cases/range-switch/segmented.d.ts +1 -0
- package/dist/cases/range-switch/segmented.jsx +30 -0
- package/dist/cases/range-switch.md +67 -0
- package/dist/cases/rename.md +0 -4
- package/dist/cases/reply-feedback.md +0 -4
- package/dist/cases/reply-sources.md +0 -4
- package/dist/cases/route-loading/region.jsx +27 -18
- package/dist/cases/route-loading.md +42 -23
- package/dist/cases/scope-picker/menu.d.ts +1 -0
- package/dist/cases/scope-picker/menu.jsx +47 -0
- package/dist/cases/scope-picker.md +97 -0
- package/dist/cases/set-new-password.md +0 -4
- package/dist/cases/settings-page/side-nav.d.ts +1 -0
- package/dist/cases/settings-page/side-nav.jsx +171 -0
- package/dist/cases/settings-page/top-tabs.d.ts +1 -0
- package/dist/cases/settings-page/top-tabs.jsx +129 -0
- package/dist/cases/settings-page.md +378 -0
- package/dist/cases/settings-save.md +35 -0
- package/dist/cases/side-pane/beside.d.ts +1 -0
- package/dist/cases/side-pane/beside.jsx +79 -0
- package/dist/cases/side-pane/over.d.ts +1 -0
- package/dist/cases/side-pane/over.jsx +58 -0
- package/dist/cases/side-pane.md +238 -0
- package/dist/cases/sidebar-nav/flat.d.ts +1 -0
- package/dist/cases/sidebar-nav/flat.jsx +81 -0
- package/dist/cases/sidebar-nav/nested.d.ts +1 -0
- package/dist/cases/sidebar-nav/nested.jsx +122 -0
- package/dist/cases/sidebar-nav.md +261 -0
- package/dist/cases/sign-up-page.md +1 -5
- package/dist/cases/site-footer/columns.d.ts +1 -0
- package/dist/cases/site-footer/columns.jsx +51 -0
- package/dist/cases/site-footer/simple.d.ts +1 -0
- package/dist/cases/site-footer/simple.jsx +24 -0
- package/dist/cases/site-footer.md +133 -0
- package/dist/cases/site-header/links.d.ts +1 -0
- package/dist/cases/site-header/links.jsx +26 -0
- package/dist/cases/site-header/sections.d.ts +1 -0
- package/dist/cases/site-header/sections.jsx +64 -0
- package/dist/cases/site-header.md +183 -0
- package/dist/cases/slash-command-list.md +0 -4
- package/dist/cases/success-feedback.md +0 -4
- package/dist/cases/tag-filter/tags.d.ts +1 -0
- package/dist/cases/tag-filter/tags.jsx +226 -0
- package/dist/cases/tag-filter.md +298 -0
- package/dist/cases/theme-switcher/menu.d.ts +1 -0
- package/dist/cases/theme-switcher/menu.jsx +47 -0
- package/dist/cases/theme-switcher/segmented.d.ts +1 -0
- package/dist/cases/theme-switcher/segmented.jsx +26 -0
- package/dist/cases/theme-switcher.md +149 -0
- package/dist/cases/type-to-confirm.md +0 -4
- package/dist/cases/typing-and-status.md +0 -4
- package/dist/cases/unsaved-changes-guard.md +0 -4
- package/dist/cases/upgrade-prompt.md +0 -4
- package/dist/cases.json +1737 -315
- package/dist/components/alert.d.ts +3 -1
- package/dist/components/alert.jsx +2 -2
- package/dist/components/appShell.d.ts +44 -0
- package/dist/components/appShell.jsx +121 -0
- package/dist/components/button.jsx +5 -2
- package/dist/components/checkBox.d.ts +5 -1
- package/dist/components/checkBox.jsx +2 -2
- package/dist/components/copyField.d.ts +20 -0
- package/dist/components/copyField.jsx +99 -0
- package/dist/components/drawer.d.ts +31 -0
- package/dist/components/drawer.jsx +121 -0
- package/dist/components/formField.d.ts +34 -0
- package/dist/components/formField.jsx +28 -0
- package/dist/components/heading.d.ts +5 -1
- package/dist/components/heading.jsx +2 -2
- package/dist/components/link.d.ts +6 -1
- package/dist/components/link.jsx +11 -3
- package/dist/components/menu.jsx +2 -2
- package/dist/components/menuItem.d.ts +10 -2
- package/dist/components/menuItem.jsx +4 -3
- package/dist/components/modal.jsx +12 -23
- package/dist/components/navigation.d.ts +9 -1
- package/dist/components/navigation.jsx +15 -3
- package/dist/components/onThisPage.d.ts +29 -0
- package/dist/components/onThisPage.jsx +151 -0
- package/dist/components/pageShell.d.ts +7 -1
- package/dist/components/pageShell.jsx +14 -1
- package/dist/components/popover.jsx +4 -0
- package/dist/components/radioGroup.d.ts +5 -1
- package/dist/components/radioGroup.jsx +2 -2
- package/dist/components/segmentedControl.d.ts +22 -0
- package/dist/components/segmentedControl.jsx +54 -0
- package/dist/components/select.d.ts +5 -1
- package/dist/components/select.jsx +2 -2
- package/dist/components/settingsSection.d.ts +36 -0
- package/dist/components/settingsSection.jsx +65 -0
- package/dist/components/sidePane.d.ts +32 -0
- package/dist/components/sidePane.jsx +128 -0
- package/dist/components/siteFooter.d.ts +24 -0
- package/dist/components/siteFooter.jsx +48 -0
- package/dist/components/siteHeader.d.ts +55 -0
- package/dist/components/siteHeader.jsx +125 -0
- package/dist/components/slidingIndicator.d.ts +50 -0
- package/dist/components/slidingIndicator.jsx +102 -0
- package/dist/components/switch.d.ts +25 -0
- package/dist/components/switch.jsx +55 -0
- package/dist/components/tab.jsx +5 -11
- package/dist/components/tabsContainer.jsx +5 -67
- package/dist/components/textField.d.ts +12 -2
- package/dist/components/textField.jsx +11 -4
- package/dist/components/textarea.d.ts +5 -1
- package/dist/components/textarea.jsx +3 -3
- package/dist/components/titleBar.d.ts +17 -0
- package/dist/components/titleBar.jsx +17 -0
- package/dist/components/useHotkey.d.ts +7 -0
- package/dist/components/useHotkey.js +24 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +13 -0
- package/dist/internal/copyField.d.ts +5 -0
- package/dist/internal/copyField.js +61 -0
- package/dist/internal/hotkey.d.ts +16 -0
- package/dist/internal/hotkey.js +20 -0
- package/dist/internal/overlayStack.d.ts +24 -0
- package/dist/internal/overlayStack.js +71 -0
- package/dist/internal/resize.d.ts +9 -0
- package/dist/internal/resize.js +31 -0
- package/dist/internal/scrollSpy.d.ts +24 -0
- package/dist/internal/scrollSpy.js +53 -0
- package/dist/internal/siteBrand.d.ts +6 -0
- package/dist/internal/siteBrand.jsx +11 -0
- package/dist/internal/switch.d.ts +5 -0
- package/dist/internal/switch.js +9 -0
- package/dist/native-mapping.json +72 -0
- package/dist/stories/AppShell.stories.d.ts +15 -0
- package/dist/stories/AppShell.stories.jsx +137 -0
- package/dist/stories/Cases.generated.stories.d.ts +42 -0
- package/dist/stories/Cases.generated.stories.jsx +84 -0
- package/dist/stories/CopyField.stories.d.ts +11 -0
- package/dist/stories/CopyField.stories.jsx +65 -0
- package/dist/stories/Drawer.stories.d.ts +10 -0
- package/dist/stories/Drawer.stories.jsx +123 -0
- package/dist/stories/FormField.stories.d.ts +6 -0
- package/dist/stories/FormField.stories.jsx +44 -0
- package/dist/stories/Link.stories.d.ts +1 -0
- package/dist/stories/Link.stories.jsx +8 -0
- package/dist/stories/Navigation.stories.d.ts +1 -0
- package/dist/stories/Navigation.stories.jsx +17 -1
- package/dist/stories/OnThisPage.stories.d.ts +10 -0
- package/dist/stories/OnThisPage.stories.jsx +105 -0
- package/dist/stories/SegmentedControl.stories.d.ts +8 -0
- package/dist/stories/SegmentedControl.stories.jsx +33 -0
- package/dist/stories/SettingsSection.stories.d.ts +12 -0
- package/dist/stories/SettingsSection.stories.jsx +91 -0
- package/dist/stories/SidePane.stories.d.ts +6 -0
- package/dist/stories/SidePane.stories.jsx +37 -0
- package/dist/stories/SiteFooter.stories.d.ts +7 -0
- package/dist/stories/SiteFooter.stories.jsx +63 -0
- package/dist/stories/SiteHeader.stories.d.ts +10 -0
- package/dist/stories/SiteHeader.stories.jsx +94 -0
- package/dist/stories/Switch.stories.d.ts +14 -0
- package/dist/stories/Switch.stories.jsx +87 -0
- package/dist/stories/TextField.stories.d.ts +1 -0
- package/dist/stories/TextField.stories.jsx +13 -0
- package/dist/stories/TitleBar.stories.d.ts +6 -0
- package/dist/stories/TitleBar.stories.jsx +34 -0
- package/package.json +5 -1
|
@@ -0,0 +1,379 @@
|
|
|
1
|
+
# Integrations
|
|
2
|
+
|
|
3
|
+
A person connects the product to other tools, sees which ones are connected and disconnects them.
|
|
4
|
+
|
|
5
|
+
## Do
|
|
6
|
+
|
|
7
|
+
- Show each provider in a row: its logo, its name and one line on what connecting does: 'Link pull requests to tasks and close tasks when they merge.'
|
|
8
|
+
- Use `BrandIcon` for a logo it has, and a Lucide icon in `Icon` for the others. Both are decorative, because the name sits beside them.
|
|
9
|
+
- Show 'Connect' on a provider that is not connected, and its account beside 'Disconnect' once it is. Name the provider in each `aria-label`: 'Connect Slack'.
|
|
10
|
+
- Show a `Tag` with `color="warning"` that reads 'Needs attention', and a primary 'Reconnect', on a connection whose access ran out. Say in the line what is wrong.
|
|
11
|
+
- Confirm 'Disconnect' in a small Modal, as the rule 'A confirm says exactly what will happen' says, because what it stops does not come back by itself. Title it with the verb and the thing: 'Disconnect Slack', or 'Disconnect acme-labs' for one account. Say what stops and that the person can connect again.
|
|
12
|
+
- Show `loading` on 'Connect' and 'Reconnect' while the sign-in runs, and keep the label. Disable the other Buttons until it ends.
|
|
13
|
+
- Group the accounts under their provider, with 'Add Account' on the provider's row, for a provider that holds several. Each account has its own 'Reconnect' and 'Disconnect'.
|
|
14
|
+
- Name the account in each account's `aria-label`: 'Disconnect acme-labs'. Disconnecting one account leaves the others connected.
|
|
15
|
+
- Show a connection the person cannot change as read-only, with one line that says who can: 'Only admins can change this.'
|
|
16
|
+
|
|
17
|
+
## Don't
|
|
18
|
+
|
|
19
|
+
- Do not use an icon-only Button for Disconnect. It names no provider.
|
|
20
|
+
- Do not label a running Button 'Connecting…'. It keeps its label and shows `loading`.
|
|
21
|
+
- Do not disconnect on the first click.
|
|
22
|
+
- Do not show red text as the only sign that access ran out. Add the 'Needs attention' Tag and a 'Reconnect' Button.
|
|
23
|
+
- Do not give each provider its own page section with a heading and no logo. Put them in one list.
|
|
24
|
+
|
|
25
|
+
## Option: One row per provider
|
|
26
|
+
|
|
27
|
+
Use when: A few providers, and each one holds a single account.
|
|
28
|
+
|
|
29
|
+
Uses: `BrandIcon`, `Button`, `Center`, `Cluster`, `Heading`, `Icon`, `Modal`, `Paragraph`, `Stack`, `TableCell`, `TableContainer`, `TableRow`, `Tag`
|
|
30
|
+
|
|
31
|
+
```tsx
|
|
32
|
+
'use client';
|
|
33
|
+
import { useEffect, useRef, useState } from 'react';
|
|
34
|
+
import { Figma, Slack } from 'lucide-react';
|
|
35
|
+
import Modal from 'oneslash-design-system/components/modal';
|
|
36
|
+
import Heading from 'oneslash-design-system/components/heading';
|
|
37
|
+
import Paragraph from 'oneslash-design-system/components/paragraph';
|
|
38
|
+
import TableContainer from 'oneslash-design-system/components/tableContainer';
|
|
39
|
+
import TableRow from 'oneslash-design-system/components/tableRow';
|
|
40
|
+
import TableCell from 'oneslash-design-system/components/tableCell';
|
|
41
|
+
import BrandIcon from 'oneslash-design-system/components/brandIcon';
|
|
42
|
+
import Icon from 'oneslash-design-system/components/icon';
|
|
43
|
+
import Tag from 'oneslash-design-system/components/tag';
|
|
44
|
+
import Button from 'oneslash-design-system/components/button';
|
|
45
|
+
import { Center, Cluster, Stack } from 'oneslash-design-system/components/layout';
|
|
46
|
+
|
|
47
|
+
type Provider = {
|
|
48
|
+
id: string;
|
|
49
|
+
name: string;
|
|
50
|
+
/** One line on what connecting does. */
|
|
51
|
+
does: string;
|
|
52
|
+
/** What stops when it is disconnected, for the confirm. */
|
|
53
|
+
stops: string;
|
|
54
|
+
/** The account a person connects as, once connected. */
|
|
55
|
+
account: string;
|
|
56
|
+
brand?: 'google' | 'github';
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const providers: Provider[] = [
|
|
60
|
+
{ id: 'slack', name: 'Slack', does: 'Post the weekly digest and link previews in your channels.', stops: 'The weekly digest and link previews stop.', account: 'Acme workspace' },
|
|
61
|
+
{ id: 'github', name: 'GitHub', does: 'Link pull requests to tasks and close tasks when they merge.', stops: 'Pull requests stop linking to tasks.', account: 'acme', brand: 'github' },
|
|
62
|
+
{ id: 'google', name: 'Google Calendar', does: 'Show your calendar events beside your tasks.', stops: 'Calendar events stop showing beside tasks.', account: 'dana@acme.example', brand: 'google' },
|
|
63
|
+
{ id: 'figma', name: 'Figma', does: 'Show a preview when someone pastes a Figma link.', stops: 'Figma links stop showing a preview.', account: 'Acme team' },
|
|
64
|
+
];
|
|
65
|
+
|
|
66
|
+
function renderLogo(p: Provider) {
|
|
67
|
+
if (p.brand) return <BrandIcon name={p.brand} size={24} />;
|
|
68
|
+
return <Icon icon={p.id === 'slack' ? Slack : Figma} size="medium" color="secondary" />;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export default function IntegrationsListRows() {
|
|
72
|
+
// Opens with GitHub needing attention, as if its access ran out.
|
|
73
|
+
const [connected, setConnected] = useState<Record<string, boolean>>({ github: true, google: true });
|
|
74
|
+
const [needsAttention, setNeedsAttention] = useState<Record<string, boolean>>({ github: true });
|
|
75
|
+
const [working, setWorking] = useState<string | null>(null);
|
|
76
|
+
const [confirming, setConfirming] = useState<Provider | null>(null);
|
|
77
|
+
const timers = useRef<ReturnType<typeof setTimeout>[]>([]);
|
|
78
|
+
|
|
79
|
+
// Stops every request if the example goes away before they end.
|
|
80
|
+
useEffect(() => () => timers.current.forEach(clearTimeout), []);
|
|
81
|
+
|
|
82
|
+
// Stands in for the sign-in a provider asks for, and the request that follows.
|
|
83
|
+
function later(callback: () => void, ms: number) {
|
|
84
|
+
timers.current.push(setTimeout(callback, ms));
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function handleConnect(p: Provider) {
|
|
88
|
+
if (working) return;
|
|
89
|
+
setWorking(p.id);
|
|
90
|
+
later(() => {
|
|
91
|
+
setWorking(null);
|
|
92
|
+
setConnected((current) => ({ ...current, [p.id]: true }));
|
|
93
|
+
setNeedsAttention((current) => ({ ...current, [p.id]: false }));
|
|
94
|
+
}, 1200);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// Escape, a click outside and Cancel all close it, except while the request runs.
|
|
98
|
+
function handleClose() {
|
|
99
|
+
if (working) return;
|
|
100
|
+
setConfirming(null);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function handleDisconnect(p: Provider) {
|
|
104
|
+
if (working) return;
|
|
105
|
+
setWorking(p.id);
|
|
106
|
+
later(() => {
|
|
107
|
+
setWorking(null);
|
|
108
|
+
setConfirming(null);
|
|
109
|
+
setConnected((current) => ({ ...current, [p.id]: false }));
|
|
110
|
+
setNeedsAttention((current) => ({ ...current, [p.id]: false }));
|
|
111
|
+
}, 1200);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return (
|
|
115
|
+
<Center width="page">
|
|
116
|
+
<Stack gap="large">
|
|
117
|
+
<Stack gap="small">
|
|
118
|
+
<Heading level={1} size="h5">Integrations</Heading>
|
|
119
|
+
<Paragraph tone="secondary" size="body2" measure="none">Connect the tools your team already uses.</Paragraph>
|
|
120
|
+
</Stack>
|
|
121
|
+
<TableContainer>
|
|
122
|
+
{providers.map((p) => {
|
|
123
|
+
const isConnected = Boolean(connected[p.id]);
|
|
124
|
+
const attention = isConnected && Boolean(needsAttention[p.id]);
|
|
125
|
+
const busy = working === p.id;
|
|
126
|
+
return (
|
|
127
|
+
<TableRow key={p.id}>
|
|
128
|
+
<TableCell width="56px">{renderLogo(p)}</TableCell>
|
|
129
|
+
<TableCell>
|
|
130
|
+
<Stack gap="small">
|
|
131
|
+
<Cluster gap="small">
|
|
132
|
+
<Heading level={2} size="subtitle1">{p.name}</Heading>
|
|
133
|
+
{attention && <Tag variant="contained" size="small" color="warning" label="Needs attention" />}
|
|
134
|
+
</Cluster>
|
|
135
|
+
<Paragraph tone="secondary" size="body2" measure="none">
|
|
136
|
+
{attention ? 'Access ran out. Reconnect to keep it working.' : p.does}
|
|
137
|
+
</Paragraph>
|
|
138
|
+
</Stack>
|
|
139
|
+
</TableCell>
|
|
140
|
+
{/* A fixed last column keeps every row's Buttons in one place, so they do not jump when they change. */}
|
|
141
|
+
<TableCell width="340px">
|
|
142
|
+
{isConnected ? (
|
|
143
|
+
<Cluster gap="small" justify="end">
|
|
144
|
+
<Paragraph size="body2" measure="none">{p.account}</Paragraph>
|
|
145
|
+
{attention && <Button size="small" type="primary" state={working && !busy ? 'disabled' : 'enabled'} label="Reconnect" aria-label={`Reconnect ${p.name}`} loading={busy} onClickButton={() => handleConnect(p)} />}
|
|
146
|
+
<Button size="small" type="tertiary" state={working ? 'disabled' : 'enabled'} label="Disconnect" aria-label={`Disconnect ${p.name}`} onClickButton={() => setConfirming(p)} />
|
|
147
|
+
</Cluster>
|
|
148
|
+
) : (
|
|
149
|
+
<Cluster gap="small" justify="end">
|
|
150
|
+
<Button size="small" type="secondary" state={working && !busy ? 'disabled' : 'enabled'} label="Connect" aria-label={`Connect ${p.name}`} loading={busy} onClickButton={() => handleConnect(p)} />
|
|
151
|
+
</Cluster>
|
|
152
|
+
)}
|
|
153
|
+
</TableCell>
|
|
154
|
+
</TableRow>
|
|
155
|
+
);
|
|
156
|
+
})}
|
|
157
|
+
</TableContainer>
|
|
158
|
+
</Stack>
|
|
159
|
+
<Modal
|
|
160
|
+
isOpen={confirming !== null}
|
|
161
|
+
size="small"
|
|
162
|
+
title={confirming ? `Disconnect ${confirming.name}` : 'Disconnect'}
|
|
163
|
+
onClose={handleClose}
|
|
164
|
+
actions={
|
|
165
|
+
<>
|
|
166
|
+
<Button size="small" type="tertiary" state={working ? 'disabled' : 'enabled'} label="Cancel" onClickButton={handleClose} />
|
|
167
|
+
<Button size="small" type="primary" color="danger" state="enabled" label="Disconnect" loading={Boolean(working)} onClickButton={() => confirming && handleDisconnect(confirming)} />
|
|
168
|
+
</>
|
|
169
|
+
}
|
|
170
|
+
>
|
|
171
|
+
{confirming && (
|
|
172
|
+
<Paragraph measure="none">{confirming.stops} You can connect {confirming.name} again any time.</Paragraph>
|
|
173
|
+
)}
|
|
174
|
+
</Modal>
|
|
175
|
+
</Center>
|
|
176
|
+
);
|
|
177
|
+
}
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
## Option: Accounts under each provider
|
|
181
|
+
|
|
182
|
+
Use when: A provider can hold several accounts or teams, such as the organizations of one GitHub login.
|
|
183
|
+
|
|
184
|
+
Uses: `BrandIcon`, `Button`, `Center`, `Cluster`, `Heading`, `Icon`, `Modal`, `Paragraph`, `Stack`, `TableCell`, `TableContainer`, `TableRow`, `Tag`
|
|
185
|
+
|
|
186
|
+
```tsx
|
|
187
|
+
'use client';
|
|
188
|
+
import { Fragment, useEffect, useRef, useState } from 'react';
|
|
189
|
+
import { Slack } from 'lucide-react';
|
|
190
|
+
import Modal from 'oneslash-design-system/components/modal';
|
|
191
|
+
import Heading from 'oneslash-design-system/components/heading';
|
|
192
|
+
import Paragraph from 'oneslash-design-system/components/paragraph';
|
|
193
|
+
import TableContainer from 'oneslash-design-system/components/tableContainer';
|
|
194
|
+
import TableRow from 'oneslash-design-system/components/tableRow';
|
|
195
|
+
import TableCell from 'oneslash-design-system/components/tableCell';
|
|
196
|
+
import BrandIcon from 'oneslash-design-system/components/brandIcon';
|
|
197
|
+
import Icon from 'oneslash-design-system/components/icon';
|
|
198
|
+
import Tag from 'oneslash-design-system/components/tag';
|
|
199
|
+
import Button from 'oneslash-design-system/components/button';
|
|
200
|
+
import { Center, Cluster, Stack } from 'oneslash-design-system/components/layout';
|
|
201
|
+
|
|
202
|
+
type Account = { id: string; name: string; detail: string; attention?: boolean };
|
|
203
|
+
type Provider = {
|
|
204
|
+
id: string;
|
|
205
|
+
name: string;
|
|
206
|
+
/** One line on what connecting does. */
|
|
207
|
+
does: string;
|
|
208
|
+
/** What stops when one account is disconnected, for the confirm. */
|
|
209
|
+
stops: string;
|
|
210
|
+
brand?: 'github';
|
|
211
|
+
accounts: Account[];
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
const firstProviders: Provider[] = [
|
|
215
|
+
{
|
|
216
|
+
id: 'github',
|
|
217
|
+
name: 'GitHub',
|
|
218
|
+
does: 'Link pull requests to tasks and close tasks when they merge.',
|
|
219
|
+
stops: 'Pull requests from it stop linking to tasks.',
|
|
220
|
+
brand: 'github',
|
|
221
|
+
accounts: [
|
|
222
|
+
{ id: 'acme', name: 'acme', detail: 'Connected Oct 3 · 14 repositories' },
|
|
223
|
+
{ id: 'acme-labs', name: 'acme-labs', detail: 'Access ran out. Reconnect to keep it working.', attention: true },
|
|
224
|
+
],
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
id: 'slack',
|
|
228
|
+
name: 'Slack',
|
|
229
|
+
does: 'Post the weekly digest and link previews in your channels.',
|
|
230
|
+
stops: 'The digest and link previews stop in its channels.',
|
|
231
|
+
accounts: [],
|
|
232
|
+
},
|
|
233
|
+
];
|
|
234
|
+
|
|
235
|
+
export default function IntegrationsListNested() {
|
|
236
|
+
const [providers, setProviders] = useState(firstProviders);
|
|
237
|
+
// Which Button is working: it shows `loading`, and every other Button waits.
|
|
238
|
+
const [working, setWorking] = useState<string | null>(null);
|
|
239
|
+
const [confirming, setConfirming] = useState<{ provider: Provider; account: Account } | null>(null);
|
|
240
|
+
const timers = useRef<ReturnType<typeof setTimeout>[]>([]);
|
|
241
|
+
|
|
242
|
+
// Stops every request if the example goes away before they end.
|
|
243
|
+
useEffect(() => () => timers.current.forEach(clearTimeout), []);
|
|
244
|
+
|
|
245
|
+
// Stands in for the sign-in a provider asks for, and the request that follows.
|
|
246
|
+
function later(callback: () => void, ms: number) {
|
|
247
|
+
timers.current.push(setTimeout(callback, ms));
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
function update(providerId: string, change: (accounts: Account[]) => Account[]) {
|
|
251
|
+
setProviders((list) => list.map((p) => (p.id === providerId ? { ...p, accounts: change(p.accounts) } : p)));
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
// 'Connect' and 'Add Account' both start a sign-in, and the account that comes back joins its provider.
|
|
255
|
+
function handleAdd(p: Provider) {
|
|
256
|
+
if (working) return;
|
|
257
|
+
setWorking(`add-${p.id}`);
|
|
258
|
+
later(() => {
|
|
259
|
+
setWorking(null);
|
|
260
|
+
const next: Account = p.id === 'github'
|
|
261
|
+
? { id: 'acme-design', name: 'acme-design', detail: 'Connected today · 3 repositories' }
|
|
262
|
+
: { id: 'acme-slack', name: 'Acme', detail: 'Connected today · 6 channels' };
|
|
263
|
+
update(p.id, (accounts) => [...accounts, next]);
|
|
264
|
+
}, 1200);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
function handleReconnect(p: Provider, a: Account) {
|
|
268
|
+
if (working) return;
|
|
269
|
+
setWorking(`reconnect-${a.id}`);
|
|
270
|
+
later(() => {
|
|
271
|
+
setWorking(null);
|
|
272
|
+
update(p.id, (accounts) => accounts.map((x) => (x.id === a.id ? { ...x, detail: 'Connected today · 5 repositories', attention: false } : x)));
|
|
273
|
+
}, 1200);
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
// Escape, a click outside and Cancel all close it, except while the request runs.
|
|
277
|
+
function handleClose() {
|
|
278
|
+
if (working) return;
|
|
279
|
+
setConfirming(null);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
function handleDisconnect(p: Provider, a: Account) {
|
|
283
|
+
if (working) return;
|
|
284
|
+
setWorking(`remove-${a.id}`);
|
|
285
|
+
later(() => {
|
|
286
|
+
setWorking(null);
|
|
287
|
+
setConfirming(null);
|
|
288
|
+
update(p.id, (accounts) => accounts.filter((x) => x.id !== a.id));
|
|
289
|
+
}, 1200);
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
return (
|
|
293
|
+
<Center width="page">
|
|
294
|
+
<Stack gap="large">
|
|
295
|
+
<Stack gap="small">
|
|
296
|
+
<Heading level={1} size="h5">Integrations</Heading>
|
|
297
|
+
<Paragraph tone="secondary" size="body2" measure="none">A tool can hold several accounts. Each one connects and disconnects on its own.</Paragraph>
|
|
298
|
+
</Stack>
|
|
299
|
+
<TableContainer>
|
|
300
|
+
{providers.map((p) => (
|
|
301
|
+
<Fragment key={p.id}>
|
|
302
|
+
<TableRow>
|
|
303
|
+
<TableCell width="56px">
|
|
304
|
+
{p.brand ? <BrandIcon name={p.brand} size={24} /> : <Icon icon={Slack} size="medium" color="secondary" />}
|
|
305
|
+
</TableCell>
|
|
306
|
+
<TableCell>
|
|
307
|
+
<Stack gap="small">
|
|
308
|
+
<Heading level={2} size="subtitle1">{p.name}</Heading>
|
|
309
|
+
<Paragraph tone="secondary" size="body2" measure="none">{p.does}</Paragraph>
|
|
310
|
+
</Stack>
|
|
311
|
+
</TableCell>
|
|
312
|
+
{/* A fixed last column keeps every row's Buttons in one place, so they do not jump when they change. */}
|
|
313
|
+
<TableCell width="240px">
|
|
314
|
+
<Cluster justify="end">
|
|
315
|
+
<Button
|
|
316
|
+
size="small"
|
|
317
|
+
type="secondary"
|
|
318
|
+
state={working && working !== `add-${p.id}` ? 'disabled' : 'enabled'}
|
|
319
|
+
label={p.accounts.length === 0 ? 'Connect' : 'Add Account'}
|
|
320
|
+
aria-label={p.accounts.length === 0 ? `Connect ${p.name}` : `Add Account to ${p.name}`}
|
|
321
|
+
loading={working === `add-${p.id}`}
|
|
322
|
+
onClickButton={() => handleAdd(p)}
|
|
323
|
+
/>
|
|
324
|
+
</Cluster>
|
|
325
|
+
</TableCell>
|
|
326
|
+
</TableRow>
|
|
327
|
+
{/* The accounts sit under their provider, indented by an empty first cell. */}
|
|
328
|
+
{p.accounts.map((a) => (
|
|
329
|
+
<TableRow key={a.id}>
|
|
330
|
+
<TableCell width="56px">{''}</TableCell>
|
|
331
|
+
<TableCell>
|
|
332
|
+
<Stack gap="small">
|
|
333
|
+
<Cluster gap="small">
|
|
334
|
+
<Heading level={3} size="subtitle1">{a.name}</Heading>
|
|
335
|
+
{a.attention && <Tag variant="contained" size="small" color="warning" label="Needs attention" />}
|
|
336
|
+
</Cluster>
|
|
337
|
+
<Paragraph tone="secondary" size="body2" measure="none">{a.detail}</Paragraph>
|
|
338
|
+
</Stack>
|
|
339
|
+
</TableCell>
|
|
340
|
+
<TableCell width="240px">
|
|
341
|
+
<Cluster gap="small" justify="end">
|
|
342
|
+
{a.attention && (
|
|
343
|
+
<Button size="small" type="primary" state={working && working !== `reconnect-${a.id}` ? 'disabled' : 'enabled'} label="Reconnect" aria-label={`Reconnect ${a.name}`} loading={working === `reconnect-${a.id}`} onClickButton={() => handleReconnect(p, a)} />
|
|
344
|
+
)}
|
|
345
|
+
<Button size="small" type="tertiary" state={working ? 'disabled' : 'enabled'} label="Disconnect" aria-label={`Disconnect ${a.name}`} onClickButton={() => setConfirming({ provider: p, account: a })} />
|
|
346
|
+
</Cluster>
|
|
347
|
+
</TableCell>
|
|
348
|
+
</TableRow>
|
|
349
|
+
))}
|
|
350
|
+
</Fragment>
|
|
351
|
+
))}
|
|
352
|
+
</TableContainer>
|
|
353
|
+
</Stack>
|
|
354
|
+
<Modal
|
|
355
|
+
isOpen={confirming !== null}
|
|
356
|
+
size="small"
|
|
357
|
+
title={confirming ? `Disconnect ${confirming.account.name}` : 'Disconnect'}
|
|
358
|
+
onClose={handleClose}
|
|
359
|
+
actions={
|
|
360
|
+
<>
|
|
361
|
+
<Button size="small" type="tertiary" state={working ? 'disabled' : 'enabled'} label="Cancel" onClickButton={handleClose} />
|
|
362
|
+
<Button size="small" type="primary" color="danger" state="enabled" label="Disconnect" loading={Boolean(working)} onClickButton={() => confirming && handleDisconnect(confirming.provider, confirming.account)} />
|
|
363
|
+
</>
|
|
364
|
+
}
|
|
365
|
+
>
|
|
366
|
+
{confirming && (
|
|
367
|
+
<Paragraph measure="none">
|
|
368
|
+
{confirming.provider.stops} You can connect {confirming.account.name} again any time.
|
|
369
|
+
</Paragraph>
|
|
370
|
+
)}
|
|
371
|
+
</Modal>
|
|
372
|
+
</Center>
|
|
373
|
+
);
|
|
374
|
+
}
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
## Native
|
|
378
|
+
|
|
379
|
+
On Apple use a grouped `Form` with one `Section` per provider, 'Connect' as a Button, and 'Disconnect' in the `.destructive` role in a `confirmationDialog`. On Android use a list of rows that opens a confirm.
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
A person invites someone to join a workspace.
|
|
4
4
|
|
|
5
|
-
**Not built yet:** Scindo on the web replaces the fields with a spinner while it creates an invite, labels the way out 'Close' and reads 'Copied!'. It cancels an invite link on one click with no confirm. Scindo's Apple app cancels a pending invite with no confirm too.
|
|
6
|
-
|
|
7
5
|
## Do
|
|
8
6
|
|
|
9
7
|
- Title the Modal 'Invite Member' and label its action 'Invite', after 'Cancel'.
|
|
@@ -317,5 +315,3 @@ export default function InviteMemberByLink() {
|
|
|
317
315
|
## Native
|
|
318
316
|
|
|
319
317
|
On Apple use a sheet with a `Form`, share the link with `ShareLink`, and revoke a link with a `.destructive` Button that asks first in a `confirmationDialog`.
|
|
320
|
-
|
|
321
|
-
Seen in: Scindo.
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
A list or a section could not load.
|
|
4
4
|
|
|
5
|
-
**Not built yet:** Scindo on the web shows its empty list, with no Try Again, when its API keys or its members fail to load. Commentify puts its 'Try again' Button under `EmptyBox`, not in its `action`.
|
|
6
|
-
|
|
7
5
|
## Do
|
|
8
6
|
|
|
9
7
|
- Say what could not load: 'Could not load projects'.
|
|
@@ -151,5 +149,3 @@ export default function LoadFailureInline() {
|
|
|
151
149
|
## Native
|
|
152
150
|
|
|
153
151
|
On Apple use `ContentUnavailableView`, with a 'Try Again' Button in its `actions`.
|
|
154
|
-
|
|
155
|
-
Seen in: Commentify, Scindo.
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
A person chooses Log Out.
|
|
4
4
|
|
|
5
|
-
**Not built yet:** Scindo on the web says 'Log Out' but colors it as danger. Scindo on Apple says 'Sign Out' and puts it in the destructive role. Commentify and Commentify admin say 'Sign Out', title the Modal 'Confirm Sign Out', label the action 'Yes, Sign Out' and ask 'Are you sure you want to sign out?'.
|
|
6
|
-
|
|
7
5
|
## Do
|
|
8
6
|
|
|
9
7
|
- Call it 'Log Out' everywhere: the menu item, the Modal title and the action Button. The way back in is 'Log In'.
|
|
@@ -102,5 +100,3 @@ export default function LogOutConfirmModal() {
|
|
|
102
100
|
## Native
|
|
103
101
|
|
|
104
102
|
On Apple use a system `confirmationDialog` titled 'Log Out', with a 'Log Out' Button and 'Cancel' in the `.cancel` role. Leave out the `.destructive` role: nothing is destroyed.
|
|
105
|
-
|
|
106
|
-
Seen in: Commentify, Commentify admin, Scindo.
|
package/dist/cases/login-page.md
CHANGED
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
A person who already has an account opens the product and is not logged in.
|
|
4
4
|
|
|
5
|
-
**Not built yet:** Commentify and Scindo on the web replace the form with a spinner while logging in. They do not use the Button's loading state yet.
|
|
6
|
-
|
|
7
5
|
## Do
|
|
8
6
|
|
|
9
7
|
- Show a problem with one field under that field.
|
|
@@ -369,5 +367,3 @@ export default function LoginEmailOnly() {
|
|
|
369
367
|
## Native
|
|
370
368
|
|
|
371
369
|
On Apple use `SignInWithAppleButton` for Apple, a grouped form for the fields, and system buttons.
|
|
372
|
-
|
|
373
|
-
Seen in: Commentify, Commentify admin, Scindo.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function MasterDetailListThenPage(): import("react").JSX.Element;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import Navigation from '../../components/navigation';
|
|
4
|
+
import MenuItem from '../../components/menuItem';
|
|
5
|
+
import TitleBar from '../../components/titleBar';
|
|
6
|
+
import Heading from '../../components/heading';
|
|
7
|
+
import Paragraph from '../../components/paragraph';
|
|
8
|
+
import Button from '../../components/button';
|
|
9
|
+
import PageShell from '../../components/pageShell';
|
|
10
|
+
import { Stack } from '../../components/layout';
|
|
11
|
+
var reports = [
|
|
12
|
+
{
|
|
13
|
+
id: 'q3-review',
|
|
14
|
+
title: 'Q3 review',
|
|
15
|
+
summary: 'Revenue, churn and what changed since June.',
|
|
16
|
+
body: [
|
|
17
|
+
'Revenue grew 12 percent over the quarter, led by the new team plan. Churn fell to 2.1 percent.',
|
|
18
|
+
'Support tickets about sign-up dropped by a third after the new form shipped in August.',
|
|
19
|
+
'The main risk is the pricing page, which still sends people to a contact form. Ben Carter owns the fix.',
|
|
20
|
+
],
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
id: 'hiring-plan',
|
|
24
|
+
title: 'Hiring plan',
|
|
25
|
+
summary: 'Roles to open next half, and why.',
|
|
26
|
+
body: [
|
|
27
|
+
'Two roles open in January: a designer for the web app and a support lead.',
|
|
28
|
+
'Omar Reyes will write both job posts. Dana Lee approves the budget on Monday.',
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
id: 'roadmap',
|
|
33
|
+
title: 'Roadmap',
|
|
34
|
+
summary: 'What ships, in order, through March.',
|
|
35
|
+
body: [
|
|
36
|
+
'The mobile app and the new billing page ship first. Integrations follow in February.',
|
|
37
|
+
'Each item lists its owner, its date and what must be true before it starts.',
|
|
38
|
+
],
|
|
39
|
+
},
|
|
40
|
+
];
|
|
41
|
+
export default function MasterDetailListThenPage() {
|
|
42
|
+
var _a = useState(null), openId = _a[0], setOpenId = _a[1];
|
|
43
|
+
var report = reports.find(function (r) { return r.id === openId; });
|
|
44
|
+
// A real app goes to the page's address. Back calls the router's back() when the person came from the list, so the list keeps its scroll,
|
|
45
|
+
// and otherwise links to the list's address. The example swaps the view.
|
|
46
|
+
if (report) {
|
|
47
|
+
return (<PageShell>
|
|
48
|
+
<Stack gap="large">
|
|
49
|
+
<TitleBar title={report.title} back={<Button size="small" type="tertiary" state="enabled" decoIcon="ChevronLeft" label="Back to Reports" onClickButton={function () { return setOpenId(null); }}/>}/>
|
|
50
|
+
{report.body.map(function (paragraph) { return (<Paragraph key={paragraph} measure="body">{paragraph}</Paragraph>); })}
|
|
51
|
+
</Stack>
|
|
52
|
+
</PageShell>);
|
|
53
|
+
}
|
|
54
|
+
return (<PageShell>
|
|
55
|
+
<Stack gap="large">
|
|
56
|
+
<Heading level={1} size="h5">Reports</Heading>
|
|
57
|
+
<Navigation aria-label="Reports">
|
|
58
|
+
{reports.map(function (r) { return (<MenuItem key={r.id} size="medium" label={r.title} secondLabel={r.summary} iconRight="ChevronRight" href={"/reports/".concat(r.id)} onClick={function (event) {
|
|
59
|
+
event.preventDefault();
|
|
60
|
+
setOpenId(r.id);
|
|
61
|
+
}}/>); })}
|
|
62
|
+
</Navigation>
|
|
63
|
+
</Stack>
|
|
64
|
+
</PageShell>);
|
|
65
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function MasterDetailSplit(): import("react").JSX.Element;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import Navigation from '../../components/navigation';
|
|
4
|
+
import MenuItem from '../../components/menuItem';
|
|
5
|
+
import { SettingsLayout } from '../../components/settingsSection';
|
|
6
|
+
import Heading from '../../components/heading';
|
|
7
|
+
import Paragraph from '../../components/paragraph';
|
|
8
|
+
import Button from '../../components/button';
|
|
9
|
+
import PageShell from '../../components/pageShell';
|
|
10
|
+
import { Cluster, Stack } from '../../components/layout';
|
|
11
|
+
var messages = [
|
|
12
|
+
{ id: 'launch-plan', from: 'Ben Carter', subject: 'Launch plan is ready', time: '9:12 AM', body: ['The plan is in the shared folder. It covers the announcement, the pricing page and the support hand-off.', 'Can you read the pricing part before noon? Omar Reyes is waiting on it.'] },
|
|
13
|
+
{ id: 'new-screens', from: 'Omar Reyes', subject: 'New screens for Friday', time: '8:40 AM', body: ['I added the new home page screens. The sign-up form now sits above the pricing table.', 'Tell me what to change by Thursday.'] },
|
|
14
|
+
{ id: 'invoice', from: 'Ben Carter', subject: 'Invoice for October', time: 'Yesterday', body: ['The invoice for October is attached. It includes the three new seats.'] },
|
|
15
|
+
{ id: 'offsite', from: 'Omar Reyes', subject: 'Team offsite in March', time: 'Monday', body: ['I found two dates for the offsite. Please say which one works for you.'] },
|
|
16
|
+
];
|
|
17
|
+
export default function MasterDetailSplit() {
|
|
18
|
+
var _a;
|
|
19
|
+
// One message is always open, the first at the start.
|
|
20
|
+
var _b = useState(messages[0].id), openId = _b[0], setOpenId = _b[1];
|
|
21
|
+
// On a phone the list is the screen until a message is chosen, and Back returns to it.
|
|
22
|
+
var _c = useState(false), showDetail = _c[0], setShowDetail = _c[1];
|
|
23
|
+
var message = (_a = messages.find(function (m) { return m.id === openId; })) !== null && _a !== void 0 ? _a : messages[0];
|
|
24
|
+
var list = (<Navigation aria-label="Messages">
|
|
25
|
+
{messages.map(function (m) { return (<MenuItem key={m.id} size="medium" label={m.from} secondLabel={m.subject} href={"/inbox/".concat(m.id)} isSelected={m.id === message.id} aria-current={m.id === message.id ? 'page' : undefined} onClick={function (event) {
|
|
26
|
+
// 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.
|
|
27
|
+
event.preventDefault();
|
|
28
|
+
setOpenId(m.id);
|
|
29
|
+
setShowDetail(true);
|
|
30
|
+
}}/>); })}
|
|
31
|
+
</Navigation>);
|
|
32
|
+
return (<PageShell>
|
|
33
|
+
<Stack gap="xlarge">
|
|
34
|
+
<Heading level={1} size="h5">Inbox</Heading>
|
|
35
|
+
<SettingsLayout navWidth="wide" nav={list} showContent={showDetail} back={<Button size="small" type="tertiary" state="enabled" decoIcon="ChevronLeft" label="Back to Inbox" onClickButton={function () { return setShowDetail(false); }}/>}>
|
|
36
|
+
<Stack gap="small">
|
|
37
|
+
<Heading level={2} size="h6">{message.subject}</Heading>
|
|
38
|
+
<Paragraph tone="secondary" size="body2" measure="none">{message.from}, {message.time}</Paragraph>
|
|
39
|
+
</Stack>
|
|
40
|
+
<Stack gap="medium">
|
|
41
|
+
{message.body.map(function (paragraph) { return (<Paragraph key={paragraph} measure="none">{paragraph}</Paragraph>); })}
|
|
42
|
+
</Stack>
|
|
43
|
+
<Cluster>
|
|
44
|
+
<Button size="medium" type="primary" state="enabled" label="Reply" decoIcon="Reply"/>
|
|
45
|
+
</Cluster>
|
|
46
|
+
</SettingsLayout>
|
|
47
|
+
</Stack>
|
|
48
|
+
</PageShell>);
|
|
49
|
+
}
|