Ghost/ghost/admin/app/styles/patterns/buttons.css

476 lines
10 KiB
CSS

/* Buttons
/* ---------------------------------------------------------- */
/* Base button style */
/* Should only be applied to <a> tags */
.gh-btn {
display: inline-block;
outline: none;
border: 1px solid color(var(--lightgrey) l(-5%) s(-10%));
color: color(var(--lightgrey) l(-27%) blackness(+15%));
text-shadow: 0 1px 0 #fff;
text-decoration: none !important;
user-select: none;
fill: color(var(--lightgrey) l(-27%) blackness(+15%));
stroke: color(var(--lightgrey) l(-27%) blackness(+15%));
border-radius: 5px;
transition: all 0.2s ease;
-webkit-font-smoothing: subpixel-antialiased;
}
/* ALL buttons must have a span for content */
.gh-btn span {
display: block;
overflow: hidden;
padding: 0 12px;
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 {
border-color: color(var(--lightgrey) l(-15%) 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 {
border-color: var(--blue);
color: var(--blue);
}
.gh-btn-hover-green:hover {
border-color: var(--green);
color: var(--green);
}
.gh-btn-hover-red:hover {
border-color: var(--red);
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;
color: color(var(--darkgrey) l(+15%));
text-shadow: 0 1px 0 #fff;
fill: var(--darkgrey);
stroke: var(--darkgrey);
background: linear-gradient(
color(var(--lightgrey) l(-3%)),
color(var(--lightgrey) l(-8%))
);
box-shadow: 0 1px 0 rgba(0,0,0,0.05);
transition: none !important;
}
/* The background of the span is the main visual element */
.gh-btn-grey span {
background: linear-gradient(
color(var(--lightgrey) l(+10%)),
color(var(--lightgrey) l(+4%))
);
box-shadow: 0 1px 0 #fff inset;
}
/* When clicked or focused with keyboard */
.gh-btn-grey:active,
.gh-btn-grey:focus {
background: color(var(--midgrey) l(+25%));
}
.gh-btn-grey:active span,
.gh-btn-grey:focus span {
background: color(var(--lightgrey) l(+15%));
box-shadow: none;
}
/* Blue button
/* ---------------------------------------------------------- */
/* The background of the button creates 1px gradient border */
.gh-btn-blue {
padding: 1px;
border: 0;
color: #fff;
text-shadow: 0 -1px 0 rgba(0,0,0,0.1);
fill: #fff;
stroke: #fff;
background: linear-gradient(
color(var(--blue) blackness(+10%)),
color(var(--blue) l(-15%) saturation(-15%))
);
box-shadow: 0 1px 0 rgba(0,0,0,0.12);
transition: none !important;
}
/* The background of the span is the main visual element */
.gh-btn-blue span {
background: linear-gradient(
color(var(--blue) whiteness(+5%)),
color(var(--blue) l(-5%) saturation(-8%)) 60%,
color(var(--blue) l(-5%) saturation(-8%)) 90%,
color(var(--blue) l(-3%) saturation(-8%))
);
box-shadow: 0 1px 0 rgba(255,255,255,0.1) inset;
}
/* When clicked or focused with keyboard */
.gh-btn-blue:active,
.gh-btn-blue:focus {
background: color(var(--blue) l(-20%) saturation(-15%));
}
.gh-btn-blue:active span,
.gh-btn-blue:focus span {
background: color(var(--blue) l(-7%) saturation(-10%));
box-shadow: none;
}
/* Green button
/* ---------------------------------------------------------- */
/* The background of the button creates 1px gradient border */
.gh-btn-green {
padding: 1px;
border: 0;
color: #fff;
text-shadow: 0 -1px 0 rgba(0,0,0,0.1);
fill: #fff;
stroke: #fff;
background: linear-gradient(
color(var(--green) blackness(+5%)),
color(var(--green) l(-9%) saturation(-9%))
);
box-shadow: 0 1px 1px rgba(0,0,0,0.14);
transition: none !important;
}
/* The background of the span is the main visual element */
.gh-btn-green span {
background: linear-gradient(
color(var(--green) whiteness(+4%)),
color(var(--green) l(-3%) saturation(-7%)) 60%,
color(var(--green) l(-3%) saturation(-7%)) 90%,
color(var(--green) l(-3%) saturation(-9%))
);
box-shadow: 0 1px 0 rgba(255,255,255,0.1) inset;
}
/* When clicked or focused with keyboard */
.gh-btn-green:active,
.gh-btn-green:focus {
background: color(var(--green) l(-9%) saturation(-9%));
}
.gh-btn-green:active span,
.gh-btn-green:focus span {
background: color(var(--green) l(-3%) saturation(-7%));
box-shadow: none;
}
/* Red button
/* ---------------------------------------------------------- */
/* The background of the button creates 1px gradient border */
.gh-btn-red {
padding: 1px;
border: 0;
color: #fff;
text-shadow: 0 -1px 0 rgba(0,0,0,0.1);
fill: #fff;
stroke: #fff;
background: linear-gradient(
color(var(--red) blackness(+10%)),
color(var(--red) l(-15%) saturation(-15%))
);
box-shadow: 0 1px 0 rgba(0,0,0,0.12);
transition: none !important;
}
/* The background of the span is the main visual element */
.gh-btn-red span {
background: linear-gradient(
color(var(--red) whiteness(+7%)),
color(var(--red) l(-7%) saturation(-10%)) 60%,
color(var(--red) l(-7%) saturation(-10%)) 90%,
color(var(--red) l(-4%) saturation(-10%))
);
box-shadow: 0 1px 0 rgba(255,255,255,0.1) inset;
}
/* When clicked or focused with keyboard */
.gh-btn-red:active,
.gh-btn-red:focus {
background: color(var(--red) l(-20%) saturation(-15%));
}
.gh-btn-red:active span,
.gh-btn-red:focus span {
background: color(var(--red) l(-7%) saturation(-10%));
box-shadow: none;
}
/* Black button
/* ---------------------------------------------------------- */
/* The background of the button creates 1px gradient border */
.gh-btn-black {
padding: 1px;
border: 0;
color: #fff;
text-shadow: 0 -1px 0 rgba(0,0,0,0.1);
fill: #fff;
stroke: #fff;
background: linear-gradient(
color(var(--darkgrey) blackness(+10%)),
color(var(--darkgrey) l(-15%) saturation(-15%))
);
box-shadow: 0 1px 0 rgba(0,0,0,0.12);
transition: none !important;
}
/* The background of the span is the main visual element */
.gh-btn-black span {
background: linear-gradient(
color(var(--darkgrey) whiteness(+7%)),
color(var(--darkgrey) l(-7%) saturation(-10%)) 60%,
color(var(--darkgrey) l(-7%) saturation(-10%)) 90%,
color(var(--darkgrey) l(-4%) saturation(-10%))
);
box-shadow: 0 1px 0 rgba(255,255,255,0.1) inset;
}
/* When clicked or focused with keyboard */
.gh-btn-black:active,
.gh-btn-black:focus {
background: color(var(--darkgrey) l(-20%) saturation(-15%));
}
.gh-btn-black:active span,
.gh-btn-black:focus span {
background: color(var(--darkgrey) l(-7%) saturation(-10%));
box-shadow: none;
}
/* Special Buttons
/* ---------------------------------------------------------- */
.gh-btn-white {
background: #fff;
}
.gh-btn-white span {
height: 38px;
}
.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;
}
.gh-btn-icon-right svg {
margin-left: 0.5em;
margin-right: 0;
}
.gh-btn svg.no-margin {
margin: 0;
}
/*
/* Animated button icons
/* ---------------------------------------------------------- */
/* Success icon */
path.animated-check-circle {
stroke-dashoffset: 300;
stroke-dasharray: 300;
animation: dash 4s ease-out forwards;
}
@keyframes dash {
0% {
stroke-dashoffset: 300;
}
100% {
stroke-dashoffset: 0;
}
}
/* Failure icon */
svg.retry-animated {
animation: rotate-360 0.5s ease-in-out forwards;
}
@keyframes rotate-360 {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
/*
/* Loading Button Spinner
/* ---------------------------------------------------------- */
/*
Usage: Swap out button>span text with HTML
<a class="gh-btn gh-btn-blue">
<span>
<div class="gh-spinner"></div>
</span>
</div>
*/
.gh-spinner {
position: relative;
display: inline-block;
width: 18px;
height: 18px;
border: rgba(0,0,0,0.2) solid 4px;
border-radius: 100%;
animation: spin 1s linear infinite;
}
.gh-spinner:before {
content: "";
display: block;
margin-top: 9px;
width: 4px;
height: 4px;
background: rgba(0,0,0,0.6);
border-radius: 100%;
}
@keyframes spin {
0% {
transform: rotate(0deg);
}
50% {
transform: rotate(180deg);
}
100% {
transform: rotate(360deg);
}
}
/*
/* 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:first-of-type {
margin-left: 0;
}
.gh-btn-block + .gh-btn-block {
margin-top: 5px;
}
.gh-btn-link {
border: 0;
}
/* 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;
}