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(defaultProps): replace theme variables with classes #3701

Merged
merged 8 commits into from
Oct 12, 2023

Conversation

HQFOX
Copy link
Contributor

@HQFOX HQFOX commented Sep 20, 2023

I have replaced most of the theme component variables with classes to the defaultProps.
Some values I wasn't able to remove, these were mostly values used with the activeTheme ( mostly typography variants ).
Other values I left because they seemed useful to customize the component and provided some abstraction, these were mostly values that are used throughout the component in different classes or sub components.
See if you agree with the ones I left out or the ones I left in.

@HQFOX HQFOX requested a review from a team as a code owner September 20, 2023 19:39
@HQFOX HQFOX requested review from francisco-guilherme and MEsteves22 and removed request for a team September 20, 2023 19:39
@github-actions github-actions bot temporarily deployed to uikit/pr-3701 September 20, 2023 19:43 Destroyed
@github-actions github-actions bot temporarily deployed to uikit-app/pr-3701 September 20, 2023 19:43 Destroyed
@HQFOX HQFOX marked this pull request as draft September 21, 2023 08:48
@HQFOX HQFOX force-pushed the HVUIKIT-6784_add_component_default_props branch from 828aa40 to 0534562 Compare September 22, 2023 16:23
@github-actions github-actions bot temporarily deployed to uikit-app/pr-3701 September 22, 2023 16:29 Destroyed
@github-actions github-actions bot temporarily deployed to uikit/pr-3701 September 22, 2023 16:29 Destroyed
@github-actions github-actions bot temporarily deployed to uikit/pr-3701 September 25, 2023 08:32 Destroyed
@github-actions github-actions bot temporarily deployed to uikit-app/pr-3701 September 25, 2023 08:32 Destroyed
@HQFOX HQFOX force-pushed the HVUIKIT-6784_add_component_default_props branch from 93969bf to 194fd37 Compare September 25, 2023 18:33
@github-actions github-actions bot temporarily deployed to uikit-app/pr-3701 September 25, 2023 18:40 Destroyed
@github-actions github-actions bot temporarily deployed to uikit/pr-3701 September 25, 2023 18:40 Destroyed
@github-actions github-actions bot temporarily deployed to uikit/pr-3701 September 26, 2023 11:27 Destroyed
@github-actions github-actions bot temporarily deployed to uikit-app/pr-3701 September 26, 2023 11:27 Destroyed
@github-actions github-actions bot temporarily deployed to uikit-app/pr-3701 September 26, 2023 11:40 Destroyed
@github-actions github-actions bot temporarily deployed to uikit/pr-3701 September 26, 2023 11:40 Destroyed
@github-actions github-actions bot temporarily deployed to uikit/pr-3701 September 26, 2023 14:32 Destroyed
@github-actions github-actions bot temporarily deployed to uikit-app/pr-3701 September 26, 2023 14:32 Destroyed
@HQFOX HQFOX force-pushed the HVUIKIT-6784_add_component_default_props branch from 952725b to 3919e6a Compare September 26, 2023 14:47
@github-actions github-actions bot temporarily deployed to uikit-app/pr-3701 September 26, 2023 14:51 Destroyed
@github-actions github-actions bot temporarily deployed to uikit/pr-3701 September 26, 2023 14:51 Destroyed
@HQFOX HQFOX marked this pull request as ready for review September 26, 2023 15:17
@HQFOX HQFOX force-pushed the HVUIKIT-6784_add_component_default_props branch from 3919e6a to 3c05743 Compare September 27, 2023 10:18
@github-actions github-actions bot temporarily deployed to uikit-app/pr-3701 September 27, 2023 10:23 Destroyed
@github-actions github-actions bot temporarily deployed to uikit/pr-3701 September 27, 2023 10:23 Destroyed
@github-actions github-actions bot temporarily deployed to uikit/pr-3701 September 27, 2023 10:48 Destroyed
@github-actions github-actions bot temporarily deployed to uikit-app/pr-3701 September 27, 2023 10:48 Destroyed
Copy link
Contributor

@MEsteves22 MEsteves22 left a comment

Choose a reason for hiding this comment

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

Looks good 🙏

I just identified some things while reviewing.

Also, I noticed some components have two distinct areas:

  • (1) one where the props are defined and used by useDefaultProps:
components: { "HvCard": { (...) }, (...) }
  • (2) and one where we have some more styling and/or variants defined (and these values are mapped out to CSS vars):
card: {
     titleVariant: "label",
     subheaderVariant: "caption1",
     subheaderColor: theme.colors.secondary,
}

