Ghost-Admin/app/styles/patterns/buttons.css

433 lines
9.4 KiB
CSS

/* Buttons
/* ---------------------------------------------------------- */
/* Base button style */
/* Should only be applied to <a> tags */
.gh-btn {
display: inline-block;
outline: none;
background: var(--white);
box-shadow: 0 2px 5px -3px rgba(0,0,0,.12);
color: color-mod(var(--midgrey) l(-7%));
text-decoration: none !important;
user-select: none;
fill: color-mod(var(--midgrey) l(-7%));
border: 1px solid color-mod(var(--midgrey) l(+35%) s(+10%));
border-radius: 5px;
transition: all 0.2s ease;
transition-property: color, border-color, background, width, height, box-shadow;
-webkit-font-smoothing: subpixel-antialiased;
}
/* ALL buttons must have a span for content */
.gh-btn span {
display: block;
overflow: hidden;
padding: 0 11px;
height: 33px;
font-size: 1.3rem;
line-height: 33px;
font-weight: 400;
text-align: center;
letter-spacing: 0.2px;
border-radius: 4px;
white-space: nowrap;
text-overflow: ellipsis;
}
.gh-btn:hover {
color: var(--darkgrey);
box-shadow: 0 3px 4px -3px rgba(0,0,0,.13);
border-color: color-mod(var(--midgrey) l(+25%) s(+10%));
}
/* When disabled */
.gh-btn.disabled,
.gh-btn[disabled],
fieldset[disabled] .gh-btn {
box-shadow: none;
opacity: 0.8;
cursor: not-allowed;
pointer-events: none;
}
.gh-btn svg {
display: inline-block;
}
/* Button highlights
/* ---------------------------------------------------------- */
.gh-btn-hover-blue:hover {
color: var(--blue);
border-color: var(--blue);
}
.gh-btn-hover-green:hover {
color: var(--green);
border-color: var(--green);
}
.gh-btn-hover-red:hover {
color: var(--red);
border-color: var(--red);
}
/* Grey button - First so that other colors will override
/* ---------------------------------------------------------- */
/* The background of the button creates 1px gradient border */
.gh-btn-grey {
padding: 1px;
border: 0;
fill: var(--darkgrey);
transition: none !important;
}
/* The background of the span is the main visual element */
.gh-btn-grey span {
background: color-mod(var(--lightgrey) l(-5%));
}
/* When clicked or focused with keyboard */
.gh-btn-grey:active,
.gh-btn-grey:focus {
background: color-mod(var(--midgrey) l(+25%));
}
.gh-btn-grey:active span,
.gh-btn-grey:focus span {
background: color-mod(var(--lightgrey) l(+15%));
box-shadow: none;
}
/* Blue button
/* ---------------------------------------------------------- */
/* The background of the button creates 1px gradient border */
.gh-btn-blue,
.gh-btn-blue:hover {
border: 1px solid color-mod(var(--blue) s(-5%));
color: #fff;
fill: #fff;
box-shadow: none;
transition-property: box-shadow;
}
.gh-btn-blue:hover {
box-shadow: none;
}
/* The background of the span is the main visual element */
.gh-btn-blue span {
background: linear-gradient(color-mod(var(--blue) l(+6%) s(-1%)), color-mod(var(--blue) l(-6%) saturation(-8%)));
font-weight: 500;
}
.gh-btn-blue:hover span {
background: linear-gradient(color-mod(var(--blue) l(+9%) s(-1%)), color-mod(var(--blue) l(-3%) saturation(-3%)));
}
/* When clicked or focused with keyboard */
.gh-btn-blue:active,
.gh-btn-blue:focus {
background: color-mod(var(--blue) l(-20%) saturation(-15%));
}
.gh-btn-blue:active span,
.gh-btn-blue:focus span {
background: color-mod(var(--blue) l(-7%) saturation(-10%));
box-shadow: none;
}
/* Green button
/* ---------------------------------------------------------- */
/* The background of the button creates 1px gradient border */
.gh-btn-green,
.gh-btn-green:hover {
border: 1px solid color-mod(var(--green) s(-5%));
color: #fff;
fill: #fff;
box-shadow: none;
transition-property: box-shadow;
}
.gh-btn-green:hover {
box-shadow: none;
}
/* The background of the span is the main visual element */
.gh-btn-green span {
background: linear-gradient(color-mod(var(--green) l(+6%) s(-2%)), color-mod(var(--green) l(-8%) s(+5%)));
font-weight: 500;
}
.gh-btn-green:hover span {
background: linear-gradient(color-mod(var(--green) l(+9%) s(-1%)), color-mod(var(--green) l(-3%) saturation(-3%)));
}
/* When clicked or focused with keyboard */
.gh-btn-green:active,
.gh-btn-green:focus {
background: color-mod(var(--green) l(-9%) saturation(-9%));
}
.gh-btn-green:active span,
.gh-btn-green:focus span {
background: color-mod(var(--green) l(-3%) saturation(-7%));
box-shadow: none;
}
/* Red button
/* ---------------------------------------------------------- */
/* The background of the button creates 1px gradient border */
.gh-btn-red,
.gh-btn-red:hover {
border: 1px solid color-mod(var(--red) s(-5%));
color: #fff;
fill: #fff;
box-shadow: none;
transition-property: box-shadow;
}
.gh-btn-red:hover {
box-shadow: none;
}
/* The background of the span is the main visual element */
.gh-btn-red span {
background: linear-gradient(
color-mod(var(--red) whiteness(+7%)),
color-mod(var(--red) l(-7%) saturation(-10%)) 60%,
color-mod(var(--red) l(-7%) saturation(-10%)) 90%,
color-mod(var(--red) l(-4%) saturation(-10%))
);
font-weight: 500;
}
.gh-btn-red:hover span {
background: linear-gradient(color-mod(var(--red) l(+7%) s(-1%)), color-mod(var(--red) l(-5%) saturation(-3%)));
}
/* When clicked or focused with keyboard */
.gh-btn-red:active,
.gh-btn-red:focus {
background: color-mod(var(--red) l(-20%) saturation(-15%));
}
.gh-btn-red:active span,
.gh-btn-red:focus span {
background: color-mod(var(--red) l(-7%) saturation(-10%));
box-shadow: none;
}
/* Black button
/* ---------------------------------------------------------- */
/* The background of the button creates 1px gradient border */
.gh-btn-black,
.gh-btn-black:hover {
border: 0;
color: #fff;
fill: #fff;
box-shadow: none;
transition-property: box-shadow;
}
.gh-btn-black:hover {
box-shadow: 0 4px 5px -3px rgba(0,0,0,.1);
}
/* The background of the span is the main visual element */
.gh-btn-black span {
background: linear-gradient(
color-mod(var(--darkgrey) whiteness(+7%)),
color-mod(var(--darkgrey) l(-7%) saturation(-10%)) 60%,
color-mod(var(--darkgrey) l(-7%) saturation(-10%)) 90%,
color-mod(var(--darkgrey) l(-4%) saturation(-10%))
);
font-weight: 500;
height: 35px;
line-height: 35px;
}
/* When clicked or focused with keyboard */
.gh-btn-black:active,
.gh-btn-black:focus {
background: color-mod(var(--darkgrey) l(-20%) saturation(-15%));
}
.gh-btn-black:active span,
.gh-btn-black:focus span {
background: color-mod(var(--darkgrey) l(-7%) saturation(-10%));
box-shadow: none;
}
/* Special Buttons
/* ---------------------------------------------------------- */
.gh-btn-white {
border: none;
background: var(--white);
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.01), 0 1px 2px rgba(0, 0, 0, 0.05);
outline: none;
}
.gh-btn-white:hover {
background: var(--white);
}
.gh-btn-white span {
height: 35px;
line-height: 35px;
}
.gh-btn-strong {
border-color: color-mod(var(--midgrey) l(+25%));
}
.gh-btn-block {
display: block;
width: 100%;
}
.gh-btn-icon span {
display: flex;
align-items: center;
justify-content: center;
}
.gh-btn-icon svg,
.gh-btn-block svg {
width: 1em;
height: 1em;
margin-right: 0.5em;
fill: #fff;
}
.gh-btn-icon svg.gh-spinner {
left: 5px;
}
.gh-btn-icon svg.gh-spinner rect {
fill: color-mod(var(--midgrey) l(+15%));
}
.gh-btn-icon-right svg,
svg.gh-btn-icon-right {
margin-left: 0.5em;
margin-right: 0;
}
.gh-btn-icon svg path {
stroke: #fff;
}
.gh-btn-icon-no-margin {
margin: 0;
}
/*
/* Button Variations
/* ---------------------------------------------------------- */
.gh-btn-block {
display: block;
width: 100%;
}
/* Vertically space out multiple block buttons */
.gh-btn-block + .gh-btn-block {
margin-top: 5px;
}
/* Specificity overrides */
input[type="submit"].gh-btn-block,
input[type="reset"].gh-btn-block,
input[type="button"].gh-btn-block {
width: 100%;
}
/*
/* Button Groups
/* ---------------------------------------------------------- */
/*
Usage: CTA buttons grouped together horizontally.
<div class="gh-btn-group">
<a class="gh-btn gh-btn-green" href="#"><span>Button 1</span></a>
<a class="gh-btn gh-btn-white" href="#"><span>Button 2</span></a>
</div>
*/
.gh-btn-group .gh-btn {
margin-left: 15px;
}
.gh-btn-group .gh-btn {
margin: 0;
border-radius: 0 0 0 0;
border: none;
border-left: 1px solid var(--whitegrey);
}
.gh-btn-group .gh-btn:first-of-type {
border-radius: 5px 0 0 5px;
border: none;
}
.gh-btn-group .gh-btn:last-of-type {
border-radius: 0 5px 5px 0;
}
.gh-btn-group .gh-btn-group-selected span {
color: var(--blue);
font-weight: 500;
}
.gh-btn-block + .gh-btn-block {
margin-top: 5px;
}
.gh-btn-link {
border: none;
background: none;
box-shadow: none;
}
.gh-btn-link:hover {
background: none;
box-shadow: none;
}
/* Spin Buttons!
/* ---------------------------------------------------------- */
.spinner {
position: relative;
display: inline-block;
box-sizing: border-box;
margin: -2px 0;
width: 14px;
height: 14px;
border: rgba(0,0,0,0.2) solid 4px;
border-radius: 100px;
animation: spin 1s linear infinite;
}
.spinner:before {
content: "";
display: block;
margin-top: 6px;
width: 4px;
height: 4px;
background: rgba(0,0,0,0.6);
border-radius: 100px;
}