pico/scss/content/_button.scss

110 lines
2.4 KiB
SCSS
Raw Normal View History

2019-11-27 15:31:49 +07:00
/**
* Button
*/
// Reboot based on :
// - normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css
// - sanitize.css v12.0.1 | CC0 1.0 Universal | github.com/csstools/sanitize.css
2019-11-27 15:31:49 +07:00
//
// 1. Change the font styles in all browsers
2019-11-27 15:31:49 +07:00
// 2. Remove the margin in Firefox and Safari
// 3. Show the overflow in Edge
button {
margin: 0; // 2
overflow: visible; // 3
font-family: inherit; // 1
text-transform: none; // 1
}
// Correct the inability to style clickable types in iOS and Safari
2019-11-27 15:31:49 +07:00
button,
[type="button"],
[type="reset"],
[type="submit"] {
-webkit-appearance: button;
}
// Remove the inner border and padding in Firefox
2019-11-27 15:31:49 +07:00
button::-moz-focus-inner,
[type="button"]::-moz-focus-inner,
[type="reset"]::-moz-focus-inner,
[type="submit"]::-moz-focus-inner {
padding: 0;
border-style: none;
}
// Pico
//
button {
display: block;
width: 100%;
2020-09-29 08:38:35 +07:00
margin-bottom: var(--spacing-typography);
2019-11-27 15:31:49 +07:00
}
a[role="button"] {
display: inline-block;
text-decoration: none;
}
button,
input[type="submit"],
input[type="button"],
2020-09-29 08:38:35 +07:00
input[type="reset"],
[type="file"]::-webkit-file-upload-button,
2019-11-27 15:31:49 +07:00
a[role="button"] {
2020-09-29 08:38:35 +07:00
padding: var(--button-spacing-vertical) var(--button-spacing-horizontal);
border: var(--button-border-width) solid var(--primary-border);
border-radius: var(--button-round);
2019-11-27 15:31:49 +07:00
outline: none;
background-color: var(--primary);
2020-09-29 08:38:35 +07:00
box-shadow: var(--button-shadow);
2019-11-27 15:31:49 +07:00
color: var(--primary-inverse);
font-size: 1rem;
2020-09-29 08:38:35 +07:00
font-weight: var(--buttons-weight);
line-height: var(--line-height);
2019-11-27 15:31:49 +07:00
text-align: center;
cursor: pointer;
@if $enable-transitions {
transition:
2020-09-29 08:38:35 +07:00
background-color var(--transition),
border-color var(--transition),
color var(--transition),
box-shadow var(--transition);
}
2019-11-27 15:31:49 +07:00
&:hover,
&:active,
&:focus {
2020-09-29 08:38:35 +07:00
border-color: var(--primary-hover-border);
2019-11-27 15:31:49 +07:00
background-color: var(--primary-hover);
2020-09-29 08:38:35 +07:00
box-shadow: var(--button-hover-shadow);
2019-11-27 15:31:49 +07:00
}
&:focus {
2020-09-29 08:38:35 +07:00
box-shadow: var(--button-hover-shadow), 0 0 0 var(--button-outline-width) var(--primary-focus);
2019-11-27 15:31:49 +07:00
}
}
// Input [type="reset"]
input[type="reset"] {
cursor: pointer;
}
// Button [disabled]
button,
input[type="submit"],
input[type="button"],
2019-11-27 15:31:49 +07:00
input[type="reset"],
a[role="button"] {
&[disabled] {
opacity: .5;
pointer-events: none;
}
}