lbry-desktop/src/ui/scss/component/_tooltip.scss
2019-06-12 19:17:41 -06:00

201 lines
3.7 KiB
SCSS

.tooltip {
display: inline-block;
position: relative;
.tooltip__body {
visibility: hidden;
}
&:hover {
.tooltip__body {
visibility: visible;
}
}
.tooltip__body {
font-size: 1rem;
color: $lbry-black;
font-weight: 400;
padding: var(--spacing-vertical-miniscule);
position: absolute;
text-align: center;
white-space: pre-wrap;
width: 200px;
background-color: $lbry-white;
border: 1px solid $lbry-gray-1;
box-shadow: 0 2px 5px rgba($lbry-black, 0.15);
&.tooltip__body--short {
width: 110px;
}
&::after {
width: 0;
height: 0;
border-style: solid;
border-width: 5px;
content: ' ';
position: absolute;
}
}
$tooltip-border: $lbry-gray-5;
&.tooltip--bottom .tooltip__body::after {
border-color: transparent transparent $tooltip-border transparent;
}
&.tooltip--left .tooltip__body::after {
border-color: transparent transparent transparent $tooltip-border;
}
&.tooltip--right .tooltip__body::after {
border-color: transparent $tooltip-border transparent transparent;
}
&.tooltip--top .tooltip__body::after {
border-color: $tooltip-border transparent transparent transparent;
}
html[data-mode='dark'] & {
.tooltip__body {
border: none;
}
$tooltip-border: $lbry-white;
&.tooltip--bottom .tooltip__body::after {
border-color: transparent transparent $tooltip-border transparent;
}
&.tooltip--left .tooltip__body::after {
border-color: transparent transparent transparent $tooltip-border;
}
&.tooltip--right .tooltip__body::after {
border-color: transparent $tooltip-border transparent transparent;
}
&.tooltip--top .tooltip__body::after {
border-color: $tooltip-border transparent transparent transparent;
}
}
}
.tooltip--always-visible {
.tooltip__body {
visibility: visible;
}
}
.tooltip--label {
// When there is a label for the tooltip and not just using a button or icon
font-size: 14px;
padding-left: $spacing-vertical * 1/3;
height: 100%;
display: flex;
align-items: center;
}
.tooltip--on-component,
.tooltip--icon {
.tooltip__body {
margin-top: 10px;
}
}
.tooltip--left .tooltip__body {
top: -5px;
right: 105%;
&::after {
top: 17px;
left: 100%;
margin-top: -5px;
}
}
.tooltip--right .tooltip__body {
margin-top: -28px;
margin-left: 110%;
&::after {
top: 14px;
right: 100%; // To the left of the tooltip
margin-top: -5px;
}
}
.tooltip--bottom .tooltip__body {
top: 90%;
left: 50%;
margin-left: -100px;
&.tooltip__body--short {
margin-left: -56px;
}
&::after {
bottom: 100%;
left: 50%;
margin-left: -5px;
}
}
.tooltip--top .tooltip__body {
bottom: 120%;
left: 50%;
margin-left: -100px;
&.tooltip__body--short {
margin-left: -56px;
}
&::after {
top: 100%;
left: 50%;
margin-left: -5px;
}
}
// Channel-tooltip
.channel-tooltip {
width: 20rem;
.channel-thumbnail {
left: 0;
position: relative;
flex-shrink: 0;
text-align: center;
display: flex;
max-width: 5rem;
max-height: 5rem;
margin-right: 1rem;
box-shadow: 0px 2px 10px -2px $lbry-black;
}
}
.channel-tooltip__profile {
display: flex;
align-items: center;
padding: 1rem;
}
.channel-tooltip__description {
padding: 1rem;
visibility: visible;
border-top: 1px solid rgba($lbry-gray-4, 0.4);
html[data-mode='dark'] & {
border-top: 1px solid rgba($lbry-black, 0.8);
}
}
.channel-tooltip__info {
align-items: center;
visibility: visible;
}
.channel-tooltip__title {
font-weight: bold;
font-size: 1.4rem;
line-height: 1.5em;
}
.channel-tooltip__url {
font-size: 1rem;
}