1
0
mirror of https://github.com/squidfunk/mkdocs-material.git synced 2025-01-27 16:43:43 +01:00

131 lines
3.4 KiB
SCSS
Raw Normal View History

2017-05-15 18:31:10 -06:00
////
/// Copyright (c) 2016-2017 Martin Donath <martin.donath@squidfunk.com>
///
/// Permission is hereby granted, free of charge, to any person obtaining a
/// copy of this software and associated documentation files (the "Software"),
/// to deal in the Software without restriction, including without limitation
/// the rights to use, copy, modify, merge, publish, distribute, sublicense,
/// and/or sell copies of the Software, and to permit persons to whom the
/// Software is furnished to do so, subject to the following conditions:
///
/// The above copyright notice and this permission notice shall be included in
/// all copies or substantial portions of the Software.
///
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
/// FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
/// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
/// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
/// DEALINGS
////
// ----------------------------------------------------------------------------
// Keyframes
// ----------------------------------------------------------------------------
2017-05-31 16:22:00 +02:00
// Show message
@keyframes md-clipboard__message--appear {
0% {
transform: translateX(0.8rem);
opacity: 0;
}
100% {
transform: translateX(0);
opacity: 1;
}
}
2017-05-15 18:31:10 -06:00
// ----------------------------------------------------------------------------
// Rules
// ----------------------------------------------------------------------------
// Copy to clipboard
.md-clipboard {
position: absolute;
top: 0.6rem;
right: 0.6rem;
width: 2.8rem;
height: 2.8rem;
border-radius: 0.2rem;
font-size: 1.6rem;
cursor: pointer;
z-index: 1;
// Hack: put everything on the GPU to omit flickering
backface-visibility: hidden;
// Icon
&::before {
@extend %md-icon;
transition:
color 0.25s,
opacity 0.25s;
color: $md-color-black--light;
content: "content_copy";
opacity: 0.25;
2017-05-15 18:31:10 -06:00
// Show on container hover
.codehilite:hover &,
.highlight:hover & {
opacity: 1;
2017-05-15 18:31:10 -06:00
}
}
// Hovered and active icon
&:hover::before,
&:active::before {
color: $md-color-accent;
}
2017-05-15 18:31:10 -06:00
// Message
&__message {
display: block;
2017-05-15 18:31:10 -06:00
position: absolute;
top: 0;
right: 3.4rem;
padding: 0.6rem 1rem;
2017-05-31 16:22:00 +02:00
transform: translateX(0.8rem);
transition:
transform 0.25s cubic-bezier(0.4, 0, 0.2, 1),
opacity 0.175s;
border-radius: 0.2rem;
background: $md-color-black--light;
2017-05-15 18:31:10 -06:00
color: $md-color-white;
font-size: ms(-1);
white-space: nowrap;
2017-05-31 16:22:00 +02:00
opacity: 0;
pointer-events: none;
// Active message
&--active {
transform: translateX(0);
transition:
transform 0.25s cubic-bezier(0.4, 0, 0.2, 1),
opacity 0.175s 0.075s;
opacity: 1;
pointer-events: initial;
}
2017-05-15 18:31:10 -06:00
// Inject content from ARIA label
&::before {
content: attr(aria-label);
2017-05-15 18:31:10 -06:00
}
// Paint a nice speech bubble
2017-05-15 18:31:10 -06:00
&::after {
display: block;
2017-05-15 18:31:10 -06:00
position: absolute;
top: 50%;
right: -0.4rem;
width: 0;
margin-top: -0.4rem;
border-width: 0.4rem 0 0.4rem 0.4rem;
border-style: solid;
border-color: transparent $md-color-black--light;
content: "";
2017-05-15 18:31:10 -06:00
}
}
}