@@ -3,10 +3,6 @@ import '@umbraco-ui/uui-badge/lib';
3
3
import '@umbraco-ui/uui-icon/lib' ;
4
4
5
5
import { Story } from '@storybook/web-components' ;
6
- import {
7
- InterfaceLookNames ,
8
- InterfaceLookType ,
9
- } from '@umbraco-ui/uui-base/lib/types' ;
10
6
import { html } from 'lit-html' ;
11
7
12
8
export default {
@@ -15,24 +11,24 @@ export default {
15
11
id : 'uui-button' ,
16
12
17
13
args : {
18
- look : '' ,
14
+ look : 'default' ,
15
+ color : 'primary' ,
19
16
type : '' ,
20
17
label : 'Button' ,
21
18
state : '' ,
22
19
} ,
23
20
argTypes : {
24
21
look : {
25
- options : [
26
- '' ,
27
- 'primary' ,
28
- 'secondary' ,
29
- 'outline' ,
30
- 'placeholder' ,
31
- 'positive' ,
32
- 'warning' ,
33
- 'danger' ,
34
- ] ,
35
- control : { type : 'select' } ,
22
+ control : {
23
+ type : 'select' ,
24
+ } ,
25
+ options : [ 'default' , 'primary' , 'secondary' , 'outline' , 'placeholder' ] ,
26
+ } ,
27
+ color : {
28
+ control : {
29
+ type : 'select' ,
30
+ } ,
31
+ options : [ 'primary' , 'positive' , 'warning' , 'danger' ] ,
36
32
} ,
37
33
type : {
38
34
options : [ '' , 'submit' , 'button' , 'reset' ] ,
@@ -77,6 +73,9 @@ const cssProps = [
77
73
const reducer = ( prev : string , next : string , i : number ) =>
78
74
( prev = next ? `${ prev } ${ i === 1 ? ';' : '' } ${ next } ;` : prev ) ;
79
75
76
+ const looks = [ 'default' , 'primary' , 'secondary' , 'outline' , 'placeholder' ] ;
77
+ const colors = [ 'primary' , 'positive' , 'warning' , 'danger' ] ;
78
+
80
79
const Template : Story = props => {
81
80
return html `
82
81
< uui-button
@@ -87,6 +86,7 @@ const Template: Story = props => {
87
86
?disabled=${ props . disabled }
88
87
?compact=${ props . compact }
89
88
look=${ props . look }
89
+ color=${ props . color }
90
90
label=${ props . label }
91
91
state=${ props . state }
92
92
> ${ props . content } </ uui-button
@@ -106,7 +106,7 @@ AAAOverview.parameters = {
106
106
} ;
107
107
108
108
export const Disabled = Template . bind ( { } ) ;
109
- Disabled . args = { label : 'Disabled' , disabled : true } ;
109
+ Disabled . args = { label : 'Disabled' , disabled : true , look : 'primary' } ;
110
110
Disabled . parameters = {
111
111
docs : {
112
112
source : {
@@ -125,9 +125,10 @@ export const WithBadge: Story = props => {
125
125
?disabled=${ props . disabled }
126
126
?compact=${ props . compact }
127
127
look=${ props . look }
128
+ color=${ props . color }
128
129
label=${ props . label }
129
130
state=${ props . state } >
130
- < uui-badge > !</ uui-badge >
131
+ < uui-badge color =" danger " > !</ uui-badge >
131
132
I have a badge
132
133
</ uui-button >
133
134
` ;
@@ -167,6 +168,7 @@ export const Sizing: Story = props => {
167
168
style ="font-size: 9px; "
168
169
type =${ props . type }
169
170
look =${ props . look }
171
+ color=${ props . color }
170
172
state=${ props . state }
171
173
?disabled=${ props . disabled }
172
174
?compact=${ props . compact }
@@ -175,6 +177,7 @@ export const Sizing: Story = props => {
175
177
style ="font-size: 12px; "
176
178
type =${ props . type }
177
179
look =${ props . look }
180
+ color=${ props . color }
178
181
state=${ props . state }
179
182
?disabled=${ props . disabled }
180
183
?compact=${ props . compact }
@@ -183,6 +186,7 @@ export const Sizing: Story = props => {
183
186
style ="font-size: 15px; "
184
187
type =${ props . type }
185
188
look =${ props . look }
189
+ color=${ props . color }
186
190
state=${ props . state }
187
191
?disabled=${ props . disabled }
188
192
?compact=${ props . compact }
@@ -206,33 +210,42 @@ function uppercaseFirstLetter(s: string) {
206
210
return s . charAt ( 0 ) . toUpperCase ( ) + s . slice ( 1 ) ;
207
211
}
208
212
209
- export const Looks : Story = props => html `
210
- < h5 > Default look</ h5 >
213
+ export const LooksAndColors : Story = props => html `
214
+ < h4 > Default look</ h4 >
211
215
< uui-button
212
216
type =${ props . type }
213
217
?disabled =${ props . disabled }
214
218
?compact=${ props . compact }
215
219
look=${ props . look }
220
+ color=${ props . color }
216
221
label=${ props . label }
217
222
> ${ props . content } </ uui-button
218
223
>
219
- < h5 > Looks</ h5 >
220
- ${ InterfaceLookNames . map (
221
- ( lookName : InterfaceLookType ) =>
222
- html `< uui-button
223
- type =${ props . type }
224
- .look =${ lookName }
225
- label="Button displaying the ${ uppercaseFirstLetter ( lookName ) } look"
226
- state=${ props . state }
227
- ?disabled=${ props . disabled }
228
- ?compact=${ props . compact }
229
- style="margin-right:12px;">
230
- ${ uppercaseFirstLetter ( lookName ) } look
231
- </ uui-button > `
224
+ < h4 > Looks and colors</ h4 >
225
+ ${ colors . map (
226
+ color =>
227
+ html `
228
+ < h5 > ${ uppercaseFirstLetter ( color ) } </ h5 >
229
+ < div style ="margin-bottom: 32px ">
230
+ ${ looks . map (
231
+ look => html ` < uui-button
232
+ type =${ props . type }
233
+ .look =${ look }
234
+ .color=${ color }
235
+ label="Button displaying the ${ uppercaseFirstLetter ( look ) } look"
236
+ state=${ props . state }
237
+ ?disabled=${ props . disabled }
238
+ ?compact=${ props . compact }
239
+ style="margin-right:12px;"
240
+ > ${ uppercaseFirstLetter ( look ) } </ uui-button
241
+ > `
242
+ ) }
243
+ </ div >
244
+ `
232
245
) }
233
246
` ;
234
- Looks . args = { label : 'Button' } ;
235
- Looks . parameters = {
247
+ LooksAndColors . args = { label : 'Button' , look : 'default' , color : 'primary ' } ;
248
+ LooksAndColors . parameters = {
236
249
docs : {
237
250
source : {
238
251
code : `
@@ -243,12 +256,12 @@ Looks.parameters = {
243
256
244
257
export const WithIcon = ( ) => html `
245
258
< uui-icon-registry-essential >
246
- < uui-button look ="danger " label ="A11Y proper label ">
259
+ < uui-button look ="primary " color =" danger " label ="A11Y proper label ">
247
260
< uui-icon .name =${ 'favorite' } > </ uui-icon >
248
261
</ uui-button >
249
262
< br />
250
263
< br />
251
- < uui-button look ="danger " label ="A11Y proper label ">
264
+ < uui-button look ="primary " color =" danger " label ="A11Y proper label ">
252
265
< uui-icon .name =${ 'favorite' } > </ uui-icon > Button with icon
253
266
</ uui-button >
254
267
< br />
@@ -257,7 +270,11 @@ export const WithIcon = () => html`
257
270
The default sizing for a button with only an icon is generally too wide,
258
271
there please use with the 'compact' attribute.
259
272
</ p >
260
- < uui-button look ="positive " compact label ="A11Y proper label ">
273
+ < uui-button
274
+ look ="primary "
275
+ color ="positive "
276
+ compact
277
+ label ="A11Y proper label ">
261
278
< uui-icon name ="favorite "> </ uui-icon >
262
279
</ uui-button >
263
280
</ uui-icon-registry-essential >
0 commit comments