-
Notifications
You must be signed in to change notification settings - Fork 2
Feature/stij 129: Make inline buttons the default #111
base: develop
Are you sure you want to change the base?
Changes from 2 commits
8727809
c16ce40
9712800
7c5d231
486b82f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Buttons | ||
There are 3 types of buttons defined: | ||
* Small | ||
* Medium (default) | ||
* Large | ||
|
||
By default buttons are always inline! | ||
That means when you want to create a full width button you will need to use the `btn-block` mixin we provide. | ||
|
||
We provide the some classes to add to elements that need to be styled like buttons: | ||
We also provide a SASS placeholder. | ||
|
||
## Small buttons | ||
* `%btn--small` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we implement two different button classes? This is a bit confusing. Placeholder for extends is ok. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this is meant to be backwards compatible. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Jeroen005 can you check if these button classes are still necessary? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Classy is using .button if I'm not mistaking. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah ok. If that is the case we should leave it in for now untill we have time to refactor the basetheme to strip the classy classes and add the styleguide markup |
||
* `.small.btn` | ||
* `.btn--small` | ||
|
||
## Medium buttons | ||
* `%btn--medium` | ||
* `.medium.btn` | ||
* `.btn--medium` | ||
|
||
## Large buttons | ||
* `%btn--large` | ||
* `.large.btn` | ||
* `.btn--large` | ||
|
||
Furthermore to improve semantic HTML we provide SASS mixins to create these buttons. | ||
* `@mixin btn-s;` for small buttons. | ||
* `@mixin btn-m;` for medium buttons (default). | ||
* `@mixin btn-l;` for large buttons. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,15 +21,23 @@ | |
} | ||
|
||
// | ||
// Button display | ||
// Button inline display (default). | ||
// | ||
@mixin btn-inlineblock { | ||
display: inline-block; | ||
width: auto; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Width auto should not be necessary in this context |
||
} | ||
|
||
// | ||
// General button styling. | ||
// Button block display. | ||
// | ||
@mixin btn-block { | ||
display: block; | ||
width: 100%; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. width: 100% is not necessary, since you declare your element as a block which has a default width of 100%. |
||
} | ||
|
||
// | ||
// General button styling (default). | ||
// | ||
%btn, | ||
.btn, | ||
|
@@ -43,9 +51,8 @@ input[type='submit'] { | |
@include color-element-states($button-border, $button-border-hover, $property: "border"); | ||
} | ||
@include btn-m; | ||
display: block; | ||
@include btn-inlineblock; | ||
position: relative; | ||
width: 100%; | ||
margin: 0; | ||
padding-right: 1rem; | ||
padding-left: 1rem; | ||
|
@@ -85,15 +92,32 @@ input[type='submit'] { | |
} | ||
} | ||
|
||
// | ||
// Inline button styling. | ||
// | ||
%btn--inline, | ||
.inline.btn, | ||
.btn--inline, | ||
a.btn--inline, | ||
button.btn--inline, | ||
input[type='button'].btn--inline, | ||
input[type='submit'].btn--inline { | ||
@include btn-inlineblock | ||
%btn--small, | ||
.small.btn, | ||
.btn--small, | ||
a.btn--small, | ||
button.btn--small, | ||
input[type="button"].btn--small, | ||
input[type='submit'].btn--small { | ||
@include btn-s; | ||
} | ||
|
||
%btn--medium, | ||
.medium.btn, | ||
.btn--medium, | ||
a.btn--medium, | ||
button.btn--medium, | ||
input[type='button'].btn--medium, | ||
input[type='submit'].btn--medium { | ||
@include btn-m; | ||
} | ||
|
||
%btn--large, | ||
.large.btn, | ||
.btn--large, | ||
a.btn--large, | ||
button.btn--large, | ||
input[type="button"].btn--large, | ||
input[type='submit'].btn--large { | ||
@include btn-l; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"title": "Button", | ||
"name": "Button", | ||
"status": "ready", | ||
"default": "button-sm", | ||
"order": 1, | ||
"context": { | ||
"text": "Button" | ||
}, | ||
"variants": [ | ||
{ | ||
"name": "button-sm", | ||
"handle": "button", | ||
"context": { | ||
"modifier": "btn--small" | ||
} | ||
}, | ||
{ | ||
"name": "button-md", | ||
"handle": "md", | ||
"context": { | ||
"modifier": "btn--medium" | ||
} | ||
}, | ||
{ | ||
"name": "button-lg", | ||
"handle": "button-lg", | ||
"context": { | ||
"modifier": "btn--large" | ||
} | ||
} | ||
] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<input type="button" class="btn {{ modifier }}" value="{{ text }}"> |
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,47 @@ | ||
<h1>Button styles</h1> | ||
|
||
<div class="preview-inner-container"> | ||
<h3>Small buttons</h3> | ||
{% include '@button-sm' %} | ||
<h3>Inline: Small buttons</h3> | ||
{% include '@button-sm' with { 'modifier': 'inline' } %} | ||
<h3>Small buttons (default inline button)</h3> | ||
<p> | ||
{% include '@button--button-sm' with { | ||
'modifier': 'btn--small' | ||
} | ||
%} | ||
</p> | ||
<h3>Full width : Small buttons</h3> | ||
<p class="example-full-width"> | ||
{% include '@button--button-sm' with { | ||
'modifier': 'btn--small' | ||
} | ||
%} | ||
</p> | ||
</div> | ||
|
||
<h3>Medium buttons</h3> | ||
{% include '@button-md' %} | ||
<h3>Inline: Medium buttons</h3> | ||
{% include '@button-md' with { 'modifier': 'inline' } %} | ||
<div class="preview-inner-container"> | ||
<h3>Medium buttons (default inline button)</h3> | ||
<p> | ||
{% include '@button' %} | ||
</p> | ||
<h3>Full width: Medium buttons</h3> | ||
<p class="example-full-width"> | ||
{% include '@button' %} | ||
</p> | ||
</div> | ||
|
||
<h3>Large buttons</h3> | ||
{% include '@button-lg' %} | ||
<h3>Inline: Large buttons</h3> | ||
{% include '@button-lg' with { 'modifier': 'inline' } %} | ||
<div class="preview-inner-container"> | ||
<h3>Large buttons (default inline button)</h3> | ||
<p> | ||
{% include '@button--button-lg' with { | ||
'modifier': 'btn--large' | ||
} | ||
%} | ||
</p> | ||
<h3>Full width: Large buttons</h3> | ||
<p class="example-full-width"> | ||
{% include '@button--button-lg' with { | ||
'modifier': 'btn--large' | ||
} | ||
%} | ||
</p> | ||
</div> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{% extends '_preview.twig' %} | ||
|
||
{% block title %}Buttons preview{% endblock %} | ||
|
||
{% block inline_styles %} | ||
{{ parent() }} | ||
|
||
.preview-inner-container .example-full-width .btn { | ||
width: 100%; | ||
} | ||
|
||
{% endblock %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it not be better to use the same names for placeholders and the corresponding buttons in Sass
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed this. What do you think?