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

[Migration]: box -> boxNew #3669

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

[Migration]: box -> boxNew #3669

wants to merge 11 commits into from

Conversation

JulianNymark
Copy link
Contributor

Description

Component Checklist 📝

  • JSDoc
  • Examples
  • Documentation / Decision Records
  • Storybook
  • Style mappings (@navikt/core/css/config/_mappings.js)
  • Component tokens (@navikt/core/css/tokens.json)
  • CSS class deprecations (@navikt/aksel-stylelint/src/deprecations.ts)
  • Exports (@navikt/core/react/src/index.ts and @navikt/core/react/package.json)
  • New component? CSS import (@navikt/core/css/index.css)
  • Breaking change? Update migration guide. Consider codemod.
  • Changeset (Format: <Component>: <gitmoji?> <Text>. E.g. "Button: ✨ Add feature xyz.")

Copy link

changeset-bot bot commented Mar 17, 2025

⚠️ No Changeset found

Latest commit: db46476

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@JulianNymark JulianNymark changed the title 🚧 box migration scaffolding 🚧 box migration Mar 18, 2025
@JulianNymark JulianNymark marked this pull request as ready for review March 18, 2025 12:37
@JulianNymark JulianNymark marked this pull request as draft March 18, 2025 12:38
Copy link
Contributor

github-actions bot commented Mar 24, 2025

Storybook demo / Chromatic

ce84e8b13 | 91 components | 135 stories

@JulianNymark JulianNymark marked this pull request as ready for review March 24, 2025 14:43
@JulianNymark JulianNymark changed the title 🚧 box migration [Migration]: box -> boxNew Mar 24, 2025
@JulianNymark
Copy link
Contributor Author

it's currently missing a change to using BoxNew (but does the logic w/ lookups into the legacyTokenConf object look ok?) it works in this one minimal test i made too, but i can't help but think it's missing something? (apart from BoxNew ofc) 🤔

if (config?.replacement) {
attrvalue.value = config.replacement;
}
// else {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Yea would be nice if we could insert a comment above the line, or just simply at the top of the file with a spesific keyword, and potentially what they need to change 🥇

Copy link
Contributor Author

Choose a reason for hiding this comment

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

having no replacement could mean two things right?

  1. it's identical, and doesn't need changing?
  2. it's so different there's no obvious automatic alternative?

Copy link
Collaborator

Choose a reason for hiding this comment

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

it's identical, and doesn't need changing?

Unsure if there are any of these cases, but might be some of-course. In those cases, we will still need to make sure to migrate to BoxNew since the "new" tokens won't work with Box even when using the same name.

it's so different there's no obvious automatic alternative?
Yes, if there is no "replacement" in the config, there is nothing we can auto-migrate it to 👍 But you might see some of the keys in the config have `comment´ added to them. We can use these comments to guide the user to what they should do to migrate themselves.

@KenAJoh
Copy link
Collaborator

KenAJoh commented Mar 24, 2025

it's currently missing a change to using BoxNew (but does the logic w/ lookups into the legacyTokenConf object look ok?) it works in this one minimal test i made too, but i can't help but think it's missing something? (apart from BoxNew ofc) 🤔

Think it should work, token-name keys should match the names used for the props 🤞 But wouldn't hurt to skim over them to make sure.

Comment on lines +53 to +59
moveAndRenameImport(j, root, {
fromImport: "@navikt/ds-react",
toImport: "@navikt/ds-react",
fromName: "Box",
toName: "BoxNew",
});

Copy link
Collaborator

Choose a reason for hiding this comment

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

Migrating to BoxNew should only be necessary if you have used any of propsAffected. If you only have padding, margin etc Box still works with new theme.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it's not nice to "upgrade" for the future then? 🤔 (i think it wouldn't hurt, but maybe it's more mental overhead than required... at least in the short term?), but the more i think about this, the better it is to switch over early, and all the better if there's no change in behaviour?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

there's always the chance that you start to diverge from easily migrated box into one that has no analogue in the new system.

Copy link
Collaborator

Choose a reason for hiding this comment

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

When the darkside is set as the default, we will delete BoxNew and just use Box, so BoxNew is mainly just for those testing the new system. Bu i guess you're right, it wont hurt to just migrate to BoxNew always to avoid having both of them used at the same time 👍

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

Successfully merging this pull request may close these issues.

2 participants