cartodb/assets/stylesheets/deep-insights/map/_embed.scss

456 lines
8.4 KiB
SCSS
Raw Normal View History

2020-06-15 10:58:47 +08:00
@import '../widgets/tipsy-tooltip';
$sEmbedTabs: 1rem;
$cEmbedTabs-Primary: #FFF;
$cEmbedTabs-Secondary: #DDD;
$cEmbedTabs-Shadow: rgba(0, 0, 0, 0.24);
.CDB-Embed-view {
display: flex;
flex-direction: column;
height: 100%;
.CDB-NavMenu-inner.CDB-NavMenu-inner--legends {
margin-bottom: 0;
padding: $sEmbedTabs $sEmbedTabs 0;
}
}
.CDB-Embed-header {
z-index: 3;
padding: $sEmbedTabs;
border-bottom: 1px solid $cEmbedTabs-Secondary;
background: $cEmbedTabs-Primary;
&.CDB-Embed-header--shadow {
box-shadow: 0 2px 16px 0 $cEmbedTabs-Shadow;
}
h1 {
max-width: 100%;
margin: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.CDB-Embed-description {
margin-top: 8px;
}
}
.CDB-Embed-description {
max-height: 32px;
overflow: hidden;
text-overflow: ellipsis;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
&.is-legends {
margin-bottom: 16px;
}
}
.CDB-Embed-content {
height: 100%;
}
.CDB-Embed-tab {
display: flex;
padding: 8px;
&:not(.is-active) {
display: none;
}
&.is-active {
display: flex;
box-shadow: none;
}
}
.CDB-Embed-tabs {
box-sizing: border-box;
width: 100%;
background-color: $cEmbedTabs-Primary;
box-shadow: 0 2px 16px 0 $cEmbedTabs-Shadow;
.CDB-NavMenu-inner.CDB-NavMenu-inner--legends {
border-bottom: 1px solid $cEmbedTabs-Secondary;
}
}
.CDB-Embed-legends {
height: 100%;
}
.CDB-Overlay-title {
display: flex;
align-items: center;
justify-content: space-between;
h1 {
margin: 0;
}
}
.CDB-Overlay-inner {
display: none;
margin-top: 16px;
&.is-active {
display: block;
}
&.is-description {
margin-bottom: 16px;
}
}
.CDB-Legends-canvas .CDB-Legends-canvasInner {
padding: 10px 12px;
}
.CDB-Embed-legends {
.CDB-Legends-canvas {
display: block !important;
position: relative;
top: 0;
left: 0;
width: 100%;
height: 100%;
max-height: none;
border-radius: 0;
box-shadow: none;
}
.CDB-Legends-canvasInner {
height: 100%;
max-height: none;
border-radius: 0;
}
}
@media (max-width: $sMedia-xl) {
.CDB-Embed-tab {
.CDB-Widget {
width: 250px;
}
.CDB-Widget.CDB-Widget--timeSeries {
width: auto;
}
}
}
@media (min-width: $sMedia-xl) {
.CDB-Overlay-title {
display: none;
}
.CDB-Overlay-inner {
margin-top: 0;
.CDB-Embed-description {
display: none;
}
}
// Override carto.js legends styles
.CDB-Legends-canvas {
&.is-overlay {
display: none;
}
.CDB-Legends-canvasInner {
padding: 10px 12px;
}
}
}
@media (min-width: $sMedia-min-w-vertical) {
.CDB-Embed-header,
.CDB-Embed-tabs,
.CDB-Embed-legends {
display: none;
}
}
@media (max-width: $sMedia-max-w-vertical) {
.CDB-Embed-view {
box-sizing: border-box;
overflow: hidden;
border: 1px solid #DDD;
border-radius: 4px;
}
}
@media (max-width: $sMedia-min-w-vertical - 1px) {
.CDB-Embed-content {
// 104px = header + tabs height
flex: 1;
height: calc(100% - 104px);
}
.CDB-Overlay-title {
display: none;
}
.CDB-Overlay-inner {
.CDB-Embed-description {
display: none;
}
}
.CDB-Legends-canvas {
&.is-overlay {
display: none;
}
}
}
@media (max-width: $sMedia-max-w-vertical) {
.CDB-Embed-tab {
display: flex;
width: 100%;
margin: 0;
padding: 0;
overflow-x: hidden;
}
}
/*
Legend max height depends on whether there's a time series and or the menu bar is displayed,
hence all the possible cases.
*/
@media (max-width: $sMedia-tablet - 1) {
$offset: 76;
$widgetsHeight: 186;
$timeSeriesHeight: 93;
$menuHeight: 38;
.CDB-Map .CDB-Legends-canvas,
.CDB-Map .CDB-Legends-canvasInner {
max-height: calc(100vh - #{$offset}px);
}
.CDB-Dashboard-canvas--withTimeSeries.CDB-Dashboard-canvas--withMenu.CDB-Dashboard-canvas--withWidgets {
.CDB-Map .CDB-Legends-canvas,
.CDB-Map .CDB-Legends-canvasInner {
max-height: calc(100vh - #{$offset + $widgetsHeight + $timeSeriesHeight + $menuHeight}px);
}
}
.CDB-Dashboard-canvas--withTimeSeries.CDB-Dashboard-canvas--withWidgets {
.CDB-Map .CDB-Legends-canvas,
.CDB-Map .CDB-Legends-canvasInner {
max-height: calc(100vh - #{$offset + $widgetsHeight + $timeSeriesHeight}px);
}
}
.CDB-Dashboard-canvas--withMenu.CDB-Dashboard-canvas--withWidgets {
.CDB-Map .CDB-Legends-canvas,
.CDB-Map .CDB-Legends-canvasInner {
max-height: calc(100vh - #{$offset + $widgetsHeight + $menuHeight}px);
}
}
.CDB-Dashboard-canvas--withTimeSeries {
.CDB-Map .CDB-Legends-canvas,
.CDB-Map .CDB-Legends-canvasInner {
max-height: calc(100vh - #{$offset + $timeSeriesHeight}px);
}
}
.CDB-Dashboard-canvas--withWidgets {
.CDB-Map .CDB-Legends-canvas,
.CDB-Map .CDB-Legends-canvasInner {
max-height: calc(100vh - #{$offset + $widgetsHeight}px);
}
}
.CDB-Dashboard-canvas--withMenu {
.CDB-Map .CDB-Legends-canvas,
.CDB-Map .CDB-Legends-canvasInner {
max-height: calc(100vh - #{$offset + $menuHeight}px);
}
}
}
@media (min-width: $sMedia-tablet) {
$offset: 88;
$timeSeriesHeight: 169;
$menuHeight: 30;
.CDB-Map .CDB-Legends-canvas,
.CDB-Map .CDB-Legends-canvasInner {
max-height: calc(100vh - #{$offset}px);
}
.CDB-Dashboard-canvas--withTimeSeries.CDB-Dashboard-canvas--withMenu {
.CDB-Map .CDB-Legends-canvas,
.CDB-Map .CDB-Legends-canvasInner {
max-height: calc(100vh - #{$offset + $timeSeriesHeight + $menuHeight}px);
}
}
.CDB-Dashboard-canvas--withTimeSeries {
.CDB-Map .CDB-Legends-canvas,
.CDB-Map .CDB-Legends-canvasInner {
max-height: calc(100vh - #{$offset + $timeSeriesHeight}px);
}
}
.CDB-Dashboard-canvas--withMenu {
.CDB-Map .CDB-Legends-canvas,
.CDB-Map .CDB-Legends-canvasInner {
max-height: calc(100vh - #{$offset + $menuHeight}px);
}
}
}
/* Embed banner for free users */
.CDB-Embed-banner {
position: absolute;
z-index: 2;
right: 24px;
bottom: 24px;
@media (max-width: $sMedia-xl) {
bottom: 54px;
}
@media (max-width: $sMedia-s) {
display: none;
}
&--inner {
display: flex;
position: relative;
box-sizing: border-box;
flex-direction: column;
align-items: center;
justify-content: center;
width: 140px;
height: auto;
padding: 16px 20px 12px;
border-radius: 4px;
background: white;
box-shadow: 0 0 2px 0 rgba(0, 0, 0, 0.24), 0 4px 8px 0 rgba(0, 0, 0, 0.16);
}
&__close {
position: absolute;
top: 0;
right: 0;
width: 20px;
height: 20px;
opacity: 0.3;
cursor: pointer;
&:hover {
opacity: 1;
}
&::before,
&::after {
content: ' ';
position: absolute;
top: 8px;
right: 12px;
width: 1px;
height: 10px;
background-color: #162945;
}
&::before {
transform: rotate(45deg);
}
&::after {
transform: rotate(-45deg);
}
}
&__title {
margin-bottom: 12px;
font-family: 'Montserrat';
font-size: 12px;
font-weight: 600;
line-height: 15px;
text-align: center;
}
&__button {
display: flex;
position: relative;
margin-bottom: 16px;
padding: 8px 16px;
overflow: hidden;
border-radius: 4px;
box-shadow: inset 0 0 0 1px #EB1510;
color: #EB1510;
font-family: 'Montserrat';
font-size: 12px;
font-weight: 600;
line-height: 16px;
text-align: center;
white-space: nowrap;
&::before {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
transition: background-color 0.1s linear;
background-color: transparent;
}
span {
position: relative;
overflow: hidden;
&::before {
content: '';
position: absolute;
bottom: 0;
left: -1px;
width: 100%;
height: 1px;
transform: translateX(-100%);
transition: transform 0.3s ease;
background: currentColor;
}
}
&:hover {
text-decoration: none;
span {
&::before {
transform: translateX(0);
}
}
}
> span {
position: relative;
}
}
&__link {
color: #162945;
font-family: 'Open Sans';
font-size: 10px;
font-weight: 600;
letter-spacing: -0.08px;
line-height: 16px;
text-align: center;
text-decoration: underline;
cursor: pointer;
}
}