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

245 lines
4.5 KiB
SCSS
Raw Normal View History

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 {
color: var(--sl-color--pale-sky);
2023-01-06 22:40:29 +01:00
cursor: text;
}
2023-01-09 23:19:15 +01:00
&::after,
&::before {
--tab-point: 10px;
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: var(--sl-color--code-background);
border-width: var(--tab-point);
margin-left: calc(var(--tab-point) * -1);
2023-01-06 22:40:29 +01:00
}
2023-01-09 23:19:15 +01:00
&::before {
2023-01-06 22:40:29 +01:00
border-color: transparent;
border-bottom-color: var(--sl-color--code-background-darker);
border-width: calc(var(--tab-point) + 1px);
margin-left: calc((var(--tab-point) + 1px) * -1);
2023-01-06 22:40:29 +01:00
}
}
.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 {
font-size: var(--sl-font-size--small);
margin-top: var(--sl-gutter--negative);
margin-left: var(--sl-gutter--negative);
2023-01-06 22:40:29 +01:00
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: var(--sl-gutter--double);
2023-01-09 20:10:02 +01:00
}
2023-01-06 22:40:29 +01:00
a::before {
color: var(--sl-color--regent-grey);
2023-01-09 20:10:02 +01:00
content: '\21d2';
font-size: var(--sl-font-size--large);
font-weight: var(--sl-font-weight--bold);
2023-01-06 22:40:29 +01:00
left: -1.2em;
position: absolute;
top: var(--sl-gutter--minus);
2023-01-06 22:40:29 +01:00
}
}
}
2023-01-09 20:10:02 +01:00
.ui-tabs-anchor {
padding: var(--sl-gutter--minus) var(--sl-gutter);
2023-01-09 20:10:02 +01:00
}
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 {
2023-03-13 23:06:52 +01:00
margin-top: var(--sl-gutter);
2023-01-09 20:10:02 +01:00
}
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;
color: var(--sl-color--hopbush);
2023-01-06 22:40:29 +01:00
&,
2023-01-09 20:10:02 +01:00
* {
font-size: var(--sl-font-size--small);
2023-01-09 20:10:02 +01:00
}
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%);
2023-02-13 18:01:44 +01:00
2023-01-06 22:40:29 +01:00
@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-03-13 23:06:52 +01:00
// custom breakpoint to make the split tabs work with a double nav column
2023-04-17 17:16:04 +02:00
@media screen and (width >= 93.75rem) {
2023-01-09 20:10:02 +01:00
body.documentation {
@include -split-css-tabs;
}
2023-01-06 22:40:29 +01:00
}
2023-03-13 23:06:52 +01:00
// custom breakpoint to make the split tabs work with a single nav column
2023-04-17 17:16:04 +02:00
@media screen and (width >= 76rem) {
2023-01-09 20:10:02 +01:00
body.guide {
@include -split-css-tabs;
}
2023-01-06 22:40:29 +01:00
}