I believe there are still some variables in (2) that could be mapped out to (1). I identified those in my review. Also, when necessary, I also think we should map out the variables related to CSS styling by creating new classes. For example, regarding the card component, we could create a new class for the subheaderColor to remove it from (2). The only values related to CSS styling I see remaining in (2) are the header height and second level height because these seem like variables users would want to access.

Also, having variants as CSS vars is something I believe we should try to remove in this PR since these are not valid values (ex: titleVariant and subheaderVariant for the card component). Thus, I think we should review our mapping to omit them.

What of you think?

packages/styles/src/themes/ds3.ts Outdated Show resolved Hide resolved
packages/styles/src/themes/ds3.ts Outdated Show resolved Hide resolved
packages/styles/src/themes/ds3.ts Outdated Show resolved Hide resolved
packages/core/src/components/QueryBuilder/Rule/Rule.tsx Outdated Show resolved Hide resolved
packages/styles/src/themes/ds3.ts Outdated Show resolved Hide resolved
packages/styles/src/themes/ds3.ts Outdated Show resolved Hide resolved
packages/styles/src/themes/ds3.ts Outdated Show resolved Hide resolved
@HQFOX HQFOX force-pushed the HVUIKIT-6784_add_component_default_props branch from 15b81e1 to 246aec6 Compare October 10, 2023 10:09
@github-actions github-actions bot temporarily deployed to uikit/pr-3701 October 10, 2023 10:17 Destroyed
@github-actions github-actions bot temporarily deployed to uikit-app/pr-3701 October 10, 2023 10:17 Destroyed
@github-actions github-actions bot temporarily deployed to uikit-app/pr-3701 October 10, 2023 10:20 Destroyed
@github-actions github-actions bot temporarily deployed to uikit/pr-3701 October 10, 2023 10:20 Destroyed
@github-actions github-actions bot temporarily deployed to uikit-app/pr-3701 October 10, 2023 11:00 Destroyed
@github-actions github-actions bot temporarily deployed to uikit/pr-3701 October 10, 2023 11:00 Destroyed
Copy link
Member

@zettca zettca left a comment

Choose a reason for hiding this comment

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

What a huge effort 😅 💪

Looking great overall. I still want to make a deeper review, but I'll leave these comments for now:

  • I think we should separate the component improvements & missing useDefaultProps to a separate PR, to reduce the scope and size of this PR
  • It would be nice if we could extract more common color keys like we did for containerBackgroundHover

package-lock.json Outdated Show resolved Hide resolved
packages/core/src/components/Card/Header/Header.styles.tsx Outdated Show resolved Hide resolved
packages/core/src/components/Card/Card.tsx Outdated Show resolved Hide resolved
@HQFOX
Copy link
Contributor Author

HQFOX commented Oct 10, 2023

I agreed with @MEsteves22 suggestion and tried removing the rest of the variables. The theme variables left are mostly button variants, colors and a few other values that weren't clear to me how to substitute, maybe we can deal with those types individually in another issue, or if you have a suggestion that I'm not seeing say so.

@github-actions github-actions bot temporarily deployed to uikit/pr-3701 October 10, 2023 13:35 Destroyed
@github-actions github-actions bot temporarily deployed to uikit-app/pr-3701 October 10, 2023 13:35 Destroyed
Copy link
Contributor

@MEsteves22 MEsteves22 left a comment

Choose a reason for hiding this comment

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

👌🏻

Just noticed two small things:

@github-actions github-actions bot temporarily deployed to uikit/pr-3701 October 11, 2023 16:57 Destroyed
@github-actions github-actions bot temporarily deployed to uikit-app/pr-3701 October 11, 2023 16:57 Destroyed
Copy link
Contributor

@MEsteves22 MEsteves22 left a comment

Choose a reason for hiding this comment

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

LGTM 🙏

We'll need to review the "White Labelling" page because a lot of the variables used there are no longer available. But I think we can do that in another PR.

As future work I also think that we should try to remove variants as CSS vars since these are not valid values.

packages/styles/src/themes/ds5.ts Outdated Show resolved Hide resolved
packages/styles/src/themes/ds5.ts Outdated Show resolved Hide resolved
packages/styles/src/types.ts Outdated Show resolved Hide resolved
packages/styles/src/themes/ds3.ts Outdated Show resolved Hide resolved
@github-actions github-actions bot temporarily deployed to uikit-app/pr-3701 October 12, 2023 14:38 Destroyed
@github-actions github-actions bot temporarily deployed to uikit/pr-3701 October 12, 2023 14:38 Destroyed
Copy link
Member

@zettca zettca left a comment

Choose a reason for hiding this comment

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

Awesome 👌

@zettca zettca merged commit d84c30d into master Oct 12, 2023
4 of 5 checks passed
@zettca zettca deleted the HVUIKIT-6784_add_component_default_props branch October 12, 2023 16:06
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.

None yet

3 participants