sass-site/source/assets/sass/components/_sass-syntax-switcher.scss

244 lines
4.2 KiB
SCSS
Raw Normal View History

2023-01-12 20:54:24 +01:00
@use '../functions';
@use '../visual-design/theme';
@use '../visual-design/typography';
2023-01-12 19:19:42 +01:00
2023-01-09 20:10:02 +01:00
.ui-helper-reset {
line-height: inherit;
}
2023-01-06 22:40:29 +01:00
@mixin -active-tab {
margin: 0;
a {
2023-01-12 19:19:42 +01:00
color: theme.$sl-color--pale-sky;
2023-01-06 22:40:29 +01:00
cursor: text;
}
2023-01-09 23:19:15 +01:00
&::after,
&::before {
2023-01-06 22:40:29 +01:00
bottom: -3px;
left: 50%;
border: solid transparent;
2023-01-09 20:10:02 +01:00
content: ' ';
2023-01-06 22:40:29 +01:00
height: 0;
width: 0;
position: absolute;
pointer-events: none;
}
2023-01-09 23:19:15 +01:00
&::after {
2023-01-06 22:40:29 +01:00
border-color: transparent;
border-bottom-color: #f8f8f8;
border-width: 10px;
margin-left: -10px;
}
2023-01-09 23:19:15 +01:00
&::before {
2023-01-06 22:40:29 +01:00
border-color: transparent;
border-bottom-color: #ebebeb;
border-width: 11px;
margin-left: -11px;
}
}
.ui-tabs {
&,
.ui-tabs-nav,
.ui-tabs-nav li.ui-tabs-active,
2023-01-09 20:10:02 +01:00
.ui-tabs-panel {
padding: 0;
}
2023-01-06 22:40:29 +01:00
2023-01-09 20:10:02 +01:00
.ui-tabs-panel-inactive {
display: none;
}
2023-01-06 22:40:29 +01:00
.ui-tabs-nav {
2023-01-12 19:19:42 +01:00
font-size: typography.$sl-font-size--small;
2023-01-06 22:40:29 +01:00
margin-top: -1rem;
margin-left: -1em;
2023-01-09 20:10:02 +01:00
a {
border: 0;
background: none;
}
2023-01-06 22:40:29 +01:00
a:focus {
2023-01-09 23:19:15 +01:00
outline: 0 !important;
2023-01-09 20:10:02 +01:00
border: none !important;
box-shadow: none !important;
2023-01-06 22:40:29 +01:00
}
2023-01-09 20:10:02 +01:00
.ui-tabs-active {
@include -active-tab;
}
2023-01-06 22:40:29 +01:00
li {
float: left;
margin: 0;
&.css-tab {
&,
2023-01-09 20:10:02 +01:00
&.ui-tabs-active {
margin-left: 2em;
}
2023-01-06 22:40:29 +01:00
a::before {
2023-01-12 19:19:42 +01:00
color: theme.$sl-color--regent-grey;
2023-01-09 20:10:02 +01:00
content: '\21d2';
2023-01-12 19:19:42 +01:00
font-size: typography.$sl-font-size--large;
font-weight: typography.$sl-font-weight--bold;
2023-01-06 22:40:29 +01:00
left: -1.2em;
position: absolute;
top: 0.75rem;
}
}
}
2023-01-09 20:10:02 +01:00
.ui-tabs-anchor {
padding: 0.75rem 1rem;
}
2023-01-06 22:40:29 +01:00
}
2023-01-09 20:10:02 +01:00
pre {
margin-top: 0;
}
2023-01-06 22:40:29 +01:00
// Carefully calibrated so that the distance between two code blocks in the
// syntax switcher is exactly equal to two lines, so there's no visual jitter
// when switching between syntaxes.
2023-01-09 20:10:02 +01:00
pre + pre {
margin-top: 22px;
}
2023-01-06 22:40:29 +01:00
}
.ui-widget.ui-widget-content,
.ui-widget-header,
.ui-state-default,
.ui-widget-content .ui-state-default,
.ui-widget-header .ui-state-default,
.ui-button,
html .ui-button.ui-state-disabled:hover,
2023-01-09 20:10:02 +01:00
html .ui-button.ui-state-disabled:active {
border: 0;
}
2023-01-06 22:40:29 +01:00
2023-01-09 20:10:02 +01:00
.ui-widget-header {
font-weight: inherit;
}
2023-01-06 22:40:29 +01:00
2023-01-09 20:10:02 +01:00
.ui-widget {
font: inherit;
}
2023-01-06 22:40:29 +01:00
.ui-widget-content,
.ui-widget-header,
.ui-state-default,
.ui-widget-content .ui-state-default,
.ui-widget-header .ui-state-default,
.ui-button,
html .ui-button.ui-state-disabled:hover,
2023-01-09 20:10:02 +01:00
html .ui-button.ui-state-disabled:active {
background: none;
}
2023-01-06 22:40:29 +01:00
.ui-widget-content,
2023-01-09 20:10:02 +01:00
.ui-widget-header {
color: inherit;
}
2023-01-06 22:40:29 +01:00
.sl-c-callout {
.ui-state-default,
.ui-widget-content .ui-state-default,
.ui-widget-header .ui-state-default,
.ui-button,
html .ui-button.ui-state-disabled:hover,
html .ui-button.ui-state-disabled:active,
.ui-state-default a,
.ui-state-default a:link,
.ui-state-default a:visited,
a.ui-button,
a:link.ui-button,
2023-01-09 23:19:15 +01:00
a:visited.ui-button {
2023-01-09 20:10:02 +01:00
color: inherit;
}
2023-01-06 22:40:29 +01:00
2023-01-09 20:10:02 +01:00
.ui-widget a {
border: 0;
}
2023-01-06 22:40:29 +01:00
}
.ui-tabs-panel > h3 {
position: relative;
2023-01-09 20:10:02 +01:00
top: 0.45rem;
2023-01-06 22:40:29 +01:00
margin: 0;
text-transform: uppercase;
2023-01-12 19:19:42 +01:00
color: theme.$sl-color--hopbush;
2023-01-06 22:40:29 +01:00
&,
2023-01-09 20:10:02 +01:00
* {
font-size: 1rem;
}
2023-01-06 22:40:29 +01:00
}
@mixin -split-css-tabs {
.ui-tabs.can-split {
.ui-tabs-panel {
2023-01-09 20:10:02 +01:00
&.scss,
&.sass {
2023-01-06 22:40:29 +01:00
width: calc(var(--split-location) - 5px);
display: inline-block;
2023-01-09 23:19:15 +01:00
2023-01-09 20:10:02 +01:00
&.ui-tabs-panel-inactive {
display: none;
}
2023-01-06 22:40:29 +01:00
}
&.css {
width: calc(100% - var(--split-location) - 5px);
float: right;
2023-01-09 23:19:15 +01:00
2023-01-09 20:10:02 +01:00
&.ui-tabs-panel-inactive {
display: block;
}
2023-01-06 22:40:29 +01:00
}
}
&.ui-tabs-panel-css-is-active {
2023-01-09 20:10:02 +01:00
.scss,
.sass {
&.ui-tabs-panel.ui-tabs-panel-previously-active {
display: inline-block;
}
2023-01-06 22:40:29 +01:00
}
}
.css-tab {
position: absolute;
left: calc(var(--split-location) - 1%);
@include -active-tab;
&,
2023-01-09 20:10:02 +01:00
&.ui-tabs-active {
margin-left: 0;
}
2023-01-06 22:40:29 +01:00
2023-01-09 20:10:02 +01:00
::before {
content: none;
}
2023-01-06 22:40:29 +01:00
}
}
}
2023-01-12 19:19:42 +01:00
@media screen and (min-width: functions.sl-px-to-rem(1500px)) {
2023-01-09 20:10:02 +01:00
body.documentation {
@include -split-css-tabs;
}
2023-01-06 22:40:29 +01:00
}
2023-01-12 19:19:42 +01:00
@media screen and (min-width: functions.sl-px-to-rem(1000px)) {
2023-01-09 20:10:02 +01:00
body.guide {
@include -split-css-tabs;
}
2023-01-06 22:40:29 +01:00
}