oneslash-design-system 2.15.0 → 2.16.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 +6 -1
- package/dist/DESIGN.md +75 -71
- package/dist/cases/accept-invite/signed-in.d.ts +1 -0
- package/dist/cases/accept-invite/signed-in.jsx +57 -0
- package/dist/cases/accept-invite/signed-out.d.ts +1 -0
- package/dist/cases/accept-invite/signed-out.jsx +33 -0
- package/dist/cases/accept-invite.md +161 -0
- package/dist/cases/agent-asks-before-risky-action.md +1 -1
- package/dist/cases/agent-cancels-when-unanswered.md +1 -1
- package/dist/cases/auth-gate-loading/spinner-with-line.d.ts +1 -0
- package/dist/cases/auth-gate-loading/spinner-with-line.jsx +10 -0
- package/dist/cases/auth-gate-loading/spinner.d.ts +1 -0
- package/dist/cases/auth-gate-loading/spinner.jsx +10 -0
- package/dist/cases/auth-gate-loading.md +70 -0
- package/dist/cases/check-your-email/alert-on-login.d.ts +1 -0
- package/dist/cases/check-your-email/alert-on-login.jsx +78 -0
- package/dist/cases/check-your-email/page.d.ts +1 -0
- package/dist/cases/check-your-email/page.jsx +49 -0
- package/dist/cases/check-your-email.md +184 -0
- package/dist/cases/confirm-destructive-action/inline.d.ts +1 -0
- package/dist/cases/confirm-destructive-action/inline.jsx +69 -0
- package/dist/cases/confirm-destructive-action/modal.d.ts +1 -0
- package/dist/cases/confirm-destructive-action/modal.jsx +66 -0
- package/dist/cases/confirm-destructive-action.md +211 -0
- package/dist/cases/confirm-dialogs.md +36 -0
- package/dist/cases/create-modal/quick.d.ts +1 -0
- package/dist/cases/create-modal/quick.jsx +80 -0
- package/dist/cases/create-modal/with-settings.d.ts +1 -0
- package/dist/cases/create-modal/with-settings.jsx +99 -0
- package/dist/cases/create-modal.md +244 -0
- package/dist/cases/device-login/popup.d.ts +1 -0
- package/dist/cases/device-login/popup.jsx +14 -0
- package/dist/cases/device-login/provider-first.d.ts +1 -0
- package/dist/cases/device-login/provider-first.jsx +98 -0
- package/dist/cases/device-login.md +171 -0
- package/dist/cases/email-confirmed/alert-on-login.d.ts +1 -0
- package/dist/cases/email-confirmed/alert-on-login.jsx +78 -0
- package/dist/cases/email-confirmed/page.d.ts +1 -0
- package/dist/cases/email-confirmed/page.jsx +21 -0
- package/dist/cases/email-confirmed.md +151 -0
- package/dist/cases/empty-list/region.d.ts +1 -0
- package/dist/cases/empty-list/region.jsx +13 -0
- package/dist/cases/empty-list/section.d.ts +1 -0
- package/dist/cases/empty-list/section.jsx +17 -0
- package/dist/cases/empty-list.md +77 -0
- package/dist/cases/empty-lists.md +35 -0
- package/dist/cases/empty-not-set-up/action.d.ts +1 -0
- package/dist/cases/empty-not-set-up/action.jsx +16 -0
- package/dist/cases/empty-not-set-up/pointer.d.ts +1 -0
- package/dist/cases/empty-not-set-up/pointer.jsx +13 -0
- package/dist/cases/empty-not-set-up.md +88 -0
- package/dist/cases/empty-search/clear-search.d.ts +1 -0
- package/dist/cases/empty-search/clear-search.jsx +29 -0
- package/dist/cases/empty-search.md +77 -0
- package/dist/cases/error-page/full-page.d.ts +1 -0
- package/dist/cases/error-page/full-page.jsx +19 -0
- package/dist/cases/error-page/in-shell.d.ts +1 -0
- package/dist/cases/error-page/in-shell.jsx +39 -0
- package/dist/cases/error-page.md +107 -0
- package/dist/cases/feedback-form/modal.d.ts +1 -0
- package/dist/cases/feedback-form/modal.jsx +89 -0
- package/dist/cases/feedback-form.md +139 -0
- package/dist/cases/forgot-password/in-place.d.ts +1 -0
- package/dist/cases/forgot-password/in-place.jsx +155 -0
- package/dist/cases/forgot-password/own-page.d.ts +1 -0
- package/dist/cases/forgot-password/own-page.jsx +99 -0
- package/dist/cases/forgot-password.md +328 -0
- package/dist/cases/form-errors.md +32 -0
- package/dist/cases/import-checklist/modal.d.ts +1 -0
- package/dist/cases/import-checklist/modal.jsx +125 -0
- package/dist/cases/import-checklist.md +188 -0
- package/dist/cases/inline-form-feedback/button-label.d.ts +1 -0
- package/dist/cases/inline-form-feedback/button-label.jsx +54 -0
- package/dist/cases/inline-form-feedback/inline-alert.d.ts +1 -0
- package/dist/cases/inline-form-feedback/inline-alert.jsx +49 -0
- package/dist/cases/inline-form-feedback/toast.d.ts +1 -0
- package/dist/cases/inline-form-feedback/toast.jsx +66 -0
- package/dist/cases/inline-form-feedback.md +237 -0
- package/dist/cases/invite-member/by-email.d.ts +1 -0
- package/dist/cases/invite-member/by-email.jsx +98 -0
- package/dist/cases/invite-member/by-link.d.ts +1 -0
- package/dist/cases/invite-member/by-link.jsx +122 -0
- package/dist/cases/invite-member.md +321 -0
- package/dist/cases/load-failure/inline.d.ts +1 -0
- package/dist/cases/load-failure/inline.jsx +52 -0
- package/dist/cases/load-failure/region.d.ts +1 -0
- package/dist/cases/load-failure/region.jsx +34 -0
- package/dist/cases/load-failure.md +155 -0
- package/dist/cases/log-out-confirm/modal.d.ts +1 -0
- package/dist/cases/log-out-confirm/modal.jsx +57 -0
- package/dist/cases/log-out-confirm.md +106 -0
- package/dist/cases/login-page/centered.jsx +10 -7
- package/dist/cases/login-page/email-only.jsx +11 -8
- package/dist/cases/login-page/provider-first.jsx +12 -9
- package/dist/cases/login-page/split.jsx +11 -8
- package/dist/cases/login-page.md +58 -41
- package/dist/cases/not-found-page/full-page.d.ts +1 -0
- package/dist/cases/not-found-page/full-page.jsx +16 -0
- package/dist/cases/not-found-page/in-shell.d.ts +1 -0
- package/dist/cases/not-found-page/in-shell.jsx +36 -0
- package/dist/cases/not-found-page.md +98 -0
- package/dist/cases/oauth-consent/simple.d.ts +1 -0
- package/dist/cases/oauth-consent/simple.jsx +73 -0
- package/dist/cases/oauth-consent/with-scope.d.ts +1 -0
- package/dist/cases/oauth-consent/with-scope.jsx +89 -0
- package/dist/cases/oauth-consent.md +233 -0
- package/dist/cases/rename/inline.d.ts +1 -0
- package/dist/cases/rename/inline.jsx +58 -0
- package/dist/cases/rename/modal.d.ts +1 -0
- package/dist/cases/rename/modal.jsx +70 -0
- package/dist/cases/rename.md +205 -0
- package/dist/cases/route-loading/full-screen.d.ts +1 -0
- package/dist/cases/route-loading/full-screen.jsx +8 -0
- package/dist/cases/route-loading/region.d.ts +1 -0
- package/dist/cases/route-loading/region.jsx +26 -0
- package/dist/cases/route-loading.md +84 -0
- package/dist/cases/set-new-password/form.d.ts +1 -0
- package/dist/cases/set-new-password/form.jsx +130 -0
- package/dist/cases/set-new-password/invalid-link.d.ts +1 -0
- package/dist/cases/set-new-password/invalid-link.jsx +50 -0
- package/dist/cases/set-new-password.md +247 -0
- package/dist/cases/sign-up-page/centered.d.ts +1 -0
- package/dist/cases/sign-up-page/centered.jsx +124 -0
- package/dist/cases/sign-up-page/provider-first.d.ts +1 -0
- package/dist/cases/sign-up-page/provider-first.jsx +124 -0
- package/dist/cases/sign-up-page/split.d.ts +1 -0
- package/dist/cases/sign-up-page/split.jsx +134 -0
- package/dist/cases/sign-up-page.md +478 -0
- package/dist/cases/success-feedback.md +35 -0
- package/dist/cases/type-to-confirm/inline.d.ts +1 -0
- package/dist/cases/type-to-confirm/inline.jsx +69 -0
- package/dist/cases/type-to-confirm/modal.d.ts +1 -0
- package/dist/cases/type-to-confirm/modal.jsx +73 -0
- package/dist/cases/type-to-confirm.md +222 -0
- package/dist/cases/unsaved-changes-guard/discard.d.ts +1 -0
- package/dist/cases/unsaved-changes-guard/discard.jsx +81 -0
- package/dist/cases/unsaved-changes-guard/save-or-discard.d.ts +1 -0
- package/dist/cases/unsaved-changes-guard/save-or-discard.jsx +85 -0
- package/dist/cases/unsaved-changes-guard.md +239 -0
- package/dist/cases/upgrade-prompt/inline.d.ts +1 -0
- package/dist/cases/upgrade-prompt/inline.jsx +52 -0
- package/dist/cases/upgrade-prompt/modal.d.ts +1 -0
- package/dist/cases/upgrade-prompt/modal.jsx +43 -0
- package/dist/cases/upgrade-prompt.md +174 -0
- package/dist/cases.json +1856 -39
- package/dist/components/alert.d.ts +3 -1
- package/dist/components/alert.jsx +6 -4
- package/dist/components/emptyBox.d.ts +6 -1
- package/dist/components/emptyBox.jsx +4 -2
- package/dist/components/heading.d.ts +2 -2
- package/dist/components/loadingScreen.d.ts +5 -1
- package/dist/components/loadingScreen.jsx +4 -2
- package/dist/components/modal.d.ts +2 -1
- package/dist/components/modal.jsx +20 -8
- package/dist/components/radioGroup.d.ts +2 -1
- package/dist/components/radioGroup.jsx +2 -2
- package/dist/components/select.d.ts +2 -1
- package/dist/components/select.jsx +4 -2
- package/dist/components/tab.jsx +3 -2
- package/dist/components/tabsContainer.d.ts +4 -1
- package/dist/components/tabsContainer.jsx +7 -3
- package/dist/components/textField.d.ts +5 -1
- package/dist/components/textField.jsx +7 -3
- package/dist/components/toaster.d.ts +12 -0
- package/dist/components/toaster.jsx +103 -0
- package/dist/internal/alert.d.ts +4 -0
- package/dist/internal/alert.js +6 -0
- package/dist/internal/modal.d.ts +2 -0
- package/dist/internal/modal.js +21 -0
- package/dist/internal/toaster.d.ts +19 -0
- package/dist/internal/toaster.js +50 -0
- package/dist/native-mapping.json +6 -0
- package/dist/stories/Alert.stories.d.ts +1 -0
- package/dist/stories/Alert.stories.jsx +16 -0
- package/dist/stories/Cases.generated.stories.d.ts +52 -0
- package/dist/stories/Cases.generated.stories.jsx +104 -0
- package/dist/stories/EmptyBox.stories.d.ts +2 -0
- package/dist/stories/EmptyBox.stories.jsx +16 -0
- package/dist/stories/Heading.stories.d.ts +6 -0
- package/dist/stories/Heading.stories.jsx +10 -0
- package/dist/stories/LoadingScreen.stories.d.ts +1 -0
- package/dist/stories/LoadingScreen.stories.jsx +8 -0
- package/dist/stories/Modal.stories.d.ts +2 -0
- package/dist/stories/Modal.stories.jsx +36 -0
- package/dist/stories/RadioGroup.stories.d.ts +1 -0
- package/dist/stories/RadioGroup.stories.jsx +14 -0
- package/dist/stories/Select.stories.d.ts +1 -0
- package/dist/stories/Select.stories.jsx +14 -0
- package/dist/stories/TabsContainer.stories.d.ts +1 -0
- package/dist/stories/TabsContainer.stories.jsx +12 -0
- package/dist/stories/TextField.stories.d.ts +2 -0
- package/dist/stories/TextField.stories.jsx +22 -0
- package/dist/stories/Toaster.stories.d.ts +6 -0
- package/dist/stories/Toaster.stories.jsx +29 -0
- package/package.json +1 -1
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
# OAuth consent
|
|
2
|
+
|
|
3
|
+
Another app, such as a CLI or an MCP client, asks to act for a person who is logged in, and the person must allow it.
|
|
4
|
+
|
|
5
|
+
**Not built yet:** Scindo on the web turns on access to every workspace for the person, and shows its spinner on neither Button while the request runs. Commentify puts 'Allow' before 'Deny', writes its error in a red caption by hand, and says nothing about how to remove the access.
|
|
6
|
+
|
|
7
|
+
## Do
|
|
8
|
+
|
|
9
|
+
- Name the app in a `Heading` with `level={1}`: 'Acme CLI wants to connect to Acme'.
|
|
10
|
+
- Say in one or two plain sentences what the app will be able to do, in the person's words: 'read your projects and tasks, and create tasks as you'.
|
|
11
|
+
- Say how to remove the access later: 'You can remove its access at any time in Settings, under Connected apps.'
|
|
12
|
+
- Show the account that gives the access, with a text-only 'Not You? Switch Account' Button under it.
|
|
13
|
+
- Take the app's name and the place the person goes back to from the server's record of the registered app, never from the link.
|
|
14
|
+
- Say where the person goes next: 'You will go back to cli.acme.dev.'
|
|
15
|
+
- Put 'Cancel' first and 'Allow' second, side by side and the same width, in a `Grid` with `columns={2}`.
|
|
16
|
+
- Show `loading` on 'Allow' and disable 'Cancel' and every field while the request runs.
|
|
17
|
+
- Show `LoadingScreen` with `label="Going back to Acme CLI…"` while the browser goes back, after 'Allow' and after 'Cancel'.
|
|
18
|
+
- Send 'Cancel' back to the app with `error=access_denied`, and return the `state` value the app sent on both paths.
|
|
19
|
+
- Leave wider access off until the person turns it on, and say under it what it adds.
|
|
20
|
+
|
|
21
|
+
## Don't
|
|
22
|
+
|
|
23
|
+
- Do not color 'Allow' or 'Cancel' as danger. Allowing is the person's choice, not a destructive action.
|
|
24
|
+
- Do not turn on wider access for the person.
|
|
25
|
+
- Do not name the access by its scope id, such as 'tasks:write'.
|
|
26
|
+
- Do not label Cancel 'Deny' or 'No'.
|
|
27
|
+
|
|
28
|
+
## Option: One account, one access
|
|
29
|
+
|
|
30
|
+
Use when: The app gets one set of access to one account, so the only choice is to allow it or not.
|
|
31
|
+
|
|
32
|
+
Uses: `Alert`, `Button`, `Center`, `Cluster`, `Grid`, `Heading`, `Image`, `LoadingScreen`, `Paragraph`, `Stack`, `UserImage`
|
|
33
|
+
|
|
34
|
+
```tsx
|
|
35
|
+
'use client';
|
|
36
|
+
import { useEffect, useRef, useState } from 'react';
|
|
37
|
+
import Image from 'oneslash-design-system/components/image';
|
|
38
|
+
import Heading from 'oneslash-design-system/components/heading';
|
|
39
|
+
import Paragraph from 'oneslash-design-system/components/paragraph';
|
|
40
|
+
import UserImage from 'oneslash-design-system/components/userImage';
|
|
41
|
+
import Alert from 'oneslash-design-system/components/alert';
|
|
42
|
+
import Button from 'oneslash-design-system/components/button';
|
|
43
|
+
import LoadingScreen from 'oneslash-design-system/components/loadingScreen';
|
|
44
|
+
import { Center, Cluster, Grid, Stack } from 'oneslash-design-system/components/layout';
|
|
45
|
+
|
|
46
|
+
// The product's mark. A real app passes its own file.
|
|
47
|
+
const productMark =
|
|
48
|
+
"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Crect width='40' height='40' rx='10' fill='%232f6b4f'/%3E%3Cpath d='M20 9 31 31h-6l-5-11-5 11H9z' fill='%23fff'/%3E%3C/svg%3E";
|
|
49
|
+
|
|
50
|
+
// A real app passes the router from its framework, such as Next's useRouter().
|
|
51
|
+
// The app's name and cli.acme.dev come from the server's record of the registered app, never from the link.
|
|
52
|
+
// Going back to another site is a full page load, such as window.location.assign() in a real app.
|
|
53
|
+
const router = { push: (url: string) => console.info(`Go to ${url}`) };
|
|
54
|
+
|
|
55
|
+
export default function OAuthConsentSimple() {
|
|
56
|
+
const [allowing, setAllowing] = useState(false);
|
|
57
|
+
const [handingBack, setHandingBack] = useState(false);
|
|
58
|
+
const [error, setError] = useState('');
|
|
59
|
+
const timer = useRef<ReturnType<typeof setTimeout>>();
|
|
60
|
+
|
|
61
|
+
// Stops the request if the example goes away before it ends.
|
|
62
|
+
useEffect(() => () => clearTimeout(timer.current), []);
|
|
63
|
+
|
|
64
|
+
function handleAllow() {
|
|
65
|
+
if (allowing) return;
|
|
66
|
+
setError('');
|
|
67
|
+
setAllowing(true);
|
|
68
|
+
// Stands in for the request to the server.
|
|
69
|
+
// A failed request calls setError with one sentence instead, such as 'Acme CLI was not connected. Try again.'
|
|
70
|
+
timer.current = setTimeout(() => {
|
|
71
|
+
setAllowing(false);
|
|
72
|
+
setHandingBack(true);
|
|
73
|
+
// A real app also returns the `state` value the app sent, so the app can match the answer to its request.
|
|
74
|
+
router.push('https://cli.acme.dev/callback');
|
|
75
|
+
}, 1200);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// The app hears that the person said no, and nothing is shared.
|
|
79
|
+
// A real app also returns the `state` value the app sent.
|
|
80
|
+
function handleCancel() {
|
|
81
|
+
setHandingBack(true);
|
|
82
|
+
router.push('https://cli.acme.dev/callback?error=access_denied');
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// Shown while the browser goes back to the app, the same as a named step in 'Login check loading'.
|
|
86
|
+
if (handingBack) {
|
|
87
|
+
return (
|
|
88
|
+
<Center fill>
|
|
89
|
+
<LoadingScreen label="Going back to Acme CLI…" />
|
|
90
|
+
</Center>
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return (
|
|
95
|
+
<Center fill>
|
|
96
|
+
<Image src={productMark} alt="Acme" width={40} height={40} />
|
|
97
|
+
<Stack gap="medium">
|
|
98
|
+
<Heading level={1} size="h5">Acme CLI wants to connect to Acme</Heading>
|
|
99
|
+
<Paragraph tone="secondary" measure="none">It will be able to read your projects and tasks, and create tasks as you. You can remove its access at any time in Settings, under Connected apps.</Paragraph>
|
|
100
|
+
</Stack>
|
|
101
|
+
{/* The account that gives the access, so the person can tell it is the right one. */}
|
|
102
|
+
<Stack gap="small" align="start">
|
|
103
|
+
<Cluster gap="small">
|
|
104
|
+
<UserImage userHandle="Ada Lovelace" />
|
|
105
|
+
<Paragraph size="body2" measure="none">ada@example.com</Paragraph>
|
|
106
|
+
</Cluster>
|
|
107
|
+
<Button size="small" type="textOnly" state={allowing ? 'disabled' : 'enabled'} label="Not You? Switch Account" onClickButton={() => router.push('/login?next=%2Foauth%2Fauthorize')} />
|
|
108
|
+
</Stack>
|
|
109
|
+
{error && <Alert type="error" variant="inline" message={error} showCloseButton onClose={() => setError('')} />}
|
|
110
|
+
<Stack gap="medium">
|
|
111
|
+
<Grid columns={2} gap="medium">
|
|
112
|
+
<Button size="medium" type="secondary" state={allowing ? 'disabled' : 'enabled'} label="Cancel" onClickButton={handleCancel} />
|
|
113
|
+
<Button size="medium" type="primary" state="enabled" label="Allow" loading={allowing} onClickButton={handleAllow} />
|
|
114
|
+
</Grid>
|
|
115
|
+
<Paragraph tone="secondary" size="caption" measure="none">You will go back to cli.acme.dev.</Paragraph>
|
|
116
|
+
</Stack>
|
|
117
|
+
</Center>
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## Option: Workspace and wider access
|
|
123
|
+
|
|
124
|
+
Use when: The person picks the workspace the app can use, or turns on wider access.
|
|
125
|
+
|
|
126
|
+
Uses: `Alert`, `Button`, `Center`, `Checkbox`, `Cluster`, `Grid`, `Heading`, `Image`, `LoadingScreen`, `Paragraph`, `Select`, `Stack`, `UserImage`
|
|
127
|
+
|
|
128
|
+
```tsx
|
|
129
|
+
'use client';
|
|
130
|
+
import { useEffect, useRef, useState } from 'react';
|
|
131
|
+
import Image from 'oneslash-design-system/components/image';
|
|
132
|
+
import Heading from 'oneslash-design-system/components/heading';
|
|
133
|
+
import Paragraph from 'oneslash-design-system/components/paragraph';
|
|
134
|
+
import UserImage from 'oneslash-design-system/components/userImage';
|
|
135
|
+
import Alert from 'oneslash-design-system/components/alert';
|
|
136
|
+
import Select from 'oneslash-design-system/components/select';
|
|
137
|
+
import Checkbox from 'oneslash-design-system/components/checkBox';
|
|
138
|
+
import Button from 'oneslash-design-system/components/button';
|
|
139
|
+
import LoadingScreen from 'oneslash-design-system/components/loadingScreen';
|
|
140
|
+
import { Center, Cluster, Grid, Stack } from 'oneslash-design-system/components/layout';
|
|
141
|
+
|
|
142
|
+
// The product's mark. A real app passes its own file.
|
|
143
|
+
const productMark =
|
|
144
|
+
"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Crect width='40' height='40' rx='10' fill='%232f6b4f'/%3E%3Cpath d='M20 9 31 31h-6l-5-11-5 11H9z' fill='%23fff'/%3E%3C/svg%3E";
|
|
145
|
+
|
|
146
|
+
// A real app passes the router from its framework, such as Next's useRouter().
|
|
147
|
+
// The app's name and cli.acme.dev come from the server's record of the registered app, never from the link.
|
|
148
|
+
// Going back to another site is a full page load, such as window.location.assign() in a real app.
|
|
149
|
+
const router = { push: (url: string) => console.info(`Go to ${url}`) };
|
|
150
|
+
|
|
151
|
+
// The workspaces the person belongs to.
|
|
152
|
+
const workspaces = [
|
|
153
|
+
{ value: 'design', label: 'Acme Design' },
|
|
154
|
+
{ value: 'marketing', label: 'Acme Marketing' },
|
|
155
|
+
];
|
|
156
|
+
|
|
157
|
+
export default function OAuthConsentWithScope() {
|
|
158
|
+
const [workspace, setWorkspace] = useState('design');
|
|
159
|
+
// The wider access is off until the person turns it on.
|
|
160
|
+
const [allWorkspaces, setAllWorkspaces] = useState(false);
|
|
161
|
+
const [allowing, setAllowing] = useState(false);
|
|
162
|
+
const [handingBack, setHandingBack] = useState(false);
|
|
163
|
+
const [error, setError] = useState('');
|
|
164
|
+
const timer = useRef<ReturnType<typeof setTimeout>>();
|
|
165
|
+
|
|
166
|
+
// Stops the request if the example goes away before it ends.
|
|
167
|
+
useEffect(() => () => clearTimeout(timer.current), []);
|
|
168
|
+
|
|
169
|
+
function handleAllow() {
|
|
170
|
+
if (allowing) return;
|
|
171
|
+
setError('');
|
|
172
|
+
setAllowing(true);
|
|
173
|
+
// Stands in for the request to the server.
|
|
174
|
+
// A failed request calls setError with one sentence instead, such as 'Acme CLI was not connected. Try again.'
|
|
175
|
+
timer.current = setTimeout(() => {
|
|
176
|
+
setAllowing(false);
|
|
177
|
+
setHandingBack(true);
|
|
178
|
+
// A real app also returns the `state` value the app sent, so the app can match the answer to its request.
|
|
179
|
+
router.push('https://cli.acme.dev/callback');
|
|
180
|
+
}, 1200);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// The app hears that the person said no, and nothing is shared.
|
|
184
|
+
// A real app also returns the `state` value the app sent.
|
|
185
|
+
function handleCancel() {
|
|
186
|
+
setHandingBack(true);
|
|
187
|
+
router.push('https://cli.acme.dev/callback?error=access_denied');
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// Shown while the browser goes back to the app, the same as a named step in 'Login check loading'.
|
|
191
|
+
if (handingBack) {
|
|
192
|
+
return (
|
|
193
|
+
<Center fill>
|
|
194
|
+
<LoadingScreen label="Going back to Acme CLI…" />
|
|
195
|
+
</Center>
|
|
196
|
+
);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
return (
|
|
200
|
+
<Center fill>
|
|
201
|
+
<Image src={productMark} alt="Acme" width={40} height={40} />
|
|
202
|
+
<Stack gap="medium">
|
|
203
|
+
<Heading level={1} size="h5">Acme CLI wants to connect to Acme</Heading>
|
|
204
|
+
<Paragraph tone="secondary" measure="none">It will be able to read the projects and tasks you can see, and create tasks as you, in the workspaces you allow below. You can remove its access at any time in Settings, under Connected apps.</Paragraph>
|
|
205
|
+
</Stack>
|
|
206
|
+
{/* The account that gives the access, so the person can tell it is the right one. */}
|
|
207
|
+
<Stack gap="small" align="start">
|
|
208
|
+
<Cluster gap="small">
|
|
209
|
+
<UserImage userHandle="Ada Lovelace" />
|
|
210
|
+
<Paragraph size="body2" measure="none">ada@example.com</Paragraph>
|
|
211
|
+
</Cluster>
|
|
212
|
+
<Button size="small" type="textOnly" state={allowing ? 'disabled' : 'enabled'} label="Not You? Switch Account" onClickButton={() => router.push('/login?next=%2Foauth%2Fauthorize')} />
|
|
213
|
+
</Stack>
|
|
214
|
+
{error && <Alert type="error" variant="inline" message={error} showCloseButton onClose={() => setError('')} />}
|
|
215
|
+
<Stack gap="small">
|
|
216
|
+
{/* The line above names the field on screen, and `aria-label` names it for a screen reader. */}
|
|
217
|
+
<Paragraph tone="secondary" size="body2" measure="none">Workspace</Paragraph>
|
|
218
|
+
<Select aria-label="Workspace" value={workspace} options={workspaces} disabled={allowing} onChange={(v) => setWorkspace(typeof v === 'string' ? v : v[0])} />
|
|
219
|
+
</Stack>
|
|
220
|
+
<Checkbox label="Also allow my other workspaces" secondLabel="It can then do the same in every workspace you belong to. It still sees only what you can see." checked={allWorkspaces} disabled={allowing} onChange={setAllWorkspaces} />
|
|
221
|
+
<Stack gap="medium">
|
|
222
|
+
<Grid columns={2} gap="medium">
|
|
223
|
+
<Button size="medium" type="secondary" state={allowing ? 'disabled' : 'enabled'} label="Cancel" onClickButton={handleCancel} />
|
|
224
|
+
<Button size="medium" type="primary" state="enabled" label="Allow" loading={allowing} onClickButton={handleAllow} />
|
|
225
|
+
</Grid>
|
|
226
|
+
<Paragraph tone="secondary" size="caption" measure="none">You will go back to cli.acme.dev.</Paragraph>
|
|
227
|
+
</Stack>
|
|
228
|
+
</Center>
|
|
229
|
+
);
|
|
230
|
+
}
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
Seen in: Commentify, Scindo.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function RenameInline(): import("react").JSX.Element;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useRef, useState } from 'react';
|
|
3
|
+
import Heading from '../../components/heading';
|
|
4
|
+
import Paragraph from '../../components/paragraph';
|
|
5
|
+
import TextField from '../../components/textField';
|
|
6
|
+
import IconButton from '../../components/iconButton';
|
|
7
|
+
import Tooltip from '../../components/tooltip';
|
|
8
|
+
import { Center, Cluster, Stack } from '../../components/layout';
|
|
9
|
+
export default function RenameInline() {
|
|
10
|
+
var _a = useState('Q3 plan'), name = _a[0], setName = _a[1];
|
|
11
|
+
// Opens with the name as a field, as if the person just chose Rename.
|
|
12
|
+
var _b = useState(true), editing = _b[0], setEditing = _b[1];
|
|
13
|
+
var _c = useState('Q3 plan'), draft = _c[0], setDraft = _c[1];
|
|
14
|
+
// Enter and Escape end the edit before the field goes away, so its blur must not save again.
|
|
15
|
+
var ended = useRef(false);
|
|
16
|
+
function startEditing() {
|
|
17
|
+
ended.current = false;
|
|
18
|
+
setDraft(name);
|
|
19
|
+
setEditing(true);
|
|
20
|
+
}
|
|
21
|
+
function save() {
|
|
22
|
+
if (ended.current)
|
|
23
|
+
return;
|
|
24
|
+
ended.current = true;
|
|
25
|
+
var next = draft.trim();
|
|
26
|
+
// An empty or unchanged name cancels: there is nothing to send.
|
|
27
|
+
// Otherwise a real app sends the new name to the server here and shows it at once.
|
|
28
|
+
if (next && next !== name)
|
|
29
|
+
setName(next);
|
|
30
|
+
setEditing(false);
|
|
31
|
+
}
|
|
32
|
+
function cancel() {
|
|
33
|
+
if (ended.current)
|
|
34
|
+
return;
|
|
35
|
+
ended.current = true;
|
|
36
|
+
setEditing(false);
|
|
37
|
+
}
|
|
38
|
+
return (<Center width="page">
|
|
39
|
+
<Stack gap="medium">
|
|
40
|
+
{editing ? (<TextField id="rename-inline-name" label="Project name" value={draft} autoFocus onChange={function (e) { return setDraft(e.target.value); }} onKeyDown={function (e) {
|
|
41
|
+
if (e.key === 'Enter') {
|
|
42
|
+
e.preventDefault();
|
|
43
|
+
save();
|
|
44
|
+
}
|
|
45
|
+
else if (e.key === 'Escape') {
|
|
46
|
+
e.preventDefault();
|
|
47
|
+
cancel();
|
|
48
|
+
}
|
|
49
|
+
}} onBlur={save}/>) : (<Cluster gap="small">
|
|
50
|
+
<Heading level={1} size="h5">{name}</Heading>
|
|
51
|
+
<Tooltip title="Rename">
|
|
52
|
+
<IconButton color="iconOnly" state="enabled" size="small" iconName="Pencil" ariaLabel="Rename project" onClick={startEditing}/>
|
|
53
|
+
</Tooltip>
|
|
54
|
+
</Cluster>)}
|
|
55
|
+
<Paragraph tone="secondary" size="body2" measure="none">12 tasks. Updated 2 days ago by Dana Lee.</Paragraph>
|
|
56
|
+
</Stack>
|
|
57
|
+
</Center>);
|
|
58
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function RenameModal(): import("react").JSX.Element;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useEffect, useRef, useState } from 'react';
|
|
3
|
+
import Modal from '../../components/modal';
|
|
4
|
+
import Heading from '../../components/heading';
|
|
5
|
+
import Paragraph from '../../components/paragraph';
|
|
6
|
+
import Form from '../../components/form';
|
|
7
|
+
import TextField from '../../components/textField';
|
|
8
|
+
import Button from '../../components/button';
|
|
9
|
+
import { Center, Cluster, Stack } from '../../components/layout';
|
|
10
|
+
// Names the server already has. Type one to see the request fail.
|
|
11
|
+
var takenNames = ['website refresh', 'hiring plan', 'office move'];
|
|
12
|
+
export default function RenameModal() {
|
|
13
|
+
var _a = useState('Q3 plan'), name = _a[0], setName = _a[1];
|
|
14
|
+
// Opens on the Modal, as if the person just chose Rename Project.
|
|
15
|
+
var _b = useState(true), open = _b[0], setOpen = _b[1];
|
|
16
|
+
var _c = useState('Q3 plan'), draft = _c[0], setDraft = _c[1];
|
|
17
|
+
var _d = useState(''), nameError = _d[0], setNameError = _d[1];
|
|
18
|
+
var _e = useState(false), saving = _e[0], setSaving = _e[1];
|
|
19
|
+
var timer = useRef();
|
|
20
|
+
// Stops the request if the example goes away before it ends.
|
|
21
|
+
useEffect(function () { return function () { return clearTimeout(timer.current); }; }, []);
|
|
22
|
+
var next = draft.trim();
|
|
23
|
+
var canRename = next !== '' && next !== name;
|
|
24
|
+
function handleOpen() {
|
|
25
|
+
setDraft(name);
|
|
26
|
+
setNameError('');
|
|
27
|
+
setOpen(true);
|
|
28
|
+
}
|
|
29
|
+
// Escape, a click outside and Cancel all close it, except while the request runs.
|
|
30
|
+
function handleClose() {
|
|
31
|
+
if (saving)
|
|
32
|
+
return;
|
|
33
|
+
setOpen(false);
|
|
34
|
+
}
|
|
35
|
+
function handleRename() {
|
|
36
|
+
if (saving || !canRename)
|
|
37
|
+
return;
|
|
38
|
+
setNameError('');
|
|
39
|
+
setSaving(true);
|
|
40
|
+
// Stands in for the request to the server.
|
|
41
|
+
timer.current = setTimeout(function () {
|
|
42
|
+
setSaving(false);
|
|
43
|
+
if (takenNames.includes(next.toLowerCase())) {
|
|
44
|
+
setNameError("A project named '".concat(next, "' already exists. Choose another name."));
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
setName(next);
|
|
48
|
+
setOpen(false);
|
|
49
|
+
}, 1200);
|
|
50
|
+
}
|
|
51
|
+
return (<Center width="page">
|
|
52
|
+
<Stack gap="medium">
|
|
53
|
+
<Heading level={1} size="h5">{name}</Heading>
|
|
54
|
+
<Paragraph tone="secondary" size="body2" measure="none">12 tasks. Updated 2 days ago by Dana Lee.</Paragraph>
|
|
55
|
+
{/* A real app often opens Rename from a menu on the project. */}
|
|
56
|
+
<Cluster>
|
|
57
|
+
<Button size="small" type="secondary" state="enabled" label="Rename Project" onClickButton={handleOpen}/>
|
|
58
|
+
</Cluster>
|
|
59
|
+
</Stack>
|
|
60
|
+
<Modal isOpen={open} size="small" initialFocus="body" title="Rename Project" onClose={handleClose} actions={<>
|
|
61
|
+
<Button size="small" type="tertiary" state={saving ? 'disabled' : 'enabled'} label="Cancel" onClickButton={handleClose}/>
|
|
62
|
+
<Button size="small" type="primary" state={canRename ? 'enabled' : 'disabled'} label="Rename" loading={saving} onClickButton={handleRename}/>
|
|
63
|
+
</>}>
|
|
64
|
+
{/* The Form lets Enter in the field rename too. */}
|
|
65
|
+
<Form aria-label="Rename project" onSubmit={handleRename}>
|
|
66
|
+
<TextField id="rename-name" label="Project name" value={draft} disabled={saving} error={Boolean(nameError)} errorText={nameError} onChange={function (e) { setDraft(e.target.value); setNameError(''); }}/>
|
|
67
|
+
</Form>
|
|
68
|
+
</Modal>
|
|
69
|
+
</Center>);
|
|
70
|
+
}
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
# Rename
|
|
2
|
+
|
|
3
|
+
A person renames something, such as a project or a channel.
|
|
4
|
+
|
|
5
|
+
**Not built yet:** Commentify's two renames disagree on what leaving the field does: a project name cancels, a tag name saves. Scindo on the web labels its rename Modals' action 'Save', shows 'Saving...' while it runs, and writes a taken name as a red caption by hand.
|
|
6
|
+
|
|
7
|
+
## Do
|
|
8
|
+
|
|
9
|
+
- Title the Modal 'Rename' and the thing, such as 'Rename Project', and give its action the same verb: 'Rename'.
|
|
10
|
+
- Keep 'Rename' `state="disabled"` while the name is empty or unchanged.
|
|
11
|
+
- Save on Enter too: put the field in a `Form`.
|
|
12
|
+
- Show a name that is taken under the field, with `error` and `errorText`, and keep the Modal open.
|
|
13
|
+
- Focus the field with `autoFocus` when the name becomes a field in place.
|
|
14
|
+
- Save on Enter and when the person leaves the field. Cancel on Escape, and when the name is empty.
|
|
15
|
+
|
|
16
|
+
## Don't
|
|
17
|
+
|
|
18
|
+
- Do not label the Modal's action 'Save' or 'OK'.
|
|
19
|
+
- Do not show a toast after a rename. The new name shows where the old one was.
|
|
20
|
+
- Do not save an empty name.
|
|
21
|
+
- Do not drop what the person typed when they leave the field.
|
|
22
|
+
|
|
23
|
+
## Option: Rename in a Modal
|
|
24
|
+
|
|
25
|
+
Use when: Rename is opened from a menu or from far away from the name.
|
|
26
|
+
|
|
27
|
+
Uses: `Button`, `Center`, `Cluster`, `Form`, `Heading`, `Modal`, `Paragraph`, `Stack`, `TextField`
|
|
28
|
+
|
|
29
|
+
```tsx
|
|
30
|
+
'use client';
|
|
31
|
+
import { useEffect, useRef, useState } from 'react';
|
|
32
|
+
import Modal from 'oneslash-design-system/components/modal';
|
|
33
|
+
import Heading from 'oneslash-design-system/components/heading';
|
|
34
|
+
import Paragraph from 'oneslash-design-system/components/paragraph';
|
|
35
|
+
import Form from 'oneslash-design-system/components/form';
|
|
36
|
+
import TextField from 'oneslash-design-system/components/textField';
|
|
37
|
+
import Button from 'oneslash-design-system/components/button';
|
|
38
|
+
import { Center, Cluster, Stack } from 'oneslash-design-system/components/layout';
|
|
39
|
+
|
|
40
|
+
// Names the server already has. Type one to see the request fail.
|
|
41
|
+
const takenNames = ['website refresh', 'hiring plan', 'office move'];
|
|
42
|
+
|
|
43
|
+
export default function RenameModal() {
|
|
44
|
+
const [name, setName] = useState('Q3 plan');
|
|
45
|
+
// Opens on the Modal, as if the person just chose Rename Project.
|
|
46
|
+
const [open, setOpen] = useState(true);
|
|
47
|
+
const [draft, setDraft] = useState('Q3 plan');
|
|
48
|
+
const [nameError, setNameError] = useState('');
|
|
49
|
+
const [saving, setSaving] = useState(false);
|
|
50
|
+
const timer = useRef<ReturnType<typeof setTimeout>>();
|
|
51
|
+
|
|
52
|
+
// Stops the request if the example goes away before it ends.
|
|
53
|
+
useEffect(() => () => clearTimeout(timer.current), []);
|
|
54
|
+
|
|
55
|
+
const next = draft.trim();
|
|
56
|
+
const canRename = next !== '' && next !== name;
|
|
57
|
+
|
|
58
|
+
function handleOpen() {
|
|
59
|
+
setDraft(name);
|
|
60
|
+
setNameError('');
|
|
61
|
+
setOpen(true);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// Escape, a click outside and Cancel all close it, except while the request runs.
|
|
65
|
+
function handleClose() {
|
|
66
|
+
if (saving) return;
|
|
67
|
+
setOpen(false);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function handleRename() {
|
|
71
|
+
if (saving || !canRename) return;
|
|
72
|
+
setNameError('');
|
|
73
|
+
setSaving(true);
|
|
74
|
+
// Stands in for the request to the server.
|
|
75
|
+
timer.current = setTimeout(() => {
|
|
76
|
+
setSaving(false);
|
|
77
|
+
if (takenNames.includes(next.toLowerCase())) {
|
|
78
|
+
setNameError(`A project named '${next}' already exists. Choose another name.`);
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
setName(next);
|
|
82
|
+
setOpen(false);
|
|
83
|
+
}, 1200);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return (
|
|
87
|
+
<Center width="page">
|
|
88
|
+
<Stack gap="medium">
|
|
89
|
+
<Heading level={1} size="h5">{name}</Heading>
|
|
90
|
+
<Paragraph tone="secondary" size="body2" measure="none">12 tasks. Updated 2 days ago by Dana Lee.</Paragraph>
|
|
91
|
+
{/* A real app often opens Rename from a menu on the project. */}
|
|
92
|
+
<Cluster>
|
|
93
|
+
<Button size="small" type="secondary" state="enabled" label="Rename Project" onClickButton={handleOpen} />
|
|
94
|
+
</Cluster>
|
|
95
|
+
</Stack>
|
|
96
|
+
<Modal
|
|
97
|
+
isOpen={open}
|
|
98
|
+
size="small"
|
|
99
|
+
initialFocus="body"
|
|
100
|
+
title="Rename Project"
|
|
101
|
+
onClose={handleClose}
|
|
102
|
+
actions={
|
|
103
|
+
<>
|
|
104
|
+
<Button size="small" type="tertiary" state={saving ? 'disabled' : 'enabled'} label="Cancel" onClickButton={handleClose} />
|
|
105
|
+
<Button size="small" type="primary" state={canRename ? 'enabled' : 'disabled'} label="Rename" loading={saving} onClickButton={handleRename} />
|
|
106
|
+
</>
|
|
107
|
+
}
|
|
108
|
+
>
|
|
109
|
+
{/* The Form lets Enter in the field rename too. */}
|
|
110
|
+
<Form aria-label="Rename project" onSubmit={handleRename}>
|
|
111
|
+
<TextField id="rename-name" label="Project name" value={draft} disabled={saving} error={Boolean(nameError)} errorText={nameError} onChange={(e) => { setDraft(e.target.value); setNameError(''); }} />
|
|
112
|
+
</Form>
|
|
113
|
+
</Modal>
|
|
114
|
+
</Center>
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## Option: Rename in place
|
|
120
|
+
|
|
121
|
+
Use when: The name is on screen, and it becomes a field.
|
|
122
|
+
|
|
123
|
+
Uses: `Center`, `Cluster`, `Heading`, `IconButton`, `Paragraph`, `Stack`, `TextField`, `Tooltip`
|
|
124
|
+
|
|
125
|
+
```tsx
|
|
126
|
+
'use client';
|
|
127
|
+
import { useRef, useState } from 'react';
|
|
128
|
+
import Heading from 'oneslash-design-system/components/heading';
|
|
129
|
+
import Paragraph from 'oneslash-design-system/components/paragraph';
|
|
130
|
+
import TextField from 'oneslash-design-system/components/textField';
|
|
131
|
+
import IconButton from 'oneslash-design-system/components/iconButton';
|
|
132
|
+
import Tooltip from 'oneslash-design-system/components/tooltip';
|
|
133
|
+
import { Center, Cluster, Stack } from 'oneslash-design-system/components/layout';
|
|
134
|
+
|
|
135
|
+
export default function RenameInline() {
|
|
136
|
+
const [name, setName] = useState('Q3 plan');
|
|
137
|
+
// Opens with the name as a field, as if the person just chose Rename.
|
|
138
|
+
const [editing, setEditing] = useState(true);
|
|
139
|
+
const [draft, setDraft] = useState('Q3 plan');
|
|
140
|
+
// Enter and Escape end the edit before the field goes away, so its blur must not save again.
|
|
141
|
+
const ended = useRef(false);
|
|
142
|
+
|
|
143
|
+
function startEditing() {
|
|
144
|
+
ended.current = false;
|
|
145
|
+
setDraft(name);
|
|
146
|
+
setEditing(true);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
function save() {
|
|
150
|
+
if (ended.current) return;
|
|
151
|
+
ended.current = true;
|
|
152
|
+
const next = draft.trim();
|
|
153
|
+
// An empty or unchanged name cancels: there is nothing to send.
|
|
154
|
+
// Otherwise a real app sends the new name to the server here and shows it at once.
|
|
155
|
+
if (next && next !== name) setName(next);
|
|
156
|
+
setEditing(false);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
function cancel() {
|
|
160
|
+
if (ended.current) return;
|
|
161
|
+
ended.current = true;
|
|
162
|
+
setEditing(false);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
return (
|
|
166
|
+
<Center width="page">
|
|
167
|
+
<Stack gap="medium">
|
|
168
|
+
{editing ? (
|
|
169
|
+
<TextField
|
|
170
|
+
id="rename-inline-name"
|
|
171
|
+
label="Project name"
|
|
172
|
+
value={draft}
|
|
173
|
+
autoFocus
|
|
174
|
+
onChange={(e) => setDraft(e.target.value)}
|
|
175
|
+
onKeyDown={(e) => {
|
|
176
|
+
if (e.key === 'Enter') {
|
|
177
|
+
e.preventDefault();
|
|
178
|
+
save();
|
|
179
|
+
} else if (e.key === 'Escape') {
|
|
180
|
+
e.preventDefault();
|
|
181
|
+
cancel();
|
|
182
|
+
}
|
|
183
|
+
}}
|
|
184
|
+
onBlur={save}
|
|
185
|
+
/>
|
|
186
|
+
) : (
|
|
187
|
+
<Cluster gap="small">
|
|
188
|
+
<Heading level={1} size="h5">{name}</Heading>
|
|
189
|
+
<Tooltip title="Rename">
|
|
190
|
+
<IconButton color="iconOnly" state="enabled" size="small" iconName="Pencil" ariaLabel="Rename project" onClick={startEditing} />
|
|
191
|
+
</Tooltip>
|
|
192
|
+
</Cluster>
|
|
193
|
+
)}
|
|
194
|
+
<Paragraph tone="secondary" size="body2" measure="none">12 tasks. Updated 2 days ago by Dana Lee.</Paragraph>
|
|
195
|
+
</Stack>
|
|
196
|
+
</Center>
|
|
197
|
+
);
|
|
198
|
+
}
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
## Native
|
|
202
|
+
|
|
203
|
+
On Apple rename in place in a list with a `TextField` and `.onSubmit`. Use an `.alert` with a `TextField` when the name is not on screen.
|
|
204
|
+
|
|
205
|
+
Seen in: Commentify, Scindo.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function RouteLoadingFullScreen(): import("react").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function RouteLoadingRegion(): import("react").JSX.Element;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import Image from '../../components/image';
|
|
3
|
+
import TabsContainer from '../../components/tabsContainer';
|
|
4
|
+
import Tab from '../../components/tab';
|
|
5
|
+
import Surface from '../../components/surface';
|
|
6
|
+
import LoadingScreen from '../../components/loadingScreen';
|
|
7
|
+
import { Cluster, Stack } from '../../components/layout';
|
|
8
|
+
// The product's mark. A real app passes its own file.
|
|
9
|
+
var productMark = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Crect width='40' height='40' rx='10' fill='%232f6b4f'/%3E%3Cpath d='M20 9 31 31h-6l-5-11-5 11H9z' fill='%23fff'/%3E%3C/svg%3E";
|
|
10
|
+
// A real app passes the router from its framework, such as Next's useRouter().
|
|
11
|
+
var router = { push: function (url) { return console.info("Go to ".concat(url)); } };
|
|
12
|
+
export default function RouteLoadingRegion() {
|
|
13
|
+
return (<Stack gap="large">
|
|
14
|
+
<Cluster gap="large">
|
|
15
|
+
<Image src={productMark} alt="Acme" width={32} height={32}/>
|
|
16
|
+
<TabsContainer>
|
|
17
|
+
<Tab label="Home" isSelected={false} href="/" router={router} onClickTab={function () { }}/>
|
|
18
|
+
<Tab label="Projects" isSelected href="/projects" router={router} onClickTab={function () { }}/>
|
|
19
|
+
<Tab label="Settings" isSelected={false} href="/settings" router={router} onClickTab={function () { }}/>
|
|
20
|
+
</TabsContainer>
|
|
21
|
+
</Cluster>
|
|
22
|
+
<Surface minHeight="tall" align="center">
|
|
23
|
+
<LoadingScreen />
|
|
24
|
+
</Surface>
|
|
25
|
+
</Stack>);
|
|
26
|
+
}
|