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

Export selector functions directly in @royalnavy/design-tokens #3797

Closed
jpveooys opened this issue May 14, 2024 · 1 comment · Fixed by #3803
Closed

Export selector functions directly in @royalnavy/design-tokens #3797

jpveooys opened this issue May 14, 2024 · 1 comment · Fixed by #3803
Assignees
Labels
Package: design-tokens Package/code type Size: Small Assessed as small task Type: Enhancement New feature or request

Comments

@jpveooys
Copy link
Contributor

jpveooys commented May 14, 2024

Description

Currently to use the selectors in the Design Tokens library you have to import selectors and destructure it:

import { selectors } from '@royalnavy/design-tokens'

const { color } = selectors

I don't know the background to why it was done in this way, but it'd be helpful in general for it to be a bit more ergonomic to use the tokens.

One change towards that would be to make it possible to import the selector functions directly:

import { color } from '@royalnavy/design-tokens'

(Having to destructure selectors is a bit tedious, and also stops IDEs from being able to suggest missing imports.)

@jpveooys jpveooys added Status: Awaiting triage Issues not yet triaged by the Design System cra-template-royalnavy Type: Enhancement New feature or request labels May 14, 2024
@jpveooys jpveooys changed the title Export selector functions directly in @royalnavy/design-token Export selector functions directly in @royalnavy/design-tokens May 14, 2024
@m7kvqbe1 m7kvqbe1 added Size: Small Assessed as small task Package: design-tokens Package/code type and removed Status: Awaiting triage Issues not yet triaged by the Design System cra-template-royalnavy labels May 15, 2024
@rndsbot rndsbot added this to Candidates for Ready in Tactical Board May 15, 2024
@m7kvqbe1
Copy link
Member

Sounds good - I don't think that much thought went into it at the time from a DX perspective as they'd not yet been used.

We'll continue to expose the selectors object to preserve backwards compatibility.

@m7kvqbe1 m7kvqbe1 moved this from Candidates for Ready to Ready in Tactical Board May 15, 2024
@m7kvqbe1 m7kvqbe1 moved this from Ready to In Progress in Tactical Board May 16, 2024
@m7kvqbe1 m7kvqbe1 self-assigned this May 16, 2024
@markhigham markhigham self-assigned this May 17, 2024
@markhigham markhigham moved this from In Progress to In Review in Tactical Board May 17, 2024
Tactical Board automation moved this from In Review to Done May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Package: design-tokens Package/code type Size: Small Assessed as small task Type: Enhancement New feature or request
Projects
Development

Successfully merging a pull request may close this issue.

3 participants