Skip to content

Commit 025b2bf

Browse files
Merge branch 'main' into sg-inline-tooltip-beak-fix
2 parents 2450f14 + f26f5ba commit 025b2bf

File tree

8 files changed

+66
-19
lines changed

8 files changed

+66
-19
lines changed

packages/styleguide/.storybook/components/Scales/ColorScale.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as React from 'react';
22
import { themed } from '@codecademy/gamut-styles';
33
import styled from '@emotion/styled';
4-
import { Card, GridBox } from '@codecademy/gamut/src';
4+
import { Box, GridBox } from '@codecademy/gamut/src';
55

66
const HexCode = styled.span`
77
font-family: ${themed('fontFamily.monospace')};
@@ -19,19 +19,20 @@ export const ColorScale: React.FC<{ colors: Record<string, string> }> = ({
1919

2020
return (
2121
<>
22-
<Card
22+
<Box
2323
p={0}
2424
width="100%"
2525
borderRadius="md"
2626
display="grid"
2727
minHeight="3rem"
2828
gridAutoFlow="column"
2929
overflow="hidden"
30+
border={1}
3031
>
3132
{weights.map(([key, hex]) => (
3233
<Color key={`color-${key}`} bg={hex} />
3334
))}
34-
</Card>
35+
</Box>
3536
<GridBox width="100%" p={4} gridAutoFlow="column">
3637
{weights.map(([key, hex]) => (
3738
<GridBox

packages/styleguide/CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,18 @@
33
All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

6+
### [71.1.2](https://github.com/Codecademy/gamut/compare/@codecademy/styleguide@71.1.1...@codecademy/styleguide@71.1.2) (2025-04-03)
7+
8+
### Bug Fixes
9+
10+
- **ColorScale:** updated notations for colors that have hyphen in their names ([6470234](https://github.com/Codecademy/gamut/commit/6470234693ca7d422e762b5c369f0f2cc291a971))
11+
12+
### [71.1.1](https://github.com/Codecademy/gamut/compare/@codecademy/styleguide@71.1.0...@codecademy/styleguide@71.1.1) (2025-04-03)
13+
14+
### Bug Fixes
15+
16+
- **colorscale:** grid display fixed for color swatches ([27e9c87](https://github.com/Codecademy/gamut/commit/27e9c87d2e46da7e2d7dacc898ec2a02952abe17))
17+
618
## [71.1.0](https://github.com/Codecademy/gamut/compare/@codecademy/styleguide@71.0.1...@codecademy/styleguide@71.1.0) (2025-04-02)
719

820
### Features

packages/styleguide/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@codecademy/styleguide",
33
"description": "Styleguide & Component library for codecademy.com",
4-
"version": "71.1.0",
4+
"version": "71.1.2",
55
"author": "Codecademy Engineering",
66
"license": "MIT",
77
"publishConfig": {

packages/styleguide/src/lib/Foundations/shared/adminElements.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { adminTheme, Background } from '@codecademy/gamut-styles';
22

33
import { Code, ColorScale, TokenTable } from '~styleguide/blocks';
44

5+
import { applyCorrectNotation } from './applyCorrectNotation';
56
import { PATH_COLUMN, PROP_COLUMN } from './elements';
67

78
export const adminLightMode = {
@@ -13,7 +14,9 @@ export const adminLightMode = {
1314
{ ...PROP_COLUMN, size: 'lg' },
1415
{
1516
...PATH_COLUMN,
16-
render: ({ id }: any) => <Code>theme.colors.{id}</Code>,
17+
render: ({ id }: any) => (
18+
<Code>theme.colors{applyCorrectNotation({ id })}</Code>
19+
),
1720
},
1821
{
1922
key: 'swatch',
@@ -39,7 +42,9 @@ export const adminDarkMode = {
3942
{ ...PROP_COLUMN, size: 'lg' },
4043
{
4144
...PATH_COLUMN,
42-
render: ({ id }: any) => <Code>theme.colors.{id}</Code>,
45+
render: ({ id }: any) => (
46+
<Code>theme.colors{applyCorrectNotation({ id })}</Code>
47+
),
4348
},
4449
{
4550
key: 'swatch',
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export const applyCorrectNotation = ({ id }: { id: string }) => {
2+
const hasHypen = id.includes('-');
3+
if (!hasHypen) return `.${id}`;
4+
return `['${id}']`;
5+
};

packages/styleguide/src/lib/Foundations/shared/elements.tsx

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import kebabCase from 'lodash/kebabCase';
1212

1313
import { Code, ColorScale, LinkTo, TokenTable } from '~styleguide/blocks';
1414

15+
import { applyCorrectNotation } from './applyCorrectNotation';
16+
1517
export const PROP_COLUMN = {
1618
key: 'key',
1719
name: 'Prop',
@@ -41,7 +43,9 @@ export const lightMode = {
4143
{ ...PROP_COLUMN, size: 'lg' },
4244
{
4345
...PATH_COLUMN,
44-
render: ({ id }: any) => <Code>theme.colors.{id}</Code>,
46+
render: ({ id }: any) => (
47+
<Code>theme.colors{applyCorrectNotation({ id })}</Code>
48+
),
4549
},
4650
{
4751
key: 'swatch',
@@ -67,7 +71,9 @@ export const darkMode = {
6771
{ ...PROP_COLUMN, size: 'lg' },
6872
{
6973
...PATH_COLUMN,
70-
render: ({ id }: any) => <Code>theme.colors.{id}</Code>,
74+
render: ({ id }: any) => (
75+
<Code>theme.colors{applyCorrectNotation({ id })}</Code>
76+
),
7177
},
7278
{
7379
key: 'swatch',
@@ -91,7 +97,9 @@ export const color = {
9197
PROP_COLUMN,
9298
{
9399
...PATH_COLUMN,
94-
render: ({ id }: any) => <Code>theme.colors.{id}</Code>,
100+
render: ({ id }: any) => (
101+
<Code>theme.colors{applyCorrectNotation({ id })}</Code>
102+
),
95103
},
96104
{
97105
key: 'swatch',
@@ -117,7 +125,7 @@ export const swatch = {
117125
render: ({ id, hexes }: any) => {
118126
return (
119127
<Code>
120-
theme.colors[`{id}-{Object.keys(hexes)[0]}`]
128+
theme.colors[&apos;{id}-{Object.keys(hexes)[0]}&apos;]
121129
</Code>
122130
);
123131
},
@@ -145,7 +153,7 @@ export const rgbaSwatch = {
145153
render: ({ id, hexes }: any) => {
146154
return (
147155
<Code>
148-
theme.colors[`{id}-{Object.keys(hexes)[0]}`]
156+
theme.colors[&apos;{id}-{Object.keys(hexes)[0]}&apos;]
149157
</Code>
150158
);
151159
},
@@ -195,7 +203,9 @@ export const lxStudioColor = {
195203
PROP_COLUMN,
196204
{
197205
...PATH_COLUMN,
198-
render: ({ id }: any) => <Code>theme.colors.{id}</Code>,
206+
render: ({ id }: any) => (
207+
<Code>theme.colors{applyCorrectNotation({ id })}</Code>
208+
),
199209
},
200210
{
201211
key: 'swatch',

packages/styleguide/src/lib/Foundations/shared/lxStudioElements.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77

88
import { Code, ColorScale, TokenTable } from '~styleguide/blocks';
99

10+
import { applyCorrectNotation } from './applyCorrectNotation';
1011
import {
1112
createExampleColumn,
1213
PATH_COLUMN,
@@ -23,7 +24,9 @@ export const lxStudioColor = {
2324
PROP_COLUMN,
2425
{
2526
...PATH_COLUMN,
26-
render: ({ id }: any) => <Code>theme.colors.{id}</Code>,
27+
render: ({ id }: any) => (
28+
<Code>theme.colors{applyCorrectNotation({ id })}</Code>
29+
),
2730
},
2831
{
2932
key: 'swatch',
@@ -43,7 +46,9 @@ export const lxStudioLightMode = {
4346
{ ...PROP_COLUMN, size: 'lg' },
4447
{
4548
...PATH_COLUMN,
46-
render: ({ id }: any) => <Code>theme.colors.{id}</Code>,
49+
render: ({ id }: any) => (
50+
<Code>theme.colors{applyCorrectNotation({ id })}</Code>
51+
),
4752
},
4853
{
4954
key: 'swatch',
@@ -71,7 +76,9 @@ export const lxStudioDarkMode = {
7176
{ ...PROP_COLUMN, size: 'lg' },
7277
{
7378
...PATH_COLUMN,
74-
render: ({ id }: any) => <Code>theme.colors.{id}</Code>,
79+
render: ({ id }: any) => (
80+
<Code>theme.colors{applyCorrectNotation({ id })}</Code>
81+
),
7582
},
7683
{
7784
key: 'swatch',

packages/styleguide/src/lib/Foundations/shared/platformElements.tsx

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77

88
import { Code, ColorScale, TokenTable } from '~styleguide/blocks';
99

10+
import { applyCorrectNotation } from './applyCorrectNotation';
1011
import { PATH_COLUMN, PROP_COLUMN } from './elements';
1112

1213
export const platformSwatch = {
@@ -20,7 +21,7 @@ export const platformSwatch = {
2021
...PATH_COLUMN,
2122
render: ({ id, hexes }: any) => (
2223
<Code>
23-
theme.colors[`{id}-{Object.keys(hexes)[0]}`]
24+
theme.colors[&apos;{id}-{Object.keys(hexes)[0]}&apos;]
2425
</Code>
2526
),
2627
},
@@ -44,7 +45,9 @@ export const platformColor = {
4445
PROP_COLUMN,
4546
{
4647
...PATH_COLUMN,
47-
render: ({ id }: any) => <Code>theme.colors.{id}</Code>,
48+
render: ({ id }: any) => (
49+
<Code>theme.colors{applyCorrectNotation({ id })}</Code>
50+
),
4851
},
4952
{
5053
key: 'swatch',
@@ -64,7 +67,9 @@ export const platformLightMode = {
6467
{ ...PROP_COLUMN, size: 'lg' },
6568
{
6669
...PATH_COLUMN,
67-
render: ({ id }: any) => <Code>theme.colors.{id}</Code>,
70+
render: ({ id }: any) => (
71+
<Code>theme.colors{applyCorrectNotation({ id })}</Code>
72+
),
6873
},
6974
{
7075
key: 'swatch',
@@ -92,7 +97,9 @@ export const platformDarkMode = {
9297
{ ...PROP_COLUMN, size: 'lg' },
9398
{
9499
...PATH_COLUMN,
95-
render: ({ id }: any) => <Code>theme.colors.{id}</Code>,
100+
render: ({ id }: any) => (
101+
<Code>theme.colors{applyCorrectNotation({ id })}</Code>
102+
),
96103
},
97104
{
98105
key: 'swatch',

0 commit comments

Comments
 (0)