Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: Consolidate Grid Space and Component Space into one set of spacing tokens #1910

Open
wants to merge 11 commits into
base: develop
Choose a base branch
from

Conversation

VincentSmedinga
Copy link
Contributor

@VincentSmedinga VincentSmedinga commented Mar 6, 2025

Describe the pull request

What

  • Removes the Grid Space tokens, replacing:
    • var(--ams-space-grid-sm) with var(--ams-space-lg)
    • var(--ams-space-grid-md) with var(--ams-space-xl) while changing its value from 48 to 56.
    • var(--ams-space-grid-lg) with var(--ams-space-2xl); this is a new token
    • The other options weren’t in use
  • Removes tokens for gap and margin; their utility classes can use the space tokens directly.
  • Makes space tokens for Compact Mode responsive again to save more space on mobile phones. The value for var(--ams-space-xl) has also changed here, from 32 to 36.
  • Adds 4 space tokens that use one size in narrow windows and another on wide ones. This is what we needed to ensure the Grid can take its space on large screens, while not using so much screen space on small screens. It also removes the incorrect coupling between this kind of white space and the grid gaps. Changing one for the better always made the other worse, but these custom pairs seem the correct modelling for the difference in responsive behaviour that has always been there in the background. An advantage of these pairs is also that they reuse existing spacing lengths instead of introducing new ones.
  • This also addresses the problem where Grid Space seemed too small on mobile. Vertical space around grids is now 27 instead of 16, and horizontal is 27 as well, instead of 24.
  • I think having 27px whitespace between the grid’s content and the edges of the screen (at 320 pixels wide, so it’s around 30 on actual phones) is the best compromise between keeping enough horizontal room for the content and communicating our spacious branding.
  • Updates the documentation accordingly.

To help understand how the values changed, here are screenshots from the new (left) and previous (right) token tables, for Spacious (above) and Compact mode (below):

1  Changes in Spacious Mode 2  Changes in Compact Mode

Why

This is meant to make our spacing system easier to use. Many people find it confusing to have both ‘grid spacing’ and ‘regular spacing’. It also lets us set the gap between components without needing separate grid cells.

Usually, choosing a size between xs and xl will be sufficient for most people.

If they think they need one of the custom pairs, which are a bit more complex, knowing that they range between existing spacing lengths will help them understand.

How

n/a

Checklist

Before submitting your pull request, please ensure you have done the following. Check each checkmark if you have done so or if it wasn't necessary:

  • Add or update unit tests
  • Add or update documentation
  • Add or update stories
  • Add or update exports in index.* files
  • Start the PR title with a Conventional Commit prefix, as explained here.

Additional notes

  • n/a

@VincentSmedinga VincentSmedinga requested a review from a team as a code owner March 6, 2025 13:18
@VincentSmedinga VincentSmedinga marked this pull request as draft March 6, 2025 13:18
@github-actions github-actions bot temporarily deployed to demo-DES-1078-space-tokens March 6, 2025 14:31 Destroyed
@VincentSmedinga VincentSmedinga force-pushed the feat/DES-1078-space-tokens branch from 5614b4b to 99aa1fc Compare March 7, 2025 14:23
@github-actions github-actions bot temporarily deployed to demo-DES-1078-space-tokens March 7, 2025 14:23 Destroyed
@VincentSmedinga VincentSmedinga requested review from dlnr and Bondt007 March 7, 2025 14:23
@VincentSmedinga VincentSmedinga marked this pull request as ready for review March 7, 2025 14:24
@github-actions github-actions bot temporarily deployed to demo-DES-1078-space-tokens March 7, 2025 14:49 Destroyed
@github-actions github-actions bot temporarily deployed to demo-DES-1078-space-tokens March 7, 2025 14:52 Destroyed
@github-actions github-actions bot temporarily deployed to demo-DES-1078-space-tokens March 10, 2025 22:05 Destroyed
@VincentSmedinga VincentSmedinga force-pushed the feat/DES-1078-space-tokens branch from 04ad0f6 to efe263e Compare March 11, 2025 11:51
@github-actions github-actions bot temporarily deployed to demo-DES-1078-space-tokens March 11, 2025 11:51 Destroyed
Comment on lines +7 to +9
"sm": { "value": "{ams.space.md-lg}" },
"md": { "value": "{ams.space.lg-xl}" },
"lg": { "value": "{ams.space.xl-2xl}" }
Copy link
Contributor Author

@VincentSmedinga VincentSmedinga Mar 11, 2025

Choose a reason for hiding this comment

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

I’m not sure we still need these three options – 50%, 100% or 150% of a grid gap as padding above or below it. I think we can just keep the medium value, like we do for horizontal (inline) padding.

If people want more than a grid gap of whitespace below something, they can add a bottom margin through or .ams-mb-* utility classes.

This is also the only place where the ams.space.xl-2xl custom pair is used, so if we remove small and large block padding, we can also remove one custom pair space token.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant