Skip to content
New issue

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

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

Already on GitHub? # to your account

Declarative Layout refine and refactor #1966

Draft
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

splashdust
Copy link
Contributor

@splashdust splashdust commented Feb 5, 2025

What is it

Since we've been trying out and using this system for a while now, some patterns and opportunities for improvement have started to emerge. This PR is a step towards finalizing the declarative layout system.

The focus of this PR is to streamline the available properties for building layouts using GDS tokens. That means that rarely used and non-layout related properties are being removed. Also ome support for custom values are being removed, except for sizing and positioning. Declarative Layout is not meant to replace CSS, just to reduce or eliminate the need for layout CSS.

So far in this PR

Refactor

  • Colors now only support tokens from Green, no custom values except transparent and currentColor. This simplifies implementation and makes color properties more consistent.
  • Color properties now always use tokenName/transparency, where transparency is optional.
  • Set box-sizing to border-box by default
  • Set border-color to primary by default
  • border property now works like css shorthand border property, ie. size style color
  • border-style property added for completeness
    • We now have border, border-width, border-color, border-style, and border-radius, all with the same parameter structure as css.
  • Commonly used @styleExpressionProperty logic moved to reusable functions.
  • gds-grid: auto-columns now support any CSS units. If no unit is specified, it still appends px for backwards compatibility.

Removed

These properties have been removed. Any edge-cases that need these will have to be written in regular CSS

  • pointer-events
  • user-select
  • cursor
  • transform-style
  • Animation related properties. These we could eventually handle through a well thought out animation/transition system instead
    • transition
    • transition-behavior
    • animation

Other improvements

  • Composable and reusable Style Expression Property groups through class mixins
  • Put Declarative layout properties in their own section in the API tables

@green-design-system-bot
Copy link
Contributor

green-design-system-bot bot commented Feb 5, 2025

🦋 Changeset status

None or empty changeset found. This PR will not result any new releases.

If you believe this is incorrect, please add a changeset by running npx changeset, and then commiting the resulting changeset file.

You can also explicitly add an empty changeset by running:
npx changeset add --empty

@green-design-system-bot
Copy link
Contributor

green-design-system-bot bot commented Feb 5, 2025

👋 Thanks for creating a pull request!

🚀 Checkout the storybooks we've created for it:

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant