@codecademy/styleguide 79.1.4-alpha.feaf95.0 → 79.1.4

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/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.feaf95.0](https://github.com/Codecademy/gamut/compare/@codecademy/styleguide@79.1.3...@codecademy/styleguide@79.1.4-alpha.feaf95.0) (2026-03-05)
6
+ ### [79.1.4](https://github.com/Codecademy/gamut/compare/@codecademy/styleguide@79.1.3...@codecademy/styleguide@79.1.4) (2026-03-09)
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.feaf95.0",
4
+ "version": "79.1.4",
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": "9e31be8521b0139f2b0436a7c547b88f642deb26"
11
+ "gitHead": "d98acbdeb5f02be1c5b6592f2968300b9c0c19fe"
12
12
  }
@@ -24,12 +24,6 @@ export const parameters = {
24
24
 
25
25
  <ComponentHeader {...parameters} />
26
26
 
27
- ## FOR TESTING/DEMONSTRATION PURPOSES ONLY
28
-
29
- Verify that the beak renders correctly without the background covering any content
30
-
31
- <Canvas of={PopoverStories.ClearBeakExample} />
32
-
33
27
  ## Usage
34
28
 
35
29
  Popovers are generally used for interactive contents, such as new and exciting features for users to try.
@@ -7,8 +7,6 @@ import {
7
7
  PopoverProps,
8
8
  } from '@codecademy/gamut';
9
9
  import * as patterns from '@codecademy/gamut-patterns';
10
- import { theme } from '@codecademy/gamut-styles';
11
- import styled from '@emotion/styled';
12
10
  import type { Meta, StoryObj } from '@storybook/react';
13
11
  import { useRef, useState } from 'react';
14
12
 
@@ -33,23 +31,13 @@ const PopoverExample = ({ p = 16, ...rest }: PopoverExampleProps) => {
33
31
  const [open, setOpen] = useState(false);
34
32
  const activeElRef = useRef<HTMLDivElement>(null);
35
33
  const toggleOpen = () => setOpen(!open);
36
-
37
- const PopoverWithClearBeak = styled(Popover)`
38
- & [data-testid='popover-beak'] {
39
- background: linear-gradient(
40
- to top left,
41
- ${theme.colors['background-current']} 50%,
42
- transparent 50%
43
- );
44
- }
45
- `;
46
34
  return (
47
35
  <>
48
36
  <Box ref={activeElRef} width="fit-content">
49
37
  <FillButton onClick={toggleOpen}>Open Popover</FillButton>
50
38
  </Box>
51
39
  <FlexBox>
52
- <PopoverWithClearBeak
40
+ <Popover
53
41
  {...(rest as any)}
54
42
  isOpen={open}
55
43
  targetRef={activeElRef}
@@ -61,37 +49,12 @@ const PopoverExample = ({ p = 16, ...rest }: PopoverExampleProps) => {
61
49
  Close Popover
62
50
  </FillButton>
63
51
  </FlexBox>
64
- </PopoverWithClearBeak>
52
+ </Popover>
65
53
  </FlexBox>
66
54
  </>
67
55
  );
68
56
  };
69
57
 
70
- export const ClearBeakExample: Story = {
71
- render: (args) => (
72
- <FlexBox gap={16}>
73
- <PopoverExample {...args} beak="center" p={0} />
74
- <PopoverExample {...args} beak="center" p={0} position="above" />
75
- <PopoverExample
76
- {...args}
77
- align="right"
78
- beak="center"
79
- p={0}
80
- pattern={undefined}
81
- position="center"
82
- />
83
- <PopoverExample
84
- {...args}
85
- align="left"
86
- beak="center"
87
- p={0}
88
- pattern={undefined}
89
- position="center"
90
- />
91
- </FlexBox>
92
- ),
93
- };
94
-
95
58
  export const Default: Story = {
96
59
  render: (args) => <PopoverExample {...args} />,
97
60
  };
@@ -1,11 +1,11 @@
1
1
  import { Meta } from '@storybook/blocks';
2
2
 
3
- import { AboutHeader, LinkTo } from '~styleguide/blocks';
3
+ import { AboutHeader, ImageWrapper, LinkTo } from '~styleguide/blocks';
4
4
 
5
5
  export const parameters = {
6
6
  title: 'Confirmation dialogs',
7
7
  subtitle:
8
- 'Simplify the language, prioritize the message, and make sure the implication of what learners are saying "Yes" (or "No") to is crystal clear.',
8
+ 'Use the same verb from the triggering button, heading, to action confirmation button; clearly communicate the consequences; and keep the copy decision-focused.',
9
9
  status: 'static',
10
10
  design: {
11
11
  type: 'figma',
@@ -17,39 +17,57 @@ export const parameters = {
17
17
 
18
18
  <AboutHeader {...parameters} />
19
19
 
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.
20
+ Confirmation dialogs use the <LinkTo id="Molecules/Modals/Dialog">Dialog component in Gamut</LinkTo> to create intentional friction to verify that a learner wants to take a high-impact action, such as:
21
21
 
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.
22
+ - Irreversible actions (e.g., submitting payment)
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.
23
27
 
24
28
  ## Best practices
25
29
 
26
- ### Headline
30
+ ### Heading
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)
27
43
 
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?").
44
+ - **Avoid using “Yes” or “No,”** as they can be misinterpreted in global English and internationalization contexts.
45
+ - **CTA1 matches the verb from the heading** to confirm the action.
46
+ - **CTA2 clarifies the alternative or undo** path.
47
+ - Whenever possible, be specific about the alternative. However, when space is limited, 'Cancel' can be used.
31
48
 
32
- ### Explanation
49
+ ### Examples — putting it all together
33
50
 
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.
51
+ <ImageWrapper
52
+ src="./ux writing/delete_this_course.png"
53
+ alt="Delete this course confirmation dialog"
54
+ />
38
55
 
39
- ### Button copy
56
+ <ImageWrapper
57
+ src="./ux writing/delete_study_plan.png"
58
+ alt="Delete study plan confirmation dialog"
59
+ />
40
60
 
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.
61
+ <ImageWrapper
62
+ src="./ux writing/clear_chat.png"
63
+ alt="Clear chat confirmation dialog"
64
+ />
44
65
 
45
66
  ## Checklist
46
67
 
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?
68
+ - Is the action irreversible, destructive, or has unexpected consequences? If not, consider using a different pattern.
69
+ - Is the same verb used from the action triggering the confirmation dialog, to the heading, to CTA1?
70
+ - Did you avoid filler language such as “Are you sure you want to...?”
71
+ - Does the body front-load the critical consequence in 1–3 lines?
72
+ - Are the buttons mutually exclusive (and avoid using “Yes/No”)?
73
+ - Is there a safer alternative or undo to mention? (If available, offer the option as CTA2.)