-
Notifications
You must be signed in to change notification settings - Fork 20
chore(CardHorizontal): migrate to CSS Modules with visual regression baseline #1039
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
Open
DreaminDani
wants to merge
3
commits into
main
Choose a base branch
from
chore/migrate-cardhorizontal-css-modules
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| '@clickhouse/click-ui': patch | ||
| --- | ||
|
|
||
| Migrate CardHorizontal from styled-components to css modules with no change in behavior |
216 changes: 216 additions & 0 deletions
216
src/components/CardHorizontal/CardHorizontal.module.css
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,216 @@ | ||
| .header { | ||
| max-width: 100%; | ||
| gap: inherit; | ||
| } | ||
|
|
||
| .description { | ||
| display: flex; | ||
| width: 100%; | ||
| flex: 1; | ||
| flex-direction: column; | ||
| align-self: start; | ||
| gap: var(--click-card-horizontal-space-md-gap); | ||
| } | ||
|
|
||
| .cardicon { | ||
| width: var(--click-card-horizontal-icon-size-all); | ||
| height: var(--click-card-horizontal-icon-size-all); | ||
| } | ||
|
|
||
| .contentwrapper { | ||
| display: flex; | ||
| width: 100%; | ||
| flex-direction: row; | ||
| } | ||
|
|
||
| .contentwrapper_size_md { | ||
| gap: var(--click-card-horizontal-space-md-gap); | ||
| } | ||
|
|
||
| .contentwrapper_size_sm { | ||
| gap: var(--click-card-horizontal-space-sm-gap); | ||
| } | ||
|
|
||
| /* stylelint-disable-next-line media-feature-range-notation -- prefix notation | ||
| required for browser compatibility per .browserslistrc */ | ||
| @media (max-width: 768px) { | ||
| .contentwrapper { | ||
| flex-direction: column; | ||
| } | ||
| } | ||
|
|
||
| .icontextcontentwrapper { | ||
| display: flex; | ||
| width: 100%; | ||
| flex-direction: row; | ||
| align-items: center; | ||
| } | ||
|
|
||
| .icontextcontentwrapper_alignment_top { | ||
| align-items: flex-start; | ||
| } | ||
|
|
||
| .icontextcontentwrapper_alignment_center { | ||
| align-items: center; | ||
| } | ||
|
|
||
| .icontextcontentwrapper_size_md { | ||
| gap: var(--click-card-horizontal-space-md-gap); | ||
| } | ||
|
|
||
| .icontextcontentwrapper_size_sm { | ||
| gap: var(--click-card-horizontal-space-sm-gap); | ||
| } | ||
|
|
||
| .wrapper { | ||
| display: inline-flex; | ||
| width: 100%; | ||
| max-width: 100%; | ||
| justify-content: flex-start; | ||
| align-items: center; | ||
| align-self: auto; | ||
| border: 1px solid var(--card-stroke-default); | ||
| border-radius: var(--click-card-horizontal-radii-all); | ||
| background: var(--card-bg-default); | ||
| color: var(--card-title-default); | ||
| font: var(--click-card-horizontal-typography-title-default); | ||
| } | ||
|
|
||
| .wrapper_color_default { | ||
| --card-bg-default: var(--click-card-horizontal-default-color-background-default); | ||
| --card-bg-hover: var(--click-card-horizontal-default-color-background-hover); | ||
| --card-bg-active: var(--click-card-horizontal-default-color-background-active); | ||
| --card-bg-disabled: var(--click-card-horizontal-default-color-background-disabled); | ||
| --card-title-default: var(--click-card-horizontal-default-color-title-default); | ||
| --card-title-hover: var(--click-card-horizontal-default-color-title-hover); | ||
| --card-title-active: var(--click-card-horizontal-default-color-title-active); | ||
| --card-title-disabled: var(--click-card-horizontal-default-color-title-disabled); | ||
| --card-stroke-default: var(--click-card-horizontal-default-color-stroke-default); | ||
| --card-stroke-hover: var(--click-card-horizontal-default-color-stroke-hover); | ||
| --card-stroke-active: var(--click-card-horizontal-default-color-stroke-active); | ||
| --card-stroke-disabled: var(--click-card-horizontal-default-color-stroke-disabled); | ||
| --card-desc-default: var(--click-card-horizontal-default-color-description-default); | ||
| --card-desc-hover: var(--click-card-horizontal-default-color-description-hover); | ||
| --card-desc-active: var(--click-card-horizontal-default-color-description-active); | ||
| --card-desc-disabled: var(--click-card-horizontal-default-color-description-disabled); | ||
| } | ||
|
|
||
| .wrapper_color_muted { | ||
| --card-bg-default: var(--click-card-horizontal-muted-color-background-default); | ||
| --card-bg-hover: var(--click-card-horizontal-muted-color-background-hover); | ||
| --card-bg-active: var(--click-card-horizontal-muted-color-background-active); | ||
| --card-bg-disabled: var(--click-card-horizontal-muted-color-background-disabled); | ||
| --card-title-default: var(--click-card-horizontal-muted-color-title-default); | ||
| --card-title-hover: var(--click-card-horizontal-muted-color-title-hover); | ||
| --card-title-active: var(--click-card-horizontal-muted-color-title-active); | ||
| --card-title-disabled: var(--click-card-horizontal-muted-color-title-disabled); | ||
| --card-stroke-default: var(--click-card-horizontal-muted-color-stroke-default); | ||
| --card-stroke-hover: var(--click-card-horizontal-muted-color-stroke-hover); | ||
| --card-stroke-active: var(--click-card-horizontal-muted-color-stroke-active); | ||
| --card-stroke-disabled: var(--click-card-horizontal-muted-color-stroke-disabled); | ||
| --card-desc-default: var(--click-card-horizontal-muted-color-description-default); | ||
| --card-desc-hover: var(--click-card-horizontal-muted-color-description-hover); | ||
| --card-desc-active: var(--click-card-horizontal-muted-color-description-active); | ||
| --card-desc-disabled: var(--click-card-horizontal-muted-color-description-disabled); | ||
| } | ||
|
|
||
| .wrapper_alignment_top { | ||
| align-items: flex-start; | ||
| align-self: stretch; | ||
| } | ||
|
|
||
| .wrapper_alignment_center { | ||
| align-items: center; | ||
| align-self: auto; | ||
| } | ||
|
|
||
| .wrapper_size_md { | ||
| padding: var(--click-card-horizontal-space-md-y) var(--click-card-horizontal-space-md-x); | ||
| } | ||
|
|
||
| .wrapper_size_sm { | ||
| padding: var(--click-card-horizontal-space-sm-y) var(--click-card-horizontal-space-sm-x); | ||
| } | ||
|
|
||
| .wrapper .description { | ||
| color: var(--card-desc-default); | ||
| font: var(--click-card-horizontal-typography-description-default); | ||
| } | ||
|
|
||
| .wrapper.wrapper_selectable { | ||
| border-color: var(--card-stroke-hover); | ||
| } | ||
|
|
||
| .wrapper.wrapper_selectable.wrapper_selected { | ||
| border-color: var(--card-stroke-active); | ||
| } | ||
|
|
||
| .wrapper:hover { | ||
| font: var(--click-card-horizontal-typography-title-hover); | ||
| } | ||
|
|
||
| .wrapper.wrapper_selectable:hover { | ||
| border-color: var(--card-stroke-default); | ||
| background-color: var(--card-bg-hover); | ||
| color: var(--card-title-hover); | ||
| cursor: pointer; | ||
| } | ||
|
|
||
| .wrapper.wrapper_selectable.wrapper_selected:hover { | ||
| border-color: var(--card-stroke-active); | ||
| } | ||
|
|
||
| .wrapper.wrapper_selectable:hover .description { | ||
| color: var(--card-desc-hover); | ||
| font: var(--click-card-horizontal-typography-description-hover); | ||
| } | ||
|
|
||
| .wrapper.wrapper_selectable:active, | ||
| .wrapper.wrapper_selectable:focus, | ||
| .wrapper.wrapper_selectable:focus-within { | ||
| border-color: var(--card-stroke-active); | ||
| background-color: var(--card-bg-active); | ||
| color: var(--card-title-active); | ||
| } | ||
|
|
||
| .wrapper.wrapper_selectable:active .description, | ||
| .wrapper.wrapper_selectable:focus .description, | ||
| .wrapper.wrapper_selectable:focus-within .description { | ||
| color: var(--card-desc-active); | ||
| font: var(--click-card-horizontal-typography-description-active); | ||
| } | ||
|
|
||
| /* stylelint-disable no-descending-specificity -- disabled state intentionally | ||
| defined after hover/active to mirror the source cascade order; | ||
| pointer-events:none plus tabIndex=-1 prevent hover/focus/active from firing. */ | ||
| .wrapper.wrapper_disabled, | ||
| .wrapper.wrapper_disabled:hover, | ||
| .wrapper.wrapper_disabled:active, | ||
| .wrapper.wrapper_disabled:focus, | ||
| .wrapper.wrapper_disabled:focus-within { | ||
| border: 1px solid var(--card-stroke-disabled); | ||
| background-color: var(--card-bg-disabled); | ||
| color: var(--card-title-disabled); | ||
| cursor: not-allowed; | ||
| pointer-events: none; | ||
| } | ||
|
|
||
| .wrapper.wrapper_disabled.wrapper_selected, | ||
| .wrapper.wrapper_disabled.wrapper_selected:hover, | ||
| .wrapper.wrapper_disabled.wrapper_selected:active, | ||
| .wrapper.wrapper_disabled.wrapper_selected:focus, | ||
| .wrapper.wrapper_disabled.wrapper_selected:focus-within { | ||
| border-color: var(--card-stroke-active); | ||
| } | ||
|
|
||
| .wrapper.wrapper_disabled .description { | ||
| color: var(--card-desc-disabled); | ||
| font: var(--click-card-horizontal-typography-description-disabled); | ||
| } | ||
|
|
||
| .wrapper.wrapper_disabled:active, | ||
| .wrapper.wrapper_disabled:focus, | ||
| .wrapper.wrapper_disabled:focus-within { | ||
| border: 1px solid var(--card-stroke-active); | ||
| } | ||
| /* stylelint-enable no-descending-specificity */ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I kinda like this pattern. Should we codify it into the skill?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which pattern specifically?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Naming a bunch of component-specific vars to avoid having to specify them from the global variables throughout the entire file. It's exactly what I would have done.