Skip to content

Commit 0ad11ec

Browse files
committed
button
1 parent c4dd29e commit 0ad11ec

File tree

2 files changed

+56
-38
lines changed

2 files changed

+56
-38
lines changed

packages/uui-button/lib/uui-button.element.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ export class UUIButtonElement extends FormControlMixin(
100100
width: 100%;
101101
background-color: transparent;
102102
color: inherit;
103+
font-size: inherit;
103104
border-radius: inherit;
104105
font-family: inherit;
105106
font-weight: inherit;

packages/uui-button/lib/uui-button.story.ts

Lines changed: 55 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@ import '@umbraco-ui/uui-badge/lib';
33
import '@umbraco-ui/uui-icon/lib';
44

55
import { Story } from '@storybook/web-components';
6-
import {
7-
InterfaceLookNames,
8-
InterfaceLookType,
9-
} from '@umbraco-ui/uui-base/lib/types';
106
import { html } from 'lit-html';
117

128
export default {
@@ -15,24 +11,24 @@ export default {
1511
id: 'uui-button',
1612

1713
args: {
18-
look: '',
14+
look: 'default',
15+
color: 'primary',
1916
type: '',
2017
label: 'Button',
2118
state: '',
2219
},
2320
argTypes: {
2421
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'],
3632
},
3733
type: {
3834
options: ['', 'submit', 'button', 'reset'],
@@ -77,6 +73,9 @@ const cssProps = [
7773
const reducer = (prev: string, next: string, i: number) =>
7874
(prev = next ? `${prev}${i === 1 ? ';' : ''} ${next};` : prev);
7975

76+
const looks = ['default', 'primary', 'secondary', 'outline', 'placeholder'];
77+
const colors = ['primary', 'positive', 'warning', 'danger'];
78+
8079
const Template: Story = props => {
8180
return html`
8281
<uui-button
@@ -87,6 +86,7 @@ const Template: Story = props => {
8786
?disabled=${props.disabled}
8887
?compact=${props.compact}
8988
look=${props.look}
89+
color=${props.color}
9090
label=${props.label}
9191
state=${props.state}
9292
>${props.content}</uui-button
@@ -106,7 +106,7 @@ AAAOverview.parameters = {
106106
};
107107

108108
export const Disabled = Template.bind({});
109-
Disabled.args = { label: 'Disabled', disabled: true };
109+
Disabled.args = { label: 'Disabled', disabled: true, look: 'primary' };
110110
Disabled.parameters = {
111111
docs: {
112112
source: {
@@ -125,9 +125,10 @@ export const WithBadge: Story = props => {
125125
?disabled=${props.disabled}
126126
?compact=${props.compact}
127127
look=${props.look}
128+
color=${props.color}
128129
label=${props.label}
129130
state=${props.state}>
130-
<uui-badge>!</uui-badge>
131+
<uui-badge color="danger">!</uui-badge>
131132
I have a badge
132133
</uui-button>
133134
`;
@@ -167,6 +168,7 @@ export const Sizing: Story = props => {
167168
style="font-size: 9px;"
168169
type=${props.type}
169170
look=${props.look}
171+
color=${props.color}
170172
state=${props.state}
171173
?disabled=${props.disabled}
172174
?compact=${props.compact}
@@ -175,6 +177,7 @@ export const Sizing: Story = props => {
175177
style="font-size: 12px;"
176178
type=${props.type}
177179
look=${props.look}
180+
color=${props.color}
178181
state=${props.state}
179182
?disabled=${props.disabled}
180183
?compact=${props.compact}
@@ -183,6 +186,7 @@ export const Sizing: Story = props => {
183186
style="font-size: 15px;"
184187
type=${props.type}
185188
look=${props.look}
189+
color=${props.color}
186190
state=${props.state}
187191
?disabled=${props.disabled}
188192
?compact=${props.compact}
@@ -206,33 +210,42 @@ function uppercaseFirstLetter(s: string) {
206210
return s.charAt(0).toUpperCase() + s.slice(1);
207211
}
208212

209-
export const Looks: Story = props => html`
210-
<h5>Default look</h5>
213+
export const LooksAndColors: Story = props => html`
214+
<h4>Default look</h4>
211215
<uui-button
212216
type=${props.type}
213217
?disabled=${props.disabled}
214218
?compact=${props.compact}
215219
look=${props.look}
220+
color=${props.color}
216221
label=${props.label}
217222
>${props.content}</uui-button
218223
>
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+
`
232245
)}
233246
`;
234-
Looks.args = { label: 'Button' };
235-
Looks.parameters = {
247+
LooksAndColors.args = { label: 'Button', look: 'default', color: 'primary' };
248+
LooksAndColors.parameters = {
236249
docs: {
237250
source: {
238251
code: `
@@ -243,12 +256,12 @@ Looks.parameters = {
243256

244257
export const WithIcon = () => html`
245258
<uui-icon-registry-essential>
246-
<uui-button look="danger" label="A11Y proper label">
259+
<uui-button look="primary" color="danger" label="A11Y proper label">
247260
<uui-icon .name=${'favorite'}></uui-icon>
248261
</uui-button>
249262
<br />
250263
<br />
251-
<uui-button look="danger" label="A11Y proper label">
264+
<uui-button look="primary" color="danger" label="A11Y proper label">
252265
<uui-icon .name=${'favorite'}></uui-icon>Button with icon
253266
</uui-button>
254267
<br />
@@ -257,7 +270,11 @@ export const WithIcon = () => html`
257270
The default sizing for a button with only an icon is generally too wide,
258271
there please use with the 'compact' attribute.
259272
</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">
261278
<uui-icon name="favorite"></uui-icon>
262279
</uui-button>
263280
</uui-icon-registry-essential>

0 commit comments

Comments
 (0)