|
6 | 6 | /// @param {Map} $theme - The theme used to style the component. |
7 | 7 | @mixin badge($theme) { |
8 | 8 | @include css-vars($theme); |
9 | | - |
| 9 | + $theme-variant: map.get($theme, '_meta', 'variant'); |
10 | 10 | $variant: map.get($theme, '_meta', 'theme'); |
11 | 11 |
|
12 | 12 | %igx-badge-display { |
13 | | - --size: #{rem(22px)}; |
14 | | - --_badge-size: var(--size); |
| 13 | + @include sizable(); |
| 14 | + |
| 15 | + --component-size: var(--ig-size, #{var-get($theme, 'default-size')}); |
| 16 | + --badge-size: var(--component-size); |
| 17 | + --_badge-size: #{var-get($theme, 'size')}; |
15 | 18 |
|
16 | 19 | display: inline-flex; |
17 | 20 | justify-content: center; |
|
25 | 28 | overflow: hidden; |
26 | 29 |
|
27 | 30 | igx-icon { |
28 | | - --size: var(--igx-icon-size, calc(var(--_badge-size) / 2)); |
| 31 | + --size: var(--igx-icon-size, #{sizable(rem(12px), rem(14px), rem(16px))}); |
| 32 | + --component-size: var(--badge-size); |
29 | 33 |
|
30 | 34 | display: inline-flex; |
31 | 35 | justify-content: center; |
32 | 36 | align-items: center; |
33 | | - font-weight: 400; |
34 | 37 | color: var-get($theme, 'icon-color'); |
35 | 38 | } |
36 | 39 |
|
37 | 40 | @if $variant == 'indigo' { |
38 | 41 | igx-icon { |
39 | | - $icon-size: rem(12px); |
| 42 | + $icon-size: sizable(rem(8px), rem(10px), rem(12px)); |
40 | 43 |
|
41 | 44 | --ig-icon-size: #{$icon-size}; |
42 | 45 | --igx-icon-size: #{$icon-size}; |
|
45 | 48 | } |
46 | 49 |
|
47 | 50 | %igx-badge--outlined { |
48 | | - box-shadow: inset 0 0 0 rem(if($variant != 'bootstrap', 2px, 1px)) var-get($theme, 'border-color'); |
| 51 | + box-shadow: 0 0 0 rem(2px) var-get($theme, 'border-color'); |
49 | 52 | } |
50 | 53 |
|
51 | 54 | %igx-badge--square { |
|
54 | 57 |
|
55 | 58 | %igx-badge-value { |
56 | 59 | white-space: nowrap; |
57 | | - padding-inline: pad-inline(rem(4px)); |
| 60 | + padding-inline: pad-inline(rem(4px), rem(6px), if($variant == 'indigo', rem(6px), rem(8px))); |
58 | 61 | } |
59 | 62 |
|
60 | 63 | %igx-badge--success { |
61 | | - background: color($color: 'success'); |
| 64 | + background: color($color: 'success', $variant: if($variant != 'material', if($variant == 'indigo', 700, 500), 900)); |
62 | 65 | } |
63 | 66 |
|
64 | 67 | %igx-badge--info { |
65 | | - background: color($color: 'info'); |
| 68 | + background: color($color: 'info', $variant: if($variant != 'material', if($variant == 'fluent', 700, 500), 800)); |
66 | 69 | } |
67 | 70 |
|
68 | 71 | %igx-badge--warn { |
69 | 72 | background: color($color: 'warn'); |
| 73 | + |
| 74 | + @if $variant == 'indigo' and $theme-variant == 'light' { |
| 75 | + color: color($color: 'gray', $variant: 900); |
| 76 | + |
| 77 | + igx-icon { |
| 78 | + color: color($color: 'gray', $variant: 900); |
| 79 | + } |
| 80 | + } @else if $variant == 'indigo' and $theme-variant == 'dark' { |
| 81 | + color: color($color: 'gray', $variant: 50); |
| 82 | + |
| 83 | + igx-icon { |
| 84 | + color: color($color: 'gray', $variant: 50); |
| 85 | + } |
| 86 | + } @else { |
| 87 | + color: contrast-color($color: 'warn', $variant: 500); |
| 88 | + |
| 89 | + igx-icon { |
| 90 | + color: contrast-color($color: 'warn', $variant: 500); |
| 91 | + } |
| 92 | + } |
70 | 93 | } |
71 | 94 |
|
72 | 95 | %igx-badge--error { |
73 | | - background: color($color: 'error'); |
| 96 | + background: color($color: 'error', $variant: if($variant == 'material', 700, 500)); |
| 97 | + color: contrast-color($color: 'error', $variant: if($variant == 'bootstrap', 100, 900)); |
| 98 | + } |
| 99 | + |
| 100 | + %igx-badge--dot { |
| 101 | + --_dot-size: #{var-get($theme, 'dot-size')}; |
| 102 | + |
| 103 | + min-width: var(--_dot-size); |
| 104 | + min-height: var(--_dot-size); |
| 105 | + padding: 0; |
| 106 | + |
| 107 | + igx-icon, |
| 108 | + > * { |
| 109 | + display: none; |
| 110 | + } |
74 | 111 | } |
75 | 112 |
|
76 | 113 | %igx-badge--hidden { |
|
79 | 116 | } |
80 | 117 |
|
81 | 118 | /// Adds typography styles for the igx-badge component. |
82 | | -/// Uses the 'caption' category from the typographic scale. |
| 119 | +/// Uses 'caption' and 'body-2' categories from the typographic scale. |
83 | 120 | /// @group typography |
84 | 121 | /// @param {Map} $categories [(text: 'caption')] - The categories from the typographic scale used for type styles. |
85 | | -@mixin badge-typography($categories: (text: 'caption')) { |
| 122 | +@mixin badge-typography($categories: (text: null), $theme: null) { |
86 | 123 | $text: map.get($categories, 'text'); |
87 | 124 |
|
88 | 125 | %igx-badge-display { |
89 | | - @include type-style($text) { |
90 | | - margin: 0; |
| 126 | + @if $text { |
| 127 | + @include type-style($text); |
| 128 | + } @else { |
| 129 | + @if $theme == 'indigo' { |
| 130 | + @include type-style('button', false) { |
| 131 | + font-size: sizable(rem(9px), rem(10px), var(--ig-button-font-size)); |
| 132 | + line-height: sizable(rem(12px), rem(14px), var(--ig-button-line-height)); |
| 133 | + } |
| 134 | + } @else { |
| 135 | + font-size: sizable(var(--ig-caption-font-size), var(--ig-body-2-font-size), var(--ig-body-2-font-size)); |
| 136 | + font-weight: sizable(var(--ig-caption-font-weight), var(--ig-body-2-font-weight), var(--ig-body-2-font-weight)); |
| 137 | + line-height: sizable(var(--ig-caption-line-height), var(--ig-body-2-line-height), var(--ig-body-2-line-height)); |
| 138 | + letter-spacing: sizable(var(--ig-caption-letter-spacing), var(--ig-body-2-letter-spacing), var(--ig-body-2-letter-spacing)); |
| 139 | + text-transform: sizable(var(--ig-caption-text-transform), var(--ig-body-2-text-transform), var(--ig-body-2-text-transform)); |
| 140 | + } |
91 | 141 | } |
92 | 142 | } |
93 | 143 | } |
0 commit comments