-
Notifications
You must be signed in to change notification settings - Fork 3
feat: enhance VButton with outlined variant, size system and SCSS mixins #586
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
Draft
timothejoubert
wants to merge
9
commits into
main
Choose a base branch
from
feature/improve-v-button
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.
Draft
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
0e0df3c
feat: enhance VButton component with outlined design and size variants
5d38b36
chore: run lint --fix
d7eeb51
chore: run lint:css --fix
58c1535
chore: run lint:css --fix
cff2068
fix: correct function call in list-implode for nested lists
c551731
Merge branch 'main' into feature/improve-v-button
eb28058
Merge branch 'main' into feature/improve-v-button
ca8157d
refactor: rename design prop to variant in VButton components
c626e54
refactori: update sizes mixin usage in VButton styles
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
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,90 @@ | ||
| @use 'assets/scss/mixins/css-vars-map'; | ||
| @use 'assets/scss/mixins/sizes' as *; | ||
| @use 'assets/scss/functions/ease' as *; | ||
|
|
||
| $vars: ( | ||
| (vars: (xs: (padding: 8px 12px, | ||
| gap: 6px, | ||
| ), | ||
| sm: (padding: 10px 16px, | ||
| gap: 8px, | ||
| ), | ||
| md: (padding: 16px 20px, | ||
| gap: 12px, | ||
| ), | ||
| lg: (padding: 18px 28px, | ||
| gap: 12px, | ||
| ), | ||
| ), | ||
| prefix: '', | ||
| ), | ||
| (vars: (xs: (font-size: 14px, | ||
| ), | ||
| sm: (font-size: 16px, | ||
| ), | ||
| md: (font-size: 18px, | ||
| ), | ||
| lg: (font-size: 20px, | ||
| ), | ||
| ), | ||
| prefix: 'label', | ||
| ), | ||
| (vars: (xs: (font-size: 16px, | ||
| ), | ||
| sm: (font-size: 20px, | ||
| ), | ||
| md: (font-size: 24px, | ||
| ), | ||
| lg: (font-size: 32px, | ||
| ), | ||
| ), | ||
| prefix: 'icon', | ||
| ), | ||
| ); | ||
| $component: 'v-button'; | ||
|
|
||
| // Outputs CSS property declarations using the CSS variables set by `size()`, with sm values as fallbacks. | ||
| // Usage: @include v-button.apply('') or @include v-button.apply('label') | ||
| @mixin apply($prefix: '') { | ||
| @if $prefix == '' { | ||
| border: initial; | ||
| background: transparent; | ||
| outline: 1px solid var(--v-button-outline-color, var(--button-label-on-light-outline-border, #010101)); | ||
| transition: color 0.3s ease(out-quad), background-color 0.3s ease(out-quad); | ||
|
|
||
| &:where([inert], #{&}--disabled, [disabled]) { | ||
| color: var(--button-label-on-light-outline-content-disabled, #bdbdbd); | ||
| outline-color: var(--button-label-on-light-outline-border-disabled, rgba(1, 1, 1, 0.3)); | ||
| } | ||
|
|
||
| @media (hover: hover) { | ||
| &:hover { | ||
| background-color: var(--button-label-on-light-outline-bg, #010101); | ||
| color: var(--button-label-on-light-outline-content-hover, #FFF); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| @include css-vars-map.apply($vars, $component, $prefix, $fallback-size: 'sm'); | ||
| } | ||
|
|
||
| // Sets the CSS variables for a given size (xs, sm, md, lg) from $vars. | ||
| // Call this on the component element to drive properties() declarations elsewhere. | ||
| // eg: @include v-button-solid.size('md') generates: | ||
| // --v-button-solid-min-height: 56px; | ||
| // --v-button-solid-padding-inline: 20px; | ||
| // --v-button-solid-label-font-size: 18px; | ||
| // --v-button-solid-icon-font-size: 24px; etc. | ||
| @mixin size($size) { | ||
| @include css-vars-map.deep-get($vars, $size, $component); | ||
| } | ||
|
|
||
| // Generates a BEM modifier class for each size in $vars. | ||
| // Call this on the component root to enable size variants via CSS class. | ||
| // eg: @include v-button-solid.size-classes() generates: | ||
| // &--size-xs { --v-button-solid-min-height: 32px; … } | ||
| // &--size-sm { --v-button-solid-min-height: 40px; … } | ||
| // &--size-md { --v-button-solid-min-height: 56px; … } etc. | ||
| @mixin size-classes() { | ||
| @include sizes($vars, $component); | ||
| } | ||
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
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
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
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.
Why moving the css props to the mixin instead of keeping it into the VButton component style?
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.
Like that, we can fully style a custom element with the same VButton variant style without using the VButton component