Skip to content

Conversation

@IdaHW
Copy link
Contributor

@IdaHW IdaHW commented Jan 7, 2026

Description

Add the Canopy Design Tokens npm package and update all the foundations css values to use the new tokens
Update the scripts to use the design tokens

Checklist:

  • The commit messages follow the convention for this project
  • I have provided an adequate amount of test coverage
  • I have added the functionality to the test app
  • I have provided a story in storybook to document the changes
  • I have added the documentation
  • I have added any new public feature modules to public-api.ts

Copilot AI review requested due to automatic review settings January 7, 2026 09:31
@IdaHW IdaHW requested a review from a team as a code owner January 7, 2026 09:31
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR migrates the Canopy design system from locally maintained design tokens to the published @legal-and-general/canopy-design-tokens npm package (v1.2.0). The migration involves updating CSS variable naming conventions from prefix-based patterns (e.g., --sm-space-1, --productive-font-family) to suffix-based patterns (e.g., --space-1-sm, --font-family-productive).

Key Changes:

  • Added @legal-and-general/canopy-design-tokens package dependency
  • Updated CSS variable naming conventions throughout the codebase to match the new tokens structure
  • Refactored typography and spacing utilities to handle breakpoint-specific design token values

Reviewed changes

Copilot reviewed 14 out of 15 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
package.json, package-lock.json Added @legal-and-general/canopy-design-tokens v1.2.0 as a dependency
scripts/generate-css-variables.js Updated tokens directory path to reference the npm package instead of local files
projects/canopy/src/styles/styles.scss Added imports for all design token CSS files from the npm package
projects/canopy/src/styles/variables.scss Removed imports for local colours and token files that are now provided by the package
projects/canopy/src/styles/variables/_colours.scss Deleted entire file as colours are now provided by the design tokens package
projects/canopy/src/styles/variables/_typography.scss Refactored to use breakpoint-specific font size/line height variables with responsive mapping
projects/canopy/src/styles/spacing.scss Updated variable references from --sm-space-X to --space-X-sm pattern
projects/canopy/src/styles/tokens/variables.css Deleted as tokens are now sourced from the npm package
projects/canopy/src/styles/tokens/layout.css Deleted as layout tokens are now sourced from the npm package
projects/canopy/src/lib/docs/foundation/typography/typography-utils.ts Refactored to handle breakpoint-specific values and added new helper functions for MDX tables
projects/canopy/src/lib/docs/foundation/typography/typography.stories.ts Changed type definitions to require both sm and lg values (previously optional)
projects/canopy/src/lib/docs/foundation/typography/typography.mdx Updated to use new breakpoint-aware utility functions for displaying token values
projects/canopy/src/lib/docs/foundation/spacing-utils.ts Updated variable filtering logic to match new naming pattern with suffix-based breakpoints
projects/canopy/src/lib/docs/foundation/colours/colours.stories.ts Updated import path to reference tokens from the new package location

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI review requested due to automatic review settings January 7, 2026 11:07
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 19 out of 20 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions github-actions bot added the deployed The branch is deployed to GitHub Pages label Jan 7, 2026
@elenagarrone
Copy link
Contributor

elenagarrone commented Jan 7, 2026

@IdaHW font-size-9 seems much bigger than in master now. Left is new, right is master:

image

Do you know whys is that?

@use 'typography-elements';

// Import design tokens
@import '@legal-and-general/canopy-design-tokens/build/css/variables.css';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I'd probably amend the package so that it outputs without the build folder - seems unnecessary 🤔 What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was just so that the css and js tokens can be in sub folders in the /build directory, so /build/css and /build/js and not in the same folder. Might be better to keep them separate, but happy to change if you think it'll work better

Copilot AI review requested due to automatic review settings January 7, 2026 16:09
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 19 out of 20 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

--text-base-size: 16px; /* stylelint-disable-line unit-allowed-list */
--text-base-line-height: 1.38;
--text-base-size: var(--font-size-1); // 16px
--text-base-line-height: var(--line-height-1); //1.38
Copy link

Copilot AI Jan 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment should be updated to reflect the actual line height value from the design tokens. The value 1.38 may not be accurate for --line-height-1-sm from the new design tokens package.

Suggested change
--text-base-line-height: var(--line-height-1); //1.38
--text-base-line-height: var(--line-height-1); // base line height from design tokens

Copilot uses AI. Check for mistakes.

--text-base-size: 16px; /* stylelint-disable-line unit-allowed-list */
--text-base-line-height: 1.38;
--text-base-size: var(--font-size-1); // 16px
Copy link

Copilot AI Jan 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment should be updated to match the actual variable name being referenced. The variable --font-size-1-sm has a value that likely corresponds to 16px, but the variable name is --font-size-1, not --font-size-1-sm.

Suggested change
--text-base-size: var(--font-size-1); // 16px
--text-base-size: var(--font-size-1); // base font size token

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

deployed The branch is deployed to GitHub Pages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants