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

Admin UI - Tokens #4302

Open
wants to merge 67 commits into
base: feat/new-admin-ui
Choose a base branch
from
Open

Admin UI - Tokens #4302

wants to merge 67 commits into from

Conversation

adrians5j
Copy link
Member

@adrians5j adrians5j commented Oct 1, 2024

This PR introduces the new tokens.

Initially we started by manually moving them from Figma designs into code, but very quickly, I realized it's just too cumbersome and error prone to do it that way. So I created a script that automates this.

Basically, users first export all of the variables from Figma, using this tool. Then, they copy the received file it into our project, and run yarn webiny-admin-import-from-figma.

image

As we can see, the script generates three files, where the most important two are tailwind.config.js and styles.scss.

I documented how to use it here.

@adrians5j adrians5j changed the title Feat/tokens Programmatic Creation of Roles and Teams Oct 1, 2024
@adrians5j adrians5j closed this Oct 1, 2024
@adrians5j adrians5j changed the title Programmatic Creation of Roles and Teams Admin UI - Tokens Oct 1, 2024
@adrians5j adrians5j reopened this Oct 1, 2024
@adrians5j adrians5j changed the base branch from next to feat/new-admin-ui October 1, 2024 08:56
@adrians5j adrians5j marked this pull request as ready for review October 29, 2024 08:31
Copy link
Contributor

@leopuleo leopuleo left a comment

Choose a reason for hiding this comment

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

Nice 🍻
I love the DEVELOPMENT.mdx file; the future US is thanking you. Just a couple of questions. Let me know what you think about it

@@ -20,48 +33,22 @@ module.exports = {
}
},
extend: {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we add our tokens and override the default class names?
As we agreed not to use Tailwind's default class names, I would remove them to highlight the missing token definitions.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sounds good.

Copy link
Member Author

Choose a reason for hiding this comment

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

Moved everything to overrides (out of the extend section).

@apply border-border;
}

body {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to define the CSS variable in this file and admin-ui/src/styles.scss?

Also, is this the correct place to define the font family import? I would keep this together with the CSS variable definition.

Both of these might come from the POC phase. Shall we discuss it now? I'm happy to talk about it.

Copy link
Member Author

@adrians5j adrians5j Oct 30, 2024

Choose a reason for hiding this comment

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

Sounds reasonable.

Why do we need a copy of everything in App.scss when we already have it in admin-ui package? And why don't we abstract the font import from users and have it in single styles.scss?

It's basically because of real Webiny projects and being in sync with the code we'll be shipping.

In real projects, users will need to have the ability to customize the theme, and because of that, this is how their App.scss file will look like. Basically:

  1. all of the CSS vars are listed in the file
  2. the default font import statement is here as well, just so they can remove it and import their own font (no point in loading our default font if they will be using their own). That's why we don't have this in our styles.scss.

Note

I see I forgot to update packages/cwp-template-aws/template/common/apps/admin/src/App.scss, I'll do it during the day.

So, basically, all of this was just to have our App.scss and users' App.scss in sync.

But.... all that being said... maybe we could rethink this a bit. Maybe we could actually not-have a bunch of CSS vars and font import by default in users' projects, but maybe we ship an SCSS file that's imported in App.scss. And then, if users want to customize things, they remove the default theme import, and paste all of the CSS vars and a font import statement (we'd have this documented) and then they proceed to tweak things.

So something like:

// apps/admin/src/App.scss
@import "~@webiny/admin-ui/styles.scss";

// To customize the theme, remove the following line and paste the code from https://docs.webiny.com/xyz
@import "~@webiny/admin-ui/theme.scss";

BTW, now that we've discussed this, I think this way of doing things might also resolve an issue where we have a bunch of TW vars duplicated, which is visible in console:
image

This just crossed my mind while I was writing this.

Copy link
Contributor

Choose a reason for hiding this comment

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

I like the idea of having a separate file for theming 🎉

Regarding the duplicated Tailwind CSS variables: I’m not sure; I would expect that some override would be the default behavior of Tailwind. Also, while checking Tailwind themes, I noticed the same situation.

I would keep this as low priority if you agree,

Copy link
Member Author

@adrians5j adrians5j Oct 31, 2024

Choose a reason for hiding this comment

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

This is done as well. I also noted the low priority thingie here.

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

Successfully merging this pull request may close these issues.

2 participants