-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(icon-button): consume colors from schema properly (#997)
Co-authored-by: Simeon Simeonoff <[email protected]>
- Loading branch information
1 parent
e62fa49
commit 7a03578
Showing
10 changed files
with
216 additions
and
295 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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 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 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 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
154 changes: 154 additions & 0 deletions
154
src/components/button/themes/icon-button/shared/icon-button.common.scss
This file contains 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,154 @@ | ||
@use 'styles/utilities' as *; | ||
@use '../light/themes' as *; | ||
|
||
$flat-theme: $material-flat; | ||
$contained-theme: $material-contained; | ||
$outlined-theme: $material-outlined; | ||
|
||
[part='base'] { | ||
border-radius: var-get($flat-theme, 'border-radius'); | ||
width: var-get($flat-theme, 'size'); | ||
height: var-get($flat-theme, 'size'); | ||
} | ||
|
||
:host([variant='flat']) { | ||
@include css-vars-from-theme($flat-theme, 'ig-icon-button'); | ||
|
||
--component-size: var(--ig-size, #{var-get($flat-theme, 'default-size')}); | ||
|
||
[part='base'] { | ||
color: var-get($flat-theme, 'foreground'); | ||
background: var-get($flat-theme, 'background'); | ||
|
||
&:hover { | ||
background: var-get($flat-theme, 'hover-background'); | ||
color: var-get($flat-theme, 'hover-foreground'); | ||
} | ||
|
||
&:focus, | ||
&:focus-within { | ||
background: var-get($flat-theme, 'focus-background'); | ||
color: var-get($flat-theme, 'focus-foreground'); | ||
} | ||
|
||
&:active { | ||
background: var-get($flat-theme, 'active-background'); | ||
color: var-get($flat-theme, 'active-foreground'); | ||
} | ||
} | ||
|
||
igc-icon { | ||
color: var-get($flat-theme, 'foreground'); | ||
} | ||
|
||
::slotted(igc-ripple) { | ||
border-radius: var-get($flat-theme, 'border-radius'); | ||
} | ||
} | ||
|
||
:host([variant='contained']) { | ||
@include css-vars-from-theme($contained-theme, 'ig-icon-button'); | ||
|
||
--component-size: var(--ig-size, #{var-get($contained-theme, 'default-size')}); | ||
|
||
[part='base'] { | ||
background: var-get($contained-theme, 'background'); | ||
color: var-get($contained-theme, 'foreground'); | ||
|
||
&:hover { | ||
background: var-get($contained-theme, 'hover-background'); | ||
color: var-get($contained-theme, 'hover-foreground'); | ||
} | ||
|
||
&:focus, | ||
&:focus-within { | ||
background: var-get($contained-theme, 'focus-background'); | ||
color: var-get($contained-theme, 'focus-foreground'); | ||
} | ||
|
||
&:active { | ||
background: var-get($contained-theme, 'active-background'); | ||
color: var-get($contained-theme, 'active-foreground'); | ||
} | ||
} | ||
|
||
igc-icon { | ||
color: var-get($contained-theme, 'foreground'); | ||
} | ||
|
||
::slotted(igc-ripple) { | ||
border-radius: var-get($contained-theme, 'border-radius'); | ||
} | ||
} | ||
|
||
:host([variant='outlined']) { | ||
@include css-vars-from-theme($outlined-theme, 'ig-icon-button'); | ||
|
||
--component-size: var(--ig-size, #{var-get($outlined-theme, 'default-size')}); | ||
|
||
[part='base'] { | ||
color: var-get($outlined-theme, 'foreground'); | ||
background: var-get($outlined-theme, 'background'); | ||
box-shadow: 0 0 0 rem(1px) var-get($outlined-theme, 'border-color'); | ||
|
||
&:hover { | ||
background: var-get($outlined-theme, 'hover-background'); | ||
color: var-get($outlined-theme, 'hover-foreground'); | ||
} | ||
|
||
&:focus, | ||
&:focus-within { | ||
background: var-get($outlined-theme, 'focus-background'); | ||
color: var-get($outlined-theme, 'focus-foreground'); | ||
} | ||
|
||
&:active { | ||
background: var-get($outlined-theme, 'active-background'); | ||
color: var-get($outlined-theme, 'active-foreground'); | ||
} | ||
} | ||
|
||
igc-icon { | ||
color: var-get($outlined-theme, 'foreground'); | ||
} | ||
|
||
::slotted(igc-ripple) { | ||
border-radius: var-get($outlined-theme, 'border-radius'); | ||
} | ||
} | ||
|
||
:host([disabled]), | ||
:host(:disabled) { | ||
[part='base'] { | ||
background: var-get($flat-theme, 'disabled-background'); | ||
color: var-get($flat-theme, 'disabled-foreground'); | ||
} | ||
|
||
igc-icon { | ||
color: var-get($flat-theme, 'disabled-foreground'); | ||
} | ||
} | ||
|
||
:host([disabled][variant='contained']), | ||
:host(:disabled[variant='contained']) { | ||
[part='base'] { | ||
background: var-get($contained-theme, 'disabled-background'); | ||
color: var-get($contained-theme, 'disabled-foreground'); | ||
} | ||
|
||
igc-icon { | ||
color: var-get($contained-theme, 'disabled-foreground'); | ||
} | ||
} | ||
|
||
:host([disabled][variant='outlined']), | ||
:host(:disabled[variant='outlined']) { | ||
[part='base'] { | ||
background: var-get($outlined-theme, 'disabled-background'); | ||
color: var-get($outlined-theme, 'disabled-foreground'); | ||
} | ||
|
||
igc-icon { | ||
color: var-get($outlined-theme, 'disabled-foreground'); | ||
} | ||
} |
Oops, something went wrong.