Skip to content

Commit dd62240

Browse files
committed
feat: update components to align with brand color from govuk-frontend v6
1 parent cff7c1a commit dd62240

File tree

70 files changed

+18723
-10736
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+18723
-10736
lines changed

assets/uml-diagram.svg

Lines changed: 596 additions & 579 deletions
Loading

bundle-analysis-main.html

Lines changed: 9003 additions & 4879 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bundle-analysis-pdfvc.html

Lines changed: 7191 additions & 4882 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 5 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,10 @@
2424
"storybook": "storybook dev -p 6006 --debug-webpack",
2525
"build-storybook": "storybook build --debug-webpack",
2626
"test-storybook": "test-storybook",
27-
"lint": "eslint 'src/**/*.ts*' && stylelint 'src/**/*.{css,scss,less}'",
28-
"lint-fix": "eslint --fix 'src/**/*.ts*' && stylelint --fix 'src/**/*.{css,scss,less}' ",
27+
"format:check": "prettier --ignore-path .gitignore --check '**/*.+(js|mjs|ts|tsx|json|css|scss|html|md)'",
28+
"lint": "eslint 'src/**/*.ts*' && npm run format:check && stylelint 'src/**/*.{css,scss,less}'",
2929
"format": "prettier --ignore-path .gitignore --write '**/*.+(js|mjs|ts|tsx|json|css|scss|html|md)'",
30+
"lint-fix": "eslint --fix 'src/**/*.ts*' && npm run format && stylelint --fix 'src/**/*.{css,scss,less}' ",
3031
"prepare": "husky",
3132
"release": "standard-version",
3233
"uml": "tsuml2 --glob './src/**/\\!(*.spec|*.test|TestUtilities|JestSetup).[t]s?(x)' -o './assets/uml-diagram.svg'",
@@ -58,7 +59,7 @@
5859
"@babel/preset-env": "^7.29.2",
5960
"@babel/preset-react": "^7.28.5",
6061
"@babel/preset-typescript": "^7.28.5",
61-
"@chromatic-com/storybook": "^5.0.1",
62+
"@chromatic-com/storybook": "^5.0.2",
6263
"@commitlint/cli": "^20.5.0",
6364
"@commitlint/config-conventional": "^20.5.0",
6465
"@eslint/js": "^9.37.0",
@@ -171,4 +172,4 @@
171172
"dependencies": {
172173
"ts-dedent": "^2.2.0"
173174
}
174-
}
175+
}

src/components/Accordion/Accordion.stories.tsx

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,12 @@ let configured = false;
1515
const meta: Meta<typeof Accordion> = {
1616
title: "GOVUK Design System/Accordion",
1717
component: Accordion,
18-
decorators: [(Story, { parameters }) => {
18+
decorators: [
19+
(Story, { parameters }) => {
1920
React.useEffect(() => {
20-
const isDocsMode = window.location.search.includes("path=/docs/govuk-design-system-accordion--docs");
21+
const isDocsMode = window.location.search.includes(
22+
"path=/docs/govuk-design-system-accordion--docs",
23+
);
2124
if (isDocsMode && !configured && parameters.initializeConfigurations) {
2225
ConfigureOverallAccordion();
2326
configured = true;
@@ -26,7 +29,8 @@ const meta: Meta<typeof Accordion> = {
2629
}
2730
}, []);
2831
return <Story />;
29-
}],
32+
},
33+
],
3034
tags: ["autodocs"],
3135
};
3236

@@ -35,7 +39,8 @@ type Story = StoryObj<typeof Accordion>;
3539

3640
// extractShownFixtures transforms raw govuk-frontend fixture data into
3741
// React-compatible props (e.g. text → children, classes → className).
38-
const examplesFromFixtures: Array<ComponentFixture> = extractShownFixtures(fixtures);
42+
const examplesFromFixtures: Array<ComponentFixture> =
43+
extractShownFixtures(fixtures);
3944

4045
export const Default: Story = {
4146
name: "default",
@@ -44,15 +49,27 @@ export const Default: Story = {
4449

4550
export const WithAdditionalDescriptions: Story = {
4651
name: "with additional descriptions",
47-
args: { ...examplesFromFixtures.find((f) => f.name === "with additional descriptions")?.options },
52+
args: {
53+
...examplesFromFixtures.find(
54+
(f) => f.name === "with additional descriptions",
55+
)?.options,
56+
},
4857
};
4958

5059
export const WithLongContentAndDescription: Story = {
5160
name: "with long content and description",
52-
args: { ...examplesFromFixtures.find((f) => f.name === "with long content and description")?.options },
61+
args: {
62+
...examplesFromFixtures.find(
63+
(f) => f.name === "with long content and description",
64+
)?.options,
65+
},
5366
};
5467

5568
export const WithAllSectionsAlreadyOpen: Story = {
5669
name: "with all sections already open",
57-
args: { ...examplesFromFixtures.find((f) => f.name === "with all sections already open")?.options },
58-
};
70+
args: {
71+
...examplesFromFixtures.find(
72+
(f) => f.name === "with all sections already open",
73+
)?.options,
74+
},
75+
};

src/components/BackLink/BackLink.stories.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@ import { ComponentFixture } from "../../dynamics";
1212
const meta: Meta<typeof BackLink> = {
1313
title: "GOVUK Design System/Back link",
1414
component: BackLink,
15-
decorators: [(Story) => {
15+
decorators: [
16+
(Story) => {
1617
return <Story />;
17-
}],
18+
},
19+
],
1820
tags: ["autodocs"],
1921
};
2022

@@ -23,7 +25,8 @@ type Story = StoryObj<typeof BackLink>;
2325

2426
// extractShownFixtures transforms raw govuk-frontend fixture data into
2527
// React-compatible props (e.g. text → children, classes → className).
26-
const examplesFromFixtures: Array<ComponentFixture> = extractShownFixtures(fixtures);
28+
const examplesFromFixtures: Array<ComponentFixture> =
29+
extractShownFixtures(fixtures);
2730

2831
export const Default: Story = {
2932
name: "default",
@@ -33,4 +36,4 @@ export const Default: Story = {
3336
export const Inverse: Story = {
3437
name: "inverse",
3538
args: { ...examplesFromFixtures.find((f) => f.name === "inverse")?.options },
36-
};
39+
};

src/components/Breadcrumbs/Breadcrumbs.stories.tsx

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@ import { ComponentFixture } from "../../dynamics";
1212
const meta: Meta<typeof Breadcrumbs> = {
1313
title: "GOVUK Design System/Breadcrumbs",
1414
component: Breadcrumbs,
15-
decorators: [(Story) => {
15+
decorators: [
16+
(Story) => {
1617
return <Story />;
17-
}],
18+
},
19+
],
1820
tags: ["autodocs"],
1921
};
2022

@@ -23,7 +25,8 @@ type Story = StoryObj<typeof Breadcrumbs>;
2325

2426
// extractShownFixtures transforms raw govuk-frontend fixture data into
2527
// React-compatible props (e.g. text → children, classes → className).
26-
const examplesFromFixtures: Array<ComponentFixture> = extractShownFixtures(fixtures);
28+
const examplesFromFixtures: Array<ComponentFixture> =
29+
extractShownFixtures(fixtures);
2730

2831
export const Default: Story = {
2932
name: "default",
@@ -32,25 +35,37 @@ export const Default: Story = {
3235

3336
export const WithOneLevel: Story = {
3437
name: "with one level",
35-
args: { ...examplesFromFixtures.find((f) => f.name === "with one level")?.options },
38+
args: {
39+
...examplesFromFixtures.find((f) => f.name === "with one level")?.options,
40+
},
3641
};
3742

3843
export const WithoutTheHomeSection: Story = {
3944
name: "without the home section",
40-
args: { ...examplesFromFixtures.find((f) => f.name === "without the home section")?.options },
45+
args: {
46+
...examplesFromFixtures.find((f) => f.name === "without the home section")
47+
?.options,
48+
},
4149
};
4250

4351
export const WithLastBreadcrumbAsCurrentPage: Story = {
4452
name: "with last breadcrumb as current page",
45-
args: { ...examplesFromFixtures.find((f) => f.name === "with last breadcrumb as current page")?.options },
53+
args: {
54+
...examplesFromFixtures.find(
55+
(f) => f.name === "with last breadcrumb as current page",
56+
)?.options,
57+
},
4658
};
4759

4860
export const WithCollapseOnMobile: Story = {
4961
name: "with collapse on mobile",
50-
args: { ...examplesFromFixtures.find((f) => f.name === "with collapse on mobile")?.options },
62+
args: {
63+
...examplesFromFixtures.find((f) => f.name === "with collapse on mobile")
64+
?.options,
65+
},
5166
};
5267

5368
export const Inverse: Story = {
5469
name: "inverse",
5570
args: { ...examplesFromFixtures.find((f) => f.name === "inverse")?.options },
56-
};
71+
};

src/components/Button/Button.stories.tsx

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,12 @@ let configured = false;
1515
const meta: Meta<typeof Button> = {
1616
title: "GOVUK Design System/Button",
1717
component: Button,
18-
decorators: [(Story, { parameters }) => {
18+
decorators: [
19+
(Story, { parameters }) => {
1920
React.useEffect(() => {
20-
const isDocsMode = window.location.search.includes("path=/docs/govuk-design-system-button--docs");
21+
const isDocsMode = window.location.search.includes(
22+
"path=/docs/govuk-design-system-button--docs",
23+
);
2124
if (isDocsMode && !configured && parameters.initializeConfigurations) {
2225
ConfigureOverallButton();
2326
configured = true;
@@ -26,7 +29,8 @@ const meta: Meta<typeof Button> = {
2629
}
2730
}, []);
2831
return <Story />;
29-
}],
32+
},
33+
],
3034
tags: ["autodocs"],
3135
};
3236

@@ -35,7 +39,8 @@ type Story = StoryObj<typeof Button>;
3539

3640
// extractShownFixtures transforms raw govuk-frontend fixture data into
3741
// React-compatible props (e.g. text → children, classes → className).
38-
const examplesFromFixtures: Array<ComponentFixture> = extractShownFixtures(fixtures);
42+
const examplesFromFixtures: Array<ComponentFixture> =
43+
extractShownFixtures(fixtures);
3944

4045
export const Default: Story = {
4146
name: "default",
@@ -59,7 +64,9 @@ export const Start: Story = {
5964

6065
export const Secondary: Story = {
6166
name: "secondary",
62-
args: { ...examplesFromFixtures.find((f) => f.name === "secondary")?.options },
67+
args: {
68+
...examplesFromFixtures.find((f) => f.name === "secondary")?.options,
69+
},
6370
};
6471

6572
export const Warning: Story = {
@@ -70,4 +77,4 @@ export const Warning: Story = {
7077
export const Inverse: Story = {
7178
name: "inverse",
7279
args: { ...examplesFromFixtures.find((f) => f.name === "inverse")?.options },
73-
};
80+
};

src/components/CardColumn/CardColumn.scss

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,49 @@
11
// src/components/CardColumn/CardColumn.scss
2+
// --
3+
// Colours use CSS custom properties with govuk-frontend helper fallbacks.
4+
// --
5+
// The --card-text-color and --card-hover-color custom properties are set
6+
// inline on the <Card> element when the textColor / hoverColor props are
7+
// passed. When they are absent, var() falls back to the govuk-frontend
8+
// functional colour / palette helpers so the govuk theme remains the default.
9+
// --
10+
// govuk-functional-colour() tokens (design-system.service.gov.uk/styles/colour/):
11+
// "brand" → #1d70b8 — GOV.UK brand blue
12+
// "link" → #1a65a6 — standard link colour
13+
// "link-hover" → #0f385c — link hover colour
14+
// "focus" → #ffdd00 — focus/active highlight
15+
// "focus-text" → #0b0c0c — text on focus yellow background
16+
// --
17+
// govuk-colour() palette values:
18+
// govuk-colour("black") → #0b0c0c — header bar background
19+
// govuk-colour("white") → #ffffff
20+
21+
@use "~govuk-frontend/dist/govuk/helpers/colour" as *;
222
@use "~bootstrap/scss/bootstrap";
323

424
.card-link {
5-
color: #1d70b8;
6-
}
25+
color: var(--card-text-color, #{govuk-functional-colour("link")});
726

8-
.card-link :hover {
9-
color: #003078;
10-
border-color: #fd0;
27+
&:hover {
28+
color: var(--card-hover-color, #{govuk-functional-colour("link-hover")});
29+
border-color: govuk-functional-colour("focus");
30+
}
1131
}
1232

1333
.card-header {
1434
padding-bottom: 65px;
15-
color: #005ea5;
35+
color: var(--card-text-color, #{govuk-functional-colour("brand")});
36+
transition-duration: 0.3s;
1637

1738
&:hover {
18-
color: #f8f8f8;
19-
background-color: #005ea5;
20-
transition-duration: 0.3s;
39+
color: govuk-colour("white");
40+
background-color: var(--card-hover-color, #{govuk-colour("black")});
2141
}
2242

2343
&:active {
24-
background-color: gold;
25-
border-bottom: #000 groove;
44+
color: govuk-functional-colour("focus-text");
45+
background-color: govuk-functional-colour("focus");
46+
border-bottom: govuk-functional-colour("focus-text") groove;
2647
transition: ease-in-out;
2748
}
2849
}

0 commit comments

Comments
 (0)