diff options
Diffstat (limited to 'src/objects')
| -rw-r--r-- | src/objects/_avatar.scss | 26 | ||||
| -rw-r--r-- | src/objects/_avatar.vars.scss | 33 |
2 files changed, 44 insertions, 15 deletions
diff --git a/src/objects/_avatar.scss b/src/objects/_avatar.scss index 8f8fad8..764c039 100644 --- a/src/objects/_avatar.scss +++ b/src/objects/_avatar.scss | |||
| @@ -27,7 +27,6 @@ | |||
| 27 | @include bem.object('avatar') { | 27 | @include bem.object('avatar') { |
| 28 | position: relative; | 28 | position: relative; |
| 29 | display: inline-block; | 29 | display: inline-block; |
| 30 | font-size: props.get(vars.$font-size); | ||
| 31 | font-style: normal; | 30 | font-style: normal; |
| 32 | vertical-align: .05em; | 31 | vertical-align: .05em; |
| 33 | border-radius: props.get(vars.$rounding); | 32 | border-radius: props.get(vars.$rounding); |
| @@ -61,13 +60,13 @@ | |||
| 61 | inset-block-end: 0; | 60 | inset-block-end: 0; |
| 62 | inset-inline-end: 0; | 61 | inset-inline-end: 0; |
| 63 | display: flex; | 62 | display: flex; |
| 64 | align-items: center; | 63 | align-items: flex-end; |
| 65 | justify-content: center; | 64 | justify-content: flex-end; |
| 66 | inline-size: 40%; | 65 | inline-size: props.get(vars.$icon-size); |
| 67 | block-size: 40%; | 66 | block-size: props.get(vars.$icon-size); |
| 68 | 67 | ||
| 69 | @include bem.sibling-elem('content') { | 68 | @include bem.sibling-elem('content') { |
| 70 | clip-path: url('data:image/svg+xml;utf8,<svg version="1.1" xmlns="http://www.w3.org/2000/svg"><defs><clipPath id="avatar_mask" clipPathUnits="objectBoundingBox" transform="scale(0.1)"><path d="M 0,0 H 10 V 5 H 6.5 C 5.55,5 5,5.55 5,6.5 V 10 H 0 Z" /></clipPath></defs></svg>#avatar_mask'); | 69 | clip-path: props.get(vars.$icon-mask); |
| 71 | } | 70 | } |
| 72 | } | 71 | } |
| 73 | 72 | ||
| @@ -75,6 +74,7 @@ | |||
| 75 | display: block; | 74 | display: block; |
| 76 | inline-size: props.get(vars.$size); | 75 | inline-size: props.get(vars.$size); |
| 77 | block-size: props.get(vars.$size); | 76 | block-size: props.get(vars.$size); |
| 77 | font-size: props.get(vars.$font-size); | ||
| 78 | line-height: props.get(vars.$size); | 78 | line-height: props.get(vars.$size); |
| 79 | text-align: center; | 79 | text-align: center; |
| 80 | object-fit: cover; | 80 | object-fit: cover; |
| @@ -118,15 +118,23 @@ | |||
| 118 | 118 | ||
| 119 | @include status(vars.$indicator-size); | 119 | @include status(vars.$indicator-size); |
| 120 | 120 | ||
| 121 | @each $mod, $size, $font-size, $indicator-size in vars.$sizes { | 121 | @each $mod, $size, $font-size, $indicator-size, $icon-size, $icon-mask in vars.$sizes { |
| 122 | @include bem.modifier($mod) { | 122 | @include bem.modifier($mod) { |
| 123 | font-size: props.get($font-size); | ||
| 124 | |||
| 125 | @include status($indicator-size); | 123 | @include status($indicator-size); |
| 124 | |||
| 125 | @include bem.elem('icon') { | ||
| 126 | inline-size: props.get($icon-size); | ||
| 127 | block-size: props.get($icon-size); | ||
| 128 | |||
| 129 | @include bem.sibling-elem('content') { | ||
| 130 | clip-path: props.get($icon-mask); | ||
| 131 | } | ||
| 132 | } | ||
| 126 | 133 | ||
| 127 | @include bem.elem('content') { | 134 | @include bem.elem('content') { |
| 128 | inline-size: props.get($size); | 135 | inline-size: props.get($size); |
| 129 | block-size: props.get($size); | 136 | block-size: props.get($size); |
| 137 | font-size: props.get($font-size); | ||
| 130 | line-height: props.get($size); | 138 | line-height: props.get($size); |
| 131 | } | 139 | } |
| 132 | } | 140 | } |
diff --git a/src/objects/_avatar.vars.scss b/src/objects/_avatar.vars.scss index 2374f5a..d6e0497 100644 --- a/src/objects/_avatar.vars.scss +++ b/src/objects/_avatar.vars.scss | |||
| @@ -1,35 +1,56 @@ | |||
| 1 | @use 'sass:math'; | ||
| 2 | |||
| 1 | @use 'iro-sass/src/props'; | 3 | @use 'iro-sass/src/props'; |
| 2 | @use '../core.vars' as core; | 4 | @use '../core.vars' as core; |
| 3 | 5 | ||
| 6 | @function icon-mask($p) { | ||
| 7 | $offset: 0.15 * math.div(0.5, $p); | ||
| 8 | @return 'data:image/svg+xml;utf8,<svg version="1.1" xmlns="http://www.w3.org/2000/svg"><defs><clipPath id="avatar_mask" clipPathUnits="objectBoundingBox"><path d="M 0,0 H 1 V #{$p} H #{$p + $offset} C #{$p + 0.055},#{$p} #{$p},#{$p + 0.055} #{$p},#{$p + $offset} V 1 H 0 Z" /></clipPath></defs></svg>#avatar_mask'; | ||
| 9 | } | ||
| 10 | |||
| 4 | $size: props.def(--o-avatar--size, props.get(core.$size--500)) !default; | 11 | $size: props.def(--o-avatar--size, props.get(core.$size--500)) !default; |
| 5 | $font-size: props.def(--o-avatar--font-size, props.get(core.$font-size--100)) !default; | 12 | $font-size: props.def(--o-avatar--font-size, props.get(core.$font-size--100)) !default; |
| 6 | $indicator-size: props.def(--o-avatar--indicator-size, props.get(core.$size--150)) !default; | 13 | $indicator-size: props.def(--o-avatar--indicator-size, props.get(core.$size--150)) !default; |
| 7 | $indicator-spacing: props.def(--o-avatar--indicator-spacing, props.get(core.$size--40)) !default; | 14 | $indicator-spacing: props.def(--o-avatar--indicator-spacing, props.get(core.$size--40)) !default; |
| 8 | $rounding: props.def(--o-avatar--rounding, 25%) !default; | 15 | $rounding: props.def(--o-avatar--rounding, 25%) !default; |
| 16 | $icon-size: props.def(--o-avatar--icon-size, 1.2em) !default; | ||
| 17 | $icon-mask: props.def(--o-avatar--icon-mask, url(icon-mask(.5))) !default; | ||
| 9 | 18 | ||
| 10 | $size--xxxl: props.def(--o-avatar--xxxl--size, props.get(core.$size--1600)) !default; | 19 | $size--xxxl: props.def(--o-avatar--xxxl--size, props.get(core.$size--1600)) !default; |
| 11 | $font-size--xxxl: props.def(--o-avatar--xxxl--font-size, props.get(core.$font-size--800)) !default; | 20 | $font-size--xxxl: props.def(--o-avatar--xxxl--font-size, props.get(core.$font-size--800)) !default; |
| 12 | $indicator-size--xxxl: props.def(--o-avatar--xxxl--indicator-size, props.get(core.$size--400)) !default; | 21 | $indicator-size--xxxl: props.def(--o-avatar--xxxl--indicator-size, props.get(core.$size--400)) !default; |
| 22 | $icon-size--xxxl: props.def(--o-avatar--xxxl--icon-size, 1.9em) !default; | ||
| 23 | $icon-mask--xxxl: props.def(--o-avatar--xxxl--icon-mask, url(icon-mask(.75))) !default; | ||
| 13 | 24 | ||
| 14 | $size--xxl: props.def(--o-avatar--xxl--size, props.get(core.$size--1200)) !default; | 25 | $size--xxl: props.def(--o-avatar--xxl--size, props.get(core.$size--1200)) !default; |
| 15 | $font-size--xxl: props.def(--o-avatar--xxl--font-size, props.get(core.$font-size--600)) !default; | 26 | $font-size--xxl: props.def(--o-avatar--xxl--font-size, props.get(core.$font-size--600)) !default; |
| 16 | $indicator-size--xxl: props.def(--o-avatar--xxl--indicator-size, props.get(core.$size--300)) !default; | 27 | $indicator-size--xxl: props.def(--o-avatar--xxl--indicator-size, props.get(core.$size--300)) !default; |
| 28 | $icon-size--xxl: props.def(--o-avatar--xxl--icon-size, 1.7em) !default; | ||
| 29 | $icon-mask--xxl: props.def(--o-avatar--xxl--icon-mask, url(icon-mask(.7))) !default; | ||
| 17 | 30 | ||
| 18 | $size--xl: props.def(--o-avatar--xl--size, props.get(core.$size--800)) !default; | 31 | $size--xl: props.def(--o-avatar--xl--size, props.get(core.$size--800)) !default; |
| 19 | $font-size--xl: props.def(--o-avatar--xl--font-size, props.get(core.$font-size--300)) !default; | 32 | $font-size--xl: props.def(--o-avatar--xl--font-size, props.get(core.$font-size--300)) !default; |
| 20 | $indicator-size--xl: props.def(--o-avatar--xl--indicator-size, props.get(core.$size--225)) !default; | 33 | $indicator-size--xl: props.def(--o-avatar--xl--indicator-size, props.get(core.$size--225)) !default; |
| 34 | $icon-size--xl: props.def(--o-avatar--xl--icon-size, 1.5em) !default; | ||
| 35 | $icon-mask--xl: props.def(--o-avatar--xl--icon-mask, url(icon-mask(.6))) !default; | ||
| 21 | 36 | ||
| 22 | $size--lg: props.def(--o-avatar--lg--size, props.get(core.$size--650)) !default; | 37 | $size--lg: props.def(--o-avatar--lg--size, props.get(core.$size--650)) !default; |
| 23 | $font-size--lg: props.def(--o-avatar--lg--font-size, props.get(core.$font-size--200)) !default; | 38 | $font-size--lg: props.def(--o-avatar--lg--font-size, props.get(core.$font-size--200)) !default; |
| 24 | $indicator-size--lg: props.def(--o-avatar--lg--indicator-size, props.get(core.$size--175)) !default; | 39 | $indicator-size--lg: props.def(--o-avatar--lg--indicator-size, props.get(core.$size--175)) !default; |
| 40 | $icon-size--lg: props.def(--o-avatar--lg--icon-size, 1.25em) !default; | ||
| 41 | $icon-mask--lg: props.def(--o-avatar--lg--icon-mask, url(icon-mask(.55))) !default; | ||
| 25 | 42 | ||
| 26 | $size--sm: props.def(--o-avatar--sm--size, props.get(core.$size--375)) !default; | 43 | $size--sm: props.def(--o-avatar--sm--size, props.get(core.$size--375)) !default; |
| 27 | $font-size--sm: props.def(--o-avatar--sm--font-size, props.get(core.$font-size--75)) !default; | 44 | $font-size--sm: props.def(--o-avatar--sm--font-size, props.get(core.$font-size--75)) !default; |
| 28 | $indicator-size--sm: props.def(--o-avatar--sm--indicator-size, props.get(core.$size--125)) !default; | 45 | $indicator-size--sm: props.def(--o-avatar--sm--indicator-size, props.get(core.$size--125)) !default; |
| 46 | $icon-size--sm: props.def(--o-avatar--sm--icon-size, 1.2em) !default; | ||
| 47 | $icon-mask--sm: props.def(--o-avatar--sm--icon-mask, url(icon-mask(.5))) !default; | ||
| 29 | 48 | ||
| 30 | $size--xs: props.def(--o-avatar--xs--size, props.get(core.$size--250)) !default; | 49 | $size--xs: props.def(--o-avatar--xs--size, props.get(core.$size--250)) !default; |
| 31 | $font-size--xs: props.def(--o-avatar--xs--font-size, props.get(core.$font-size--50)) !default; | 50 | $font-size--xs: props.def(--o-avatar--xs--font-size, props.get(core.$font-size--50)) !default; |
| 32 | $indicator-size--xs: props.def(--o-avatar--xs--indicator-size, props.get(core.$size--100)) !default; | 51 | $indicator-size--xs: props.def(--o-avatar--xs--indicator-size, props.get(core.$size--100)) !default; |
| 52 | $icon-size--xs: props.def(--o-avatar--xs--icon-size, 1.2em) !default; | ||
| 53 | $icon-mask--xs: props.def(--o-avatar--xs--icon-mask, url(icon-mask(.5))) !default; | ||
| 33 | 54 | ||
| 34 | $key-focus--border-width: props.def(--o-avatar--key-focus--border-width, props.get(core.$key-focus--border-width)) !default; | 55 | $key-focus--border-width: props.def(--o-avatar--key-focus--border-width, props.get(core.$key-focus--border-width)) !default; |
| 35 | $key-focus--border-offset: props.def(--o-avatar--key-focus--border-offset, props.get(core.$key-focus--border-offset)) !default; | 56 | $key-focus--border-offset: props.def(--o-avatar--key-focus--border-offset, props.get(core.$key-focus--border-offset)) !default; |
| @@ -49,10 +70,10 @@ $key-focus--border-color: props.def(--o-avatar--key-focus--border-color, props. | |||
| 49 | $key-focus--outline-color: props.def(--o-avatar--key-focus--outline-color, props.get(core.$theme, --focus, --outline), 'color') !default; | 70 | $key-focus--outline-color: props.def(--o-avatar--key-focus--outline-color, props.get(core.$theme, --focus, --outline), 'color') !default; |
| 50 | 71 | ||
| 51 | $sizes: ( | 72 | $sizes: ( |
| 52 | 'xs' $size--xs $font-size--xs $indicator-size--xs, | 73 | 'xs' $size--xs $font-size--xs $indicator-size--xs $icon-size--xs $icon-mask--xs, |
| 53 | 'sm' $size--sm $font-size--sm $indicator-size--sm, | 74 | 'sm' $size--sm $font-size--sm $indicator-size--sm $icon-size--sm $icon-mask--sm, |
| 54 | 'lg' $size--lg $font-size--lg $indicator-size--lg, | 75 | 'lg' $size--lg $font-size--lg $indicator-size--lg $icon-size--lg $icon-mask--lg, |
| 55 | 'xl' $size--xl $font-size--xl $indicator-size--xl, | 76 | 'xl' $size--xl $font-size--xl $indicator-size--xl $icon-size--xl $icon-mask--xl, |
| 56 | 'xxl' $size--xxl $font-size--xxl $indicator-size--xxl, | 77 | 'xxl' $size--xxl $font-size--xxl $indicator-size--xxl $icon-size--xxl $icon-mask--xxl, |
| 57 | 'xxxl' $size--xxxl $font-size--xxxl $indicator-size--xxxl, | 78 | 'xxxl' $size--xxxl $font-size--xxxl $indicator-size--xxxl $icon-size--xxxl $icon-mask--xxxl, |
| 58 | ) !default; | 79 | ) !default; |
