|
21 | 21 |
|
22 | 22 | export let icon = ''; |
23 | 23 |
|
| 24 | + export let iconOutline = false; |
| 25 | +
|
| 26 | + export let iconSize: 'sm' | 'md' | 'lg' | 'xl' = 'sm'; |
| 27 | +
|
24 | 28 | export let hint: string | undefined = undefined; |
25 | 29 |
|
26 | 30 | export let disabled = false; |
|
29 | 33 |
|
30 | 34 | export let external = false; |
31 | 35 |
|
32 | | - export let control = true; |
| 36 | + export let printVisible = true; |
33 | 37 | </script> |
34 | 38 |
|
35 | 39 | {#if href} |
36 | | - <Link on:click="{onClick}" {external} url="{href}" {hint} raw inline {control}> |
| 40 | + <Link on:click="{onClick}" {external} url="{href}" {hint} raw inline {printVisible}> |
37 | 41 | <span class:l="{!isDark}" class:d="{isDark}" class:secondary class:inline class="ui-button"> |
38 | | - <span class="ui-button__text"> |
39 | | - <slot /> |
40 | | - </span> |
| 42 | + {#if $$slots.default} |
| 43 | + <span class="ui-button__text"> |
| 44 | + <slot /> |
| 45 | + </span> |
| 46 | + {/if} |
41 | 47 | {#if icon} |
42 | | - <img src="{icon}" class="ui-button__icon" alt="{hint}" /> |
| 48 | + <img |
| 49 | + src="{icon}" |
| 50 | + class:outline="{iconOutline}" |
| 51 | + class="ui-button__icon {iconSize}" |
| 52 | + alt="{hint}" |
| 53 | + /> |
43 | 54 | {/if} |
44 | 55 | </span> |
45 | 56 | </Link> |
|
50 | 61 | class:d="{isDark}" |
51 | 62 | class:secondary |
52 | 63 | class:inline |
53 | | - class:no-print="{!control}" |
| 64 | + class:no-print="{!printVisible}" |
54 | 65 | on:click="{onClick}" |
55 | 66 | title="{hint}" |
56 | 67 | {disabled} |
57 | | - aria-hidden="{control ? undefined : 'true'}" |
58 | | - tabindex="{control ? undefined : -1}" |
59 | 68 | > |
60 | | - <span class="ui-button__text"> |
61 | | - <slot /> |
62 | | - </span> |
| 69 | + {#if $$slots.default} |
| 70 | + <span class="ui-button__text"> |
| 71 | + <slot /> |
| 72 | + </span> |
| 73 | + {/if} |
63 | 74 | {#if icon} |
64 | | - <img src="{icon}" class="ui-button__icon" alt="{hint}" /> |
| 75 | + <img |
| 76 | + src="{icon}" |
| 77 | + class:outline="{iconOutline}" |
| 78 | + class="ui-button__icon {iconSize}" |
| 79 | + alt="{hint}" |
| 80 | + /> |
65 | 81 | {/if} |
66 | 82 | </button> |
67 | 83 | {/if} |
|
92 | 108 |
|
93 | 109 | &.secondary { |
94 | 110 | border: 0; |
95 | | - padding-block: 0; |
96 | | - padding-inline: $unit-half; |
| 111 | + padding: $unit-quarter $unit-half; |
97 | 112 | } |
98 | 113 | &.inline { |
99 | 114 | border: 0; |
|
109 | 124 |
|
110 | 125 | &.l { |
111 | 126 | @include button-style($l-primary, $l-accent); |
| 127 | +
|
| 128 | + .outline { |
| 129 | + @include draw-image-black(); |
| 130 | + } |
112 | 131 | } |
113 | 132 |
|
114 | 133 | &.d { |
115 | 134 | @include button-style($d-primary, $d-accent); |
| 135 | +
|
| 136 | + .outline { |
| 137 | + @include draw-image-white(); |
| 138 | + } |
116 | 139 | } |
117 | 140 |
|
118 | 141 | &__text { |
|
121 | 144 | } |
122 | 145 |
|
123 | 146 | &__icon { |
124 | | - height: $unit; |
125 | 147 | object-fit: contain; |
126 | | - width: $unit; |
| 148 | + vertical-align: middle; |
| 149 | + @include smooth-change(filter, transform); |
| 150 | +
|
| 151 | + &.xl { |
| 152 | + height: $unit-triple; |
| 153 | + width: $unit-triple; |
| 154 | + } |
| 155 | + &.lg { |
| 156 | + height: $unit-double; |
| 157 | + width: $unit-double; |
| 158 | + } |
| 159 | + &.md { |
| 160 | + height: $unit-plus; |
| 161 | + width: $unit-plus; |
| 162 | + } |
| 163 | + &.sm { |
| 164 | + height: $unit; |
| 165 | + width: $unit; |
| 166 | + } |
127 | 167 | } |
128 | 168 | } |
129 | 169 | </style> |
0 commit comments