@codecademy/styleguide 79.1.4-alpha.7f2ebb.0 → 79.1.4-alpha.b73667.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/.storybook/components/Elements/ImageGallery.tsx +1 -1
- package/CHANGELOG.md +1 -1
- package/package.json +2 -2
- package/src/lib/Atoms/Animations/ExpandInCollapseOut/ExpandInCollapseOut.stories.tsx +1 -1
- package/src/lib/Atoms/Animations/FadeInSlideOut/FadeInSlideOut.stories.tsx +1 -1
- package/src/lib/Meta/ESLint rules.mdx +1 -1
- package/src/lib/Meta/Installation.mdx +30 -7
- package/src/lib/UX Writing/Component guidelines/Confirmation dialogs.mdx +26 -44
- package/src/static/ux writing/clear_chat.png +0 -0
- package/src/static/ux writing/delete_study_plan.png +0 -0
- package/src/static/ux writing/delete_this_course.png +0 -0
|
@@ -3,7 +3,7 @@ import { GamutIconProps } from '@codecademy/gamut-icons';
|
|
|
3
3
|
import { IllustrationProps } from '@codecademy/gamut-illustrations';
|
|
4
4
|
import { PatternProps } from '@codecademy/gamut-patterns';
|
|
5
5
|
import { css, timingValues } from '@codecademy/gamut-styles';
|
|
6
|
-
import { motion, AnimatePresence } from '
|
|
6
|
+
import { motion, AnimatePresence } from 'motion/react';
|
|
7
7
|
import * as React from 'react';
|
|
8
8
|
import { useState } from 'react';
|
|
9
9
|
import styled from '@emotion/styled';
|
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
### [79.1.4-alpha.
|
|
6
|
+
### [79.1.4-alpha.b73667.0](https://github.com/Codecademy/gamut/compare/@codecademy/styleguide@79.1.3...@codecademy/styleguide@79.1.4-alpha.b73667.0) (2026-03-04)
|
|
7
7
|
|
|
8
8
|
**Note:** Version bump only for package @codecademy/styleguide
|
|
9
9
|
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codecademy/styleguide",
|
|
3
3
|
"description": "Styleguide & Component library for codecademy.com",
|
|
4
|
-
"version": "79.1.4-alpha.
|
|
4
|
+
"version": "79.1.4-alpha.b73667.0",
|
|
5
5
|
"author": "Codecademy Engineering",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"access": "public"
|
|
9
9
|
},
|
|
10
10
|
"repository": "git@github.com:Codecademy/gamut.git",
|
|
11
|
-
"gitHead": "
|
|
11
|
+
"gitHead": "8a91141443415c39aa3359b61abbb2719b22714b"
|
|
12
12
|
}
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
FlexBox,
|
|
6
6
|
} from '@codecademy/gamut';
|
|
7
7
|
import type { Meta } from '@storybook/react';
|
|
8
|
-
import { AnimatePresence } from '
|
|
8
|
+
import { AnimatePresence } from 'motion/react';
|
|
9
9
|
import { PropsWithChildren, useState } from 'react';
|
|
10
10
|
|
|
11
11
|
const meta: Meta<typeof ExpandInCollapseOut> = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Box, FadeInSlideOut, FillButton, FlexBox } from '@codecademy/gamut';
|
|
2
2
|
import type { Meta } from '@storybook/react';
|
|
3
|
-
import { AnimatePresence } from '
|
|
3
|
+
import { AnimatePresence } from 'motion/react';
|
|
4
4
|
import { useState } from 'react';
|
|
5
5
|
|
|
6
6
|
const meta: Meta<typeof FadeInSlideOut> = {
|
|
@@ -79,7 +79,7 @@ const ExpandableContainer = styled.Box(
|
|
|
79
79
|
|
|
80
80
|
#### Disabling the rule
|
|
81
81
|
|
|
82
|
-
For third-party components or edge cases where inline styles are necessary (e.g.,
|
|
82
|
+
For third-party components or edge cases where inline styles are necessary (e.g., motion animations), you can disable the rule:
|
|
83
83
|
|
|
84
84
|
```tsx
|
|
85
85
|
// eslint-disable-next-line gamut/no-inline-style
|
|
@@ -39,21 +39,44 @@ yarn add @codecademy/gamut-kit @emotion/react @emotion/styled
|
|
|
39
39
|
|
|
40
40
|
3. Wrap your application root with `GamutProvider` and give it the theme you would like to use for your app.
|
|
41
41
|
|
|
42
|
+
**React 19:**
|
|
43
|
+
|
|
42
44
|
```tsx
|
|
43
45
|
import React from 'react';
|
|
44
|
-
import {
|
|
46
|
+
import { createRoot } from 'react-dom/client';
|
|
45
47
|
import { GamutProvider, theme } from '@codecademy/gamut-styles';
|
|
46
48
|
|
|
47
49
|
import { App } from './App';
|
|
48
50
|
|
|
49
51
|
const rootElement = document.getElementById('root');
|
|
52
|
+
if (rootElement) {
|
|
53
|
+
const root = createRoot(rootElement);
|
|
54
|
+
root.render(
|
|
55
|
+
<GamutProvider>
|
|
56
|
+
<App />
|
|
57
|
+
</GamutProvider>
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
```
|
|
50
61
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
62
|
+
**React 18:**
|
|
63
|
+
|
|
64
|
+
```tsx
|
|
65
|
+
import React from 'react';
|
|
66
|
+
import { render } from 'react-dom';
|
|
67
|
+
import { GamutProvider, theme } from '@codecademy/gamut-styles';
|
|
68
|
+
|
|
69
|
+
import { App } from './App';
|
|
70
|
+
|
|
71
|
+
const rootElement = document.getElementById('root');
|
|
72
|
+
if (rootElement) {
|
|
73
|
+
render(
|
|
74
|
+
<GamutProvider>
|
|
75
|
+
<App />
|
|
76
|
+
</GamutProvider>,
|
|
77
|
+
rootElement
|
|
78
|
+
);
|
|
79
|
+
}
|
|
57
80
|
```
|
|
58
81
|
|
|
59
82
|
GamutProvider handles a few critical tasks that need to happen in order for components to work.
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Meta } from '@storybook/blocks';
|
|
2
2
|
|
|
3
|
-
import { AboutHeader,
|
|
3
|
+
import { AboutHeader, LinkTo } from '~styleguide/blocks';
|
|
4
4
|
|
|
5
5
|
export const parameters = {
|
|
6
6
|
title: 'Confirmation dialogs',
|
|
7
7
|
subtitle:
|
|
8
|
-
'
|
|
8
|
+
'Simplify the language, prioritize the message, and make sure the implication of what learners are saying "Yes" (or "No") to is crystal clear.',
|
|
9
9
|
status: 'static',
|
|
10
10
|
design: {
|
|
11
11
|
type: 'figma',
|
|
@@ -17,57 +17,39 @@ export const parameters = {
|
|
|
17
17
|
|
|
18
18
|
<AboutHeader {...parameters} />
|
|
19
19
|
|
|
20
|
-
Confirmation
|
|
20
|
+
Confirmation dialog boxes are used to verify that a learner wants to take a specific action. They are generally used for actions that are irreversible, may result in critical consequences or loss of data, have other severe consequences, or happen infrequently.
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
- Loss of data, time, or work (e.g., deleting a course)
|
|
24
|
-
- Unexpected consequences (e.g., losing learning history on an existing prototype when when generating a new prototype)
|
|
25
|
-
|
|
26
|
-
Adding friction for these purposes helps improve trust and avoid unintentional actions by making sure learners clearly understand the consequences before continuing. It also lets us offer alternatives or undo options when needed.
|
|
22
|
+
They use the <LinkTo id="Molecules/Modals/Dialog">Dialog component in Gamut</LinkTo> and, for actions with serious or irreversible consequences, the `Danger` variant should be used.
|
|
27
23
|
|
|
28
24
|
## Best practices
|
|
29
25
|
|
|
30
|
-
###
|
|
31
|
-
|
|
32
|
-
- **Ask or inform about one main action**, mirroring the button that triggered the confirmation dialog.
|
|
33
|
-
- **Frame your headline as a binary question**, when possible, with 2 unambiguous answers.
|
|
34
|
-
- **Avoid generic “Are you sure?” headings and body text.** This phrasing takes up space, increases cognitive load, and may undermine users' confidence or be interpreted as patronizing.
|
|
35
|
-
|
|
36
|
-
### Body (optional)
|
|
37
|
-
|
|
38
|
-
- **Add essential information about the contextual consequences.** State what will happen, what will be lost/changed, and any critical conditions.
|
|
39
|
-
- **Avoid redundancy.** If the heading is already self-explanatory, the body is not needed.
|
|
40
|
-
- **Keep to 1–2 lines, unless more is required to get all the information across.**
|
|
41
|
-
|
|
42
|
-
### Buttons (CTA1 and CTA2)
|
|
26
|
+
### Headline
|
|
43
27
|
|
|
44
|
-
- **
|
|
45
|
-
- **
|
|
46
|
-
- **
|
|
47
|
-
- Whenever possible, be specific about the alternative. However, when space is limited, 'Cancel' can be used.
|
|
28
|
+
- **Ask or inform about one main action**, clearly and simply.
|
|
29
|
+
- **Frame your headline as a binary question**, when possible, with 2 unambiguous answers (i.e. Yes/No, Stay/Leave).
|
|
30
|
+
- **Be specific.** Instead of "Are you sure?" focus on what you want to ensure they're sure about (i.e. "Reset your progress?" or "Delete the file?").
|
|
48
31
|
|
|
49
|
-
###
|
|
32
|
+
### Explanation
|
|
50
33
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
34
|
+
- **Share only relevant information** that may help the learner make their decision.
|
|
35
|
+
- **Avoid redundancy.** If you've already set the stage in your headline, there's no need to re-ask the same question in your explanation. If the explanation doesn't add anything new, leave it out (i.e. "Permanently delete this item? Yes/No").
|
|
36
|
+
- **Avoid filler.** Questions like "Are you sure you want to \_\_\_?" take up space, increase cognitive load, and may undermine users' confidence or be interpreted as patronizing.
|
|
37
|
+
- **Keep to 1-2 lines**, unless more is required to get all the information across.
|
|
55
38
|
|
|
56
|
-
|
|
57
|
-
src="./ux writing/delete_study_plan.png"
|
|
58
|
-
alt="Delete study plan confirmation dialog"
|
|
59
|
-
/>
|
|
39
|
+
### Button copy
|
|
60
40
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
/>
|
|
41
|
+
- **Options should be clear and distinct.** Each option should be distinctly different and there should be no opportunity for learners to mix them up (i.e. "Delete" and "Cancel" are ambiguous choices whereas "Yes, remove" and "Cancel" clear up the confusion.
|
|
42
|
+
- **Add context to reaffirm the action.** Instead of "Yes," use "Yes, reset progress."
|
|
43
|
+
- **Match the verb in your headline.** If you use "Save" in your headline, use "Save" in your button copy, rather than keep. Consistency helps keep the message clear. All of this should also match whatever the learner clicked on that triggered the confirmation dialog.
|
|
65
44
|
|
|
66
45
|
## Checklist
|
|
67
46
|
|
|
68
|
-
- Is the
|
|
69
|
-
-
|
|
70
|
-
-
|
|
71
|
-
- Does the
|
|
72
|
-
-
|
|
73
|
-
-
|
|
47
|
+
- Is the language consistent from the wording on the button that opened the confirmation box, to the headline,
|
|
48
|
+
- Does the headline make the action clear?
|
|
49
|
+
- Is the headline framed as a question, if possible?
|
|
50
|
+
- Does the explanation provide relevant details and consequences of the action?
|
|
51
|
+
- Is the explanation 1-2 lines long?
|
|
52
|
+
- Are the words on the buttons clear and distinct?
|
|
53
|
+
- Do the buttons include context to reaffirm the action?
|
|
54
|
+
- Is your copy at a reading level of grade 7 or below? Test with [Hemingway App](https://hemingwayapp.com).
|
|
55
|
+
- Have you asked someone unrelated to the project to read the message and did they understand it?
|
|
Binary file
|
|
Binary file
|
|
Binary file
|