-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(avatar): sizes, shapes and colors to avatar
- Loading branch information
Showing
7 changed files
with
135 additions
and
52 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,6 +1,21 @@ | ||
// Avatar | ||
$avatar-size: map-get( $spacing, 8) !default; | ||
$avatar-border-width: 1px !default; | ||
$avatar-border-radius: map-get( $spacing, 1 ) !default; | ||
|
||
$avatar-bg: $primary !default; | ||
$avatar-text: contrast-wcag( $avatar-bg ) !default; | ||
$avatar-font-family: $font-family !default; | ||
$avatar-font-size: $font-size !default; | ||
$avatar-line-height: $line-height !default; | ||
|
||
|
||
$avatar-sizes: () !default; | ||
// sass-lint:disable indentation | ||
$avatar-sizes: map-merge(( | ||
sm: map-get( $spacing, 4 ), | ||
md: map-get( $spacing, 8 ), | ||
lg: map-get( $spacing, 16 ) | ||
), $avatar-sizes); | ||
// sass-lint:enable indentation | ||
|
||
|
||
$avatar-theme-colors: () !default; | ||
$avatar-theme-colors: map-merge( $avatar-theme-colors, $theme-colors ); |
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 |
---|---|---|
@@ -1,6 +1,21 @@ | ||
// Avatar | ||
$avatar-size: map-get( $spacing, 8) !default; | ||
$avatar-border-width: 1px !default; | ||
$avatar-border-radius: map-get( $spacing, 1 ) !default; | ||
|
||
$avatar-bg: $primary !default; | ||
$avatar-text: contrast-wcag( $avatar-bg ) !default; | ||
$avatar-font-family: $font-family !default; | ||
$avatar-font-size: $font-size !default; | ||
$avatar-line-height: $line-height !default; | ||
|
||
|
||
$avatar-sizes: () !default; | ||
// sass-lint:disable indentation | ||
$avatar-sizes: map-merge(( | ||
sm: map-get( $spacing, 4 ), | ||
md: map-get( $spacing, 8 ), | ||
lg: map-get( $spacing, 16 ) | ||
), $avatar-sizes); | ||
// sass-lint:enable indentation | ||
|
||
|
||
$avatar-theme-colors: () !default; | ||
$avatar-theme-colors: map-merge( $avatar-theme-colors, $theme-colors ); |
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 |
---|---|---|
@@ -1,47 +1,62 @@ | ||
@include exports("avatar/layout") { | ||
@include exports( "avatar/layout" ) { | ||
|
||
// Avatar | ||
.k-avatar { | ||
width: $avatar-size; | ||
height: $avatar-size; | ||
display: flex; | ||
border-width: 0; | ||
border-style: solid; | ||
box-sizing: border-box; | ||
flex-shrink: 0 0 auto; | ||
display: inline-flex; | ||
flex-flow: row nowrap; | ||
align-items: center; | ||
justify-content: center; | ||
overflow: hidden; | ||
} | ||
|
||
|
||
// Shapes | ||
.k-avatar-circle { | ||
@include border-radius( 50% ); | ||
// Avatar initials | ||
.k-avatar-initials {} | ||
|
||
|
||
// Avatar icon | ||
.k-avatar-icon {} | ||
|
||
|
||
// Avatar image | ||
.k-avatar-image { | ||
width: 100%; | ||
height: 100%; | ||
background-position: center; | ||
background-size: cover; | ||
background-repeat: no-repeat; | ||
} | ||
|
||
|
||
&.k-avatar-image { | ||
> * { | ||
@include border-radius( 50% ); | ||
} | ||
// Sizes | ||
@each $name, $size in $avatar-sizes { | ||
.k-avatar-#{$name} { | ||
width: $size; | ||
height: $size; | ||
flex-basis: $size; | ||
} | ||
} | ||
|
||
|
||
// Shapes | ||
.k-avatar-square {} | ||
.k-avatar-rounded { | ||
@include border-radius( $avatar-border-radius ); | ||
|
||
&.k-avatar-image { | ||
> * { | ||
@include border-radius( $avatar-border-radius ); | ||
} | ||
} | ||
} | ||
.k-avatar-circle { | ||
border-radius: 50%; | ||
} | ||
|
||
|
||
// Avatar content | ||
.k-avatar-image { | ||
> * { | ||
width: $avatar-size; | ||
height: $avatar-size; | ||
background-position: center; | ||
background-size: cover; | ||
background-repeat: no-repeat; | ||
} | ||
// Bordered | ||
.k-avatar-bordered { | ||
border-width: $avatar-border-width; | ||
} | ||
|
||
|
||
} | ||
|
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 |
---|---|---|
@@ -1,11 +1,23 @@ | ||
@include exports("avatar/theme") { | ||
|
||
.k-avatar-icon, | ||
.k-avatar-initials { | ||
@include fill ( | ||
$avatar-text, | ||
$avatar-bg | ||
); | ||
@include exports( "avatar/theme" ) { | ||
|
||
// Solid Avatars | ||
@each $name, $color in $avatar-theme-colors { | ||
.k-avatar-solid.k-avatar-#{$name} { | ||
border-color: $color; | ||
color: contrast-wcag( $color ); | ||
background-color: $color; | ||
} | ||
} | ||
|
||
// Outline avatars | ||
.k-avatar-outline { | ||
border-color: currentColor; | ||
} | ||
|
||
@each $name, $color in $avatar-theme-colors { | ||
.k-avatar-outline.k-avatar-#{$name} { | ||
color: $color; | ||
} | ||
} | ||
|
||
} |
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 |
---|---|---|
@@ -1,6 +1,21 @@ | ||
// Avatar | ||
$avatar-size: map-get( $spacing, 8) !default; | ||
$avatar-border-width: 1px !default; | ||
$avatar-border-radius: map-get( $spacing, 1 ) !default; | ||
|
||
$avatar-bg: $primary !default; | ||
$avatar-text: contrast-wcag( $avatar-bg ) !default; | ||
$avatar-font-family: $font-family !default; | ||
$avatar-font-size: $font-size !default; | ||
$avatar-line-height: $line-height !default; | ||
|
||
|
||
$avatar-sizes: () !default; | ||
// sass-lint:disable indentation | ||
$avatar-sizes: map-merge(( | ||
sm: map-get( $spacing, 4 ), | ||
md: map-get( $spacing, 8 ), | ||
lg: map-get( $spacing, 16 ) | ||
), $avatar-sizes); | ||
// sass-lint:enable indentation | ||
|
||
|
||
$avatar-theme-colors: () !default; | ||
$avatar-theme-colors: map-merge( $avatar-theme-colors, $theme-colors ); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,21 @@ | ||
// Avatar | ||
$avatar-size: map-get( $spacing, 8) !default; | ||
$avatar-border-width: 1px !default; | ||
$avatar-border-radius: map-get( $spacing, 1 ) !default; | ||
|
||
$avatar-bg: $primary !default; | ||
$avatar-text: contrast-wcag( $avatar-bg ) !default; | ||
$avatar-font-family: $font-family !default; | ||
$avatar-font-size: $font-size !default; | ||
$avatar-line-height: $line-height !default; | ||
|
||
|
||
$avatar-sizes: () !default; | ||
// sass-lint:disable indentation | ||
$avatar-sizes: map-merge(( | ||
sm: map-get( $spacing, 4 ), | ||
md: map-get( $spacing, 8 ), | ||
lg: map-get( $spacing, 16 ) | ||
), $avatar-sizes); | ||
// sass-lint:enable indentation | ||
|
||
|
||
$avatar-theme-colors: () !default; | ||
$avatar-theme-colors: map-merge( $avatar-theme-colors, $theme-colors ); |