Skip to content

Commit 67ef312

Browse files
mfranzkenmergetannsch
authored
refactor: guidelines 3.0 button style (#107)
* chore: label correction * refactor: primary becomes secondary inverted * refactor: tertiary plain becomes ghost * refactor: secondary solid becomes tertiary * refactor: secondary outline becomes secondary * refactor: brand primary becomes the regular primary button * refactor: corrected the order * refactor: the button are all supposed to be styled in bold font-weight * chore: we've removed this in total mainly because of unsatisfying browser support * refactor: enabling dark backgrounds for the styleguide * chore: adding missing default additions for others to be able to overwrite these values * chore: adapted the correct styles * refactor: adapted styles * refactor: adapted the disabled state * refactor: removed those obsolete variants * refactor: renaming regular size to medium * refactor: added xsmall size and other size related aspects out of the new stylings * docs: reordered * docs: reordered * refactor: added button width * docs: added missing SCSS placeholders * refactor: checked all of the hover and active background-colors again * refactor: background-color should change on hover hover with a transition * feat: added new sizes and let smallest buttons include 16px icon sizes * refactor: using DB UI Base variable * refactor: transition declaration * chore: slightly increased the paragraphs width to ensure the effect that we want to show * refactor: added those dirty hacks for the small icon sizes * refactor: simplified the testcases * feat: added loading state * Update button.scss * chore: stylelint feedback * refactor: removed plugin-node-wrappable plugin again in favour of defining the classes directly * refactor: not using sg-wrapper anymore that was introduced by plugin-node-wrappable plugin usage * chore: removed the (now) obsolete sizes * fix: removed that redundant (and incorrect) declaration * chore: prevent HTML errors * chore: adapted the necessary changes after DB UI Base update * chore: added a variation for the id value * Refactor dbux 3 button new (#155) * refactor: button with new db-ui-base Co-authored-by: Anna Schoderer <[email protected]> Co-authored-by: Maximilian Franzke <[email protected]> Co-authored-by: Maximilian Franzke <[email protected]> * Update _buttons.md * refactor: removed obsolete variables * refactor: removed obsolete file * Update migrationGuide.adoc * Update migrationGuide.adoc Co-authored-by: Nicolas Merget <[email protected]> Co-authored-by: Anna Schoderer <[email protected]>
1 parent 7aa3ac7 commit 67ef312

27 files changed

+245
-270
lines changed

docs/migrationGuide.adoc

+12-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,18 @@ We've removed the following files, that we already deprecated within the previou
1515
- `@db-ui/core/sources/css/enterprise/db-ui-core-rollup.scss`
1616
- `@db-ui/core/sources/css/enterprise/db-ui-core-webpack.scss`
1717

18-
=== progress
18+
=== `button`
19+
20+
- The `large` size has been removed; it became obsolete mainly due to our `tonality` introduction
21+
- And renamed `regular` size to `medium`
22+
- Made some changes regarding the variants:
23+
- `Brand primary` becomes the regular `Primary` button
24+
- `Primary` becomes `Secondary Inverted`
25+
- `Secondary Outline` becomes `Secondary`
26+
- `Secondary Solid` becomes `Tertiary`
27+
- `Tertiary Plain` becomes `Ghost`
28+
29+
=== `progress`
1930

2031
We've remove the deprecated previous HTML implementation of the label by an `output` element and replaced it by an actual `label` element. Necessary changes:
2132

Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
@use "@db-ui/base/build/scss/variables" as *;
2+
13
body.styleguide {
24
display: initial;
35
}
6+
7+
.sg-wrapper-dark-background {
8+
background-color: $db-colors-secondary-enabled;
9+
10+
margin: -1rem -0.5rem;
11+
padding: 1rem 0.5rem;
12+
}

source/_patterns/01-elements/buttons/01-button-brand-primary.hbs

-17
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1+
{{!-- TODO: let's not use those modifier classes, but inherit their meaning via CSS correctly and introduce sample classes for the styleguide --}}
12
<p>
2-
{{> elements-button variant='primary' value='Primary' icon='add' }}
3-
{{> elements-button variant='primary' value='Primary (disabled)' disabled='true' icon='add' }}
3+
{{> elements-button variant='primary' value='Primary' }}
4+
{{> elements-button variant='primary' value='Primary (disabled)' disabled='true' }}
45
</p>
56
<p>
6-
{{> elements-button variant='primary' value='Primary with icon' icon-after='add'}}
7-
{{> elements-button variant='primary' value='Primary with icon (disabled)' disabled='true' icon-after='add' }}
8-
</p>
9-
<p>
10-
{{> elements-button variant='primary' value='Primary without icon' }}
11-
{{> elements-button variant='primary' value='Primary without icon (disabled)' disabled='true' }}
7+
{{> elements-button variant='primary' value='Primary' icon='add'}}
8+
{{> elements-button variant='primary' value='Primary' disabled='true' icon='add' }}
129
</p>
1310
<p>
1411
{{> elements-button variant='primary' title='Check' value='Primary displaying only the icon' icon='done' styleModifier='is-icon-text-replace' }}
1512
{{> elements-button variant='primary' title='Check' value='Primary displaying only the icon' disabled='true' icon='done' styleModifier='is-icon-text-replace' }}
1613
</p>
14+
<p>
15+
{{> elements-button variant='primary' title='Check' value='loading' state='loading' }}
16+
</p>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<p>
2+
{{> elements-button variant='secondary' value='Secondary' }}
3+
{{> elements-button variant='secondary' value='Secondary (disabled)' disabled='true' }}
4+
</p>
5+
<p>
6+
{{> elements-button variant='secondary' value='Secondary' icon='add' }}
7+
{{> elements-button variant='secondary' value='Secondary (disabled)' disabled='true' icon='add' }}
8+
</p>
9+
<p>
10+
{{> elements-button variant='secondary' title='Check' value='Secondary displaying only the icon' icon='done' styleModifier='is-icon-text-replace' }}
11+
{{> elements-button variant='secondary' title='Check' value='Secondary displaying only the icon' disabled='true' icon='done' styleModifier='is-icon-text-replace' }}
12+
</p>
13+
<p>
14+
{{> elements-button variant='secondary' title='Check' value='loading' state='loading' }}
15+
</p>
16+
17+
18+
<p class="db-bg-success-light-ia">
19+
{{> elements-button variant='secondary' value='Secondary' }}
20+
{{> elements-button variant='secondary' value='Secondary (disabled)' disabled='true' }}
21+
</p>

source/_patterns/01-elements/buttons/04-button-secondary-outline.hbs

-16
This file was deleted.

source/_patterns/01-elements/buttons/05-button-secondary-solid.hbs

-16
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<p>
2+
{{> elements-button variant='tertiary' value='Tertiary' }}
3+
{{> elements-button variant='tertiary' value='Tertiary (disabled)' disabled='true' }}
4+
</p>
5+
<p>
6+
{{> elements-button variant='tertiary' value='Tertiary' icon='add' }}
7+
{{> elements-button variant='tertiary' value='Tertiary (disabled)' disabled='true' icon='add' }}
8+
</p>
9+
<p>
10+
{{> elements-button variant='tertiary' title='Check' value='Tertiary displaying only the icon' icon='done' styleModifier='is-icon-text-replace' }}
11+
{{> elements-button variant='tertiary' title='Check' value='Tertiary displaying only the icon' disabled='true' icon='done' styleModifier='is-icon-text-replace' }}
12+
</p>
13+
<p>
14+
{{> elements-button variant='tertiary' title='Check' value='loading' state='loading' }}
15+
</p>
16+
17+
<p class="db-bg-success-light-ia">
18+
{{> elements-button variant='tertiary' value='Tertiary' }}
19+
{{> elements-button variant='tertiary' value='Tertiary (disabled)' disabled='true' }}
20+
</p>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<p>
2+
{{> elements-button variant='ghost' value='Ghost' }}
3+
{{> elements-button variant='ghost' value='Ghost (disabled)' disabled='true' }}
4+
</p>
5+
<p>
6+
{{> elements-button variant='ghost' value='Ghost' }}
7+
{{> elements-button variant='ghost' value='Ghost' disabled='true' }}
8+
</p>
9+
<p>
10+
{{> elements-button variant='ghost' title='Check' value='Ghost displaying only the icon' icon='done' styleModifier='is-icon-text-replace' }}
11+
{{> elements-button variant='ghost' title='Check' value='Ghost displaying only the icon' disabled='true' icon='done' styleModifier='is-icon-text-replace' }}
12+
</p>
13+
<p>
14+
{{> elements-button variant='ghost' title='Check' value='loading' state='loading' }}
15+
</p>
16+
17+
<p class="db-bg-success-light-ia">
18+
{{> elements-button variant='ghost' value='Ghost' }}
19+
{{> elements-button variant='ghost' value='Ghost (disabled)' disabled='true' }}
20+
</p>

source/_patterns/01-elements/buttons/06-button-tertiary-plain.hbs

-16
This file was deleted.

source/_patterns/01-elements/buttons/09-button-sizes.hbs

+6-10
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,15 @@
22
<!-- [html-validate-disable-next heading-level] -->
33
<h2>{{ label }}</h2>
44
<p>
5-
{{> elements-button variant='brand-primary' value='Brand Primary' icon='add' size=size }}
6-
{{> elements-button variant='brand-primary' value='Brand Primary (disabled)' disabled='true' icon='add' size=size }}
5+
{{> elements-button variant='primary' value='Primary' size=size }}
6+
{{> elements-button variant='primary' value='Primary (disabled)' disabled='true' size=size }}
77
</p>
88
<p>
9-
{{> elements-button variant='brand-primary' value='Brand Primary with right icon' icon-after='add' size=size }}
10-
{{> elements-button variant='brand-primary' value='Brand Primary with right icon(disabled)' disabled='true' icon-after='add' size=size }}
9+
{{> elements-button variant='primary' value='Primary' icon='add' size=size }}
10+
{{> elements-button variant='primary' value='Primary (disabled)' disabled='true' icon='add' size=size }}
1111
</p>
1212
<p>
13-
{{> elements-button variant='brand-primary' value='Brand Primary without icon' size=size }}
14-
{{> elements-button variant='brand-primary' value='Brand Primary without icon (disabled)' disabled='true' size=size }}
15-
</p>
16-
<p>
17-
{{> elements-button variant='brand-primary' title='Done' value='Brand Primary displaying only the icon' icon='done' styleModifier='is-icon-text-replace' size=size }}
18-
{{> elements-button variant='brand-primary' title='Done' value='Brand Primary displaying only the icon' disabled='true' icon='done' styleModifier='is-icon-text-replace' size=size }}
13+
{{> elements-button variant='primary' title='Done' value='Primary displaying only the icon' icon='done' styleModifier='is-icon-text-replace' size=size }}
14+
{{> elements-button variant='primary' title='Done' value='Primary displaying only the icon' disabled='true' icon='done' styleModifier='is-icon-text-replace' size=size }}
1915
</p>
2016
{{/each }}

source/_patterns/01-elements/buttons/09-button-sizes.json

+2-6
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,8 @@
55
"label": "Small"
66
},
77
{
8-
"size": "regular",
9-
"label": "Regular (default, data-size attribute is optional)"
10-
},
11-
{
12-
"size": "large",
13-
"label": "Large"
8+
"size": "medium",
9+
"label": "Medium (default, data-size attribute is optional)"
1410
}
1511
]
1612
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{{#each width }}
2+
<!-- [html-validate-disable-next heading-level] -->
3+
<h2>{{ label }}</h2>
4+
<p>
5+
{{> elements-button variant='primary' value='Primary' width=width }}
6+
</p>
7+
<p>
8+
{{> elements-button variant='primary' value='Primary' icon='add' width=width }}
9+
</p>
10+
<p>
11+
{{> elements-button variant='primary' title='Done' value='Primary displaying only the icon' icon='done' styleModifier='is-icon-text-replace' width=width }}
12+
</p>
13+
{{/each }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"width": [
3+
{
4+
"width": "full",
5+
"label": "FullWidth"
6+
}
7+
]
8+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
title: Button width
3+
---
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/* stylelint-disable selector-max-id */
2+
#elements-button-width {
3+
.pl-js-pattern-example {
4+
p {
5+
/* stylelint-enable selector-max-id */
6+
width: 300px;
7+
}
8+
}
9+
}

source/_patterns/01-elements/buttons/_button.variables.scss

-35
This file was deleted.

source/_patterns/01-elements/buttons/_buttons.md

+13-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ state: complete
99

1010
#### SCSS (recommended)
1111

12-
Extend one of the variant placeholders: `%variant-primary`, `%variant-secondary` or `%variant-tertiary`
12+
Extend one of the variant placeholders: `%variant-primary`, `%variant-secondary`, `%variant-tertiary` or `%variant-ghost`
1313

1414
#### HTML attribute
1515

@@ -19,11 +19,21 @@ You could set the different button variants via the `data-variant` attribute.
1919

2020
#### SCSS (recommended)
2121

22-
Extend one of the size SCSS placeholders in case that you don't want the default (regular): `%size-Small` or `%size-Large`
22+
Extend the size SCSS placeholder in case that you don't want the default (medium): `%size-Small`
2323

2424
#### HTML attribute
2525

26-
You could set the different button sizes via the `data-size` attribute, the default is "regular" and in that case is optional.
26+
You could set the different button sizes via the `data-size` attribute, the default is "medium" and in that case is optional.
27+
28+
### Width
29+
30+
#### SCSS (recommended)
31+
32+
Extend the width placeholders in case that you don't want the default (content-length sized): `%width-full`
33+
34+
#### HTML attribute
35+
36+
You could differentiate the button width via the `data-width` attribute, choose value "full" for a button taking the whole containers width; the default is "auto" and in that case is optional.
2737

2838
## Usability
2939

Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
<button class="elm-button {{ styleModifier }}"
22
{{#if variant }}data-variant="{{ variant }}"{{/if }}
33
{{#if size }} data-size="{{ size }}"{{/if }}
4+
{{#if width }} data-width="{{ width }}"{{/if }}
45
title="{{ title }}"
56
type="{{#if buttontype }}{{ buttontype }}{{else}}button{{/if }}"
67
{{#if role }} role="{{ role }}"{{/if }}
78
{{#if disabled }} disabled{{/if }}
89
{{#if icon}} data-icon="{{ icon }}"{{/if}}
9-
{{#if icon-after}} data-icon-after="{{ icon-after }}"{{/if}}>
10+
{{#if icon-after}} data-icon-after="{{ icon-after }}"{{/if}}
11+
{{#if state}} data-state="{{ state }}"{{/if}}>
1012
{{{ value }}}
13+
{{#if_eq state "loading" }}{{> elements-loading-indicator size="xs" id=variant }}{{/if_eq }}
1114
</button>
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"variant": "brand-primary",
2+
"variant": "primary",
33
"title": "Done",
4-
"value": "Red 500"
4+
"value": "Button"
55
}

0 commit comments

Comments
 (0)