77 :type =" type"
88 @click =" copy ? copyToClipboard(text) : click"
99 >
10+ <AppIcon v-if =" icon && iconPosition === 'left'" :icon =" icon" class =" icon" />
1011 <span v-if =" text" class =" truncate" >{{ text }}</span >
11- <AppIcon v-if =" icon" :icon =" icon" />
12+ <!-- icon on the RIGHT (default) -->
13+ <AppIcon
14+ v-if =" icon && iconPosition === 'right'"
15+ :icon =" icon"
16+ class =" icon"
17+ />
18+ <!-- optional info icon -->
19+ <AppIcon
20+ v-if =" info"
21+ icon =" info-circle"
22+ v-tooltip =" infoTooltip"
23+ class =" info-icon"
24+ />
1225 </component >
1326</template >
1427
@@ -21,29 +34,38 @@ type Props = {
2134 text? : string ;
2235 /** icon to show */
2336 icon? : string ;
37+ /** where to place the icon relative to text */
38+ iconPosition? : " left" | " right" ;
2439 /** location to link to */
2540 to? : string ;
2641 /** on click action */
2742 click? : () => unknown ;
2843 /** visual design */
29- design? : " normal" | " circle" | " small" | " tile" ;
44+ design? : " normal" | " circle" | " small" | " tile" | " big " | " link " ;
3045 /** color */
3146 color? : " primary" | " secondary" | " none" ;
3247 /** whether to copy text prop to clipboard on click */
3348 copy? : boolean ;
3449 /** html button type attribute */
3550 type? : string ;
51+ /** show an “i” info icon on the right */
52+ info? : boolean ;
53+ /** tooltip text for the info icon */
54+ infoTooltip? : string ;
3655};
3756
3857const props = withDefaults (defineProps <Props >(), {
3958 text: " " ,
4059 icon: " " ,
60+ iconPosition: " right" ,
4161 to: " " ,
4262 click: undefined ,
4363 design: " normal" ,
4464 color: " primary" ,
4565 copy: false ,
4666 type: " button" ,
67+ info: false ,
68+ infoTooltip: " " ,
4769});
4870
4971/** element ref */
@@ -84,7 +106,6 @@ defineExpose({ button });
84106 & .primary {
85107 background : $theme-light ;
86108 }
87-
88109 & .secondary {
89110 background : $light-gray ;
90111 }
@@ -106,6 +127,12 @@ defineExpose({ button });
106127 width : fit-content ;
107128 }
108129
130+ & .big {
131+ min-width : min (300px , 100% - 40px );
132+ padding : 0px 30px ;
133+ font-size : 1.75rem ;
134+ }
135+
109136 & .circle {
110137 border-radius : 999px ;
111138 color : $off-black ;
@@ -115,7 +142,6 @@ defineExpose({ button });
115142 min-height : 2em ;
116143 padding : 0.25em 0.75em ;
117144 }
118-
119145 & :not (.text ) {
120146 width : 2.5em ;
121147 height : 2.5em ;
@@ -124,7 +150,6 @@ defineExpose({ button });
124150 & .primary {
125151 background : $theme-light ;
126152 }
127-
128153 & .secondary {
129154 background : $light-gray ;
130155 }
@@ -143,11 +168,9 @@ defineExpose({ button });
143168 & .primary {
144169 color : $theme ;
145170 }
146-
147171 & .secondary {
148172 color : $off-black ;
149173 }
150-
151174 & :hover ,
152175 & :focus {
153176 color : $black ;
@@ -166,7 +189,6 @@ defineExpose({ button });
166189 & .primary {
167190 background : $theme-light ;
168191 }
169-
170192 & .secondary {
171193 background : $light-gray ;
172194 }
@@ -177,13 +199,61 @@ defineExpose({ button });
177199 box-shadow : $outline ;
178200 }
179201 }
202+
203+ /* link-style button*/
204+ & .link {
205+ min-height : unset ;
206+ padding : 0 ;
207+ gap : 6px ;
208+ background : transparent ;
209+ color : $theme ;
210+ text-decoration : none ;
211+
212+ & :hover .truncate ,
213+ & :focus .truncate {
214+ text-decoration : underline ;
215+ text-decoration-thickness : 2px ;
216+ text-underline-offset : 3px ;
217+ }
218+
219+ .truncate {
220+ text-decoration : underline ;
221+ text-decoration-thickness : 1px ;
222+ text-underline-offset : 3px ;
223+ }
224+
225+ & :focus {
226+ border-radius : 6px ;
227+ outline : none ;
228+ box-shadow : 0 0 0 3px rgba ($theme , 0.25 );
229+ }
230+ }
180231}
181- </style >
182232
183- <style lang="scss">
184233.fill {
185234 .button.circle.primary {
186235 background : $theme-mid ;
187236 }
188237}
238+
239+ .icon {
240+ margin-left : 0.5em ;
241+ }
242+
243+ /* When icon is on the LEFT, remove the left margin and add a right one */
244+ .button.link .icon ,
245+ .button.normal .icon ,
246+ .button.small .icon ,
247+ .button.tile .icon ,
248+ .button.big .icon {
249+ margin-left : 0.5em ;
250+ }
251+ .button.link.icon-left .icon {
252+ margin-right : 0.25em ;
253+ margin-left : 0 ;
254+ }
255+
256+ .info-icon {
257+ margin-left : 0.5em ;
258+ }
189259 </style >
0 commit comments