sass-site/source/assets/sass/components/_playground.scss

328 lines
6.9 KiB
SCSS
Raw Normal View History

2023-06-02 16:53:32 +02:00
@use 'sass:color';
2023-05-31 18:10:09 +02:00
@use '../breakpoints';
2023-06-02 16:53:32 +02:00
@use '../config/color/brand';
2023-06-12 16:23:41 +02:00
@use '../visual-design/typography';
2023-05-31 18:10:09 +02:00
.playground {
--sl-container-max-width: 100vw;
2023-06-13 16:44:48 +02:00
display: grid;
grid-template:
'header' min-content
'main' 1fr
'footer' min-content / 100%;
2023-06-21 00:07:07 +02:00
min-height: 100vh;
overflow: hidden auto;
@include breakpoints.sl-breakpoint--large {
height: 100vh;
overflow: hidden;
}
#main-content {
display: inherit;
overflow: inherit;
}
.site-footer {
--sl-type-margin-block: var(--sl-gutter--quarter);
p {
padding-top: var(--sl-gutter--minus);
}
}
}
.sl-r-banner--playground-grid {
align-items: center;
display: grid;
grid-template:
'logo title copy' auto
'alert alert alert' minmax(0, auto) / 1fr 1fr 1fr;
@include breakpoints.sl-breakpoint--large {
grid-template: 'logo title copy' auto / 1fr 1fr 1fr;
}
}
// add padding to items in order for alert to be full width
.sl-r-banner--playground__brand {
padding-left: var(--sl-gutter);
@include breakpoints.sl-breakpoint--small {
padding-left: var(--sl-gutter--double);
}
}
.sl-l-section--playground {
--container-inline-padding: 0;
--container-inline-padding-large: 0;
2023-06-21 00:08:26 +02:00
2023-06-21 00:07:07 +02:00
border-bottom: 1px solid var(--sl-color--iron);
display: inherit;
overflow: inherit;
width: 100%;
}
.sl-r-banner__playground-title {
// Use smaller sizes for condensed header
2023-06-12 16:23:41 +02:00
--h1-size: var(--sl-font-size--xx-large);
--h1-size-lg: var(--sl-playground-heading);
2023-06-13 16:44:48 +02:00
margin-bottom: 0;
2023-06-12 16:23:41 +02:00
}
2023-06-09 18:24:33 +02:00
// Playground banner actions area
.sl-r-banner__playground-actions {
gap: var(--sl-gutter);
display: contents;
@include breakpoints.sl-breakpoint--large {
display: grid;
grid-template: 'alert copy' auto / minmax(0, auto) max-content;
}
}
.sl-r-banner__playground-button {
grid-area: copy;
padding-right: var(--sl-gutter);
text-align: right;
@include breakpoints.sl-breakpoint--small {
padding-right: var(--sl-gutter--double);
}
}
2023-05-31 18:10:09 +02:00
// Playground banner actions alert message
.sl-r-banner__playground-alert {
--alert-padding-block: 0;
grid-area: alert;
height: 0;
opacity: 0;
padding-left: var(--sl-gutter--half);
padding-right: var(--sl-gutter--half);
transition: opacity 0.3s 0.05s, visibility 0.3s;
visibility: hidden;
2023-06-09 18:24:33 +02:00
&.show {
--alert-padding-block: var(--sl-gutter--minus);
height: 100%;
opacity: 1;
visibility: visible;
2023-05-31 18:10:09 +02:00
}
}
2023-06-02 16:53:32 +02:00
// Playground Editor area
.sl-c-playground {
--sl-c-callout--block-margin: 0;
--sl-c-callout--block-padding: var(--sl-gutter--quarter);
2023-06-13 16:44:48 +02:00
display: grid;
2023-06-02 16:53:32 +02:00
gap: var(--sl-gutter);
grid-template:
'sass' 1fr
'css' auto
'debug' auto / 100%;
2023-06-02 16:53:32 +02:00
@include breakpoints.sl-breakpoint--large {
2023-06-21 00:07:07 +02:00
// magic numbers, the layout is well balanced with these proportions
grid-template:
2023-06-21 00:07:07 +02:00
'sass css' minmax(20ex, 1fr)
2023-06-21 00:08:26 +02:00
'sass debug' minmax(0, 40%) / 1fr 1fr;
2023-06-21 00:07:07 +02:00
height: 100%;
overflow: inherit;
2023-06-02 16:53:32 +02:00
}
}
2023-06-21 00:07:07 +02:00
.sl-c-playground__panel {
display: grid;
overflow: inherit;
grid-template:
'editor-tabbar' min-content
'editor-error' min-content
'editor-code' 1fr / 1fr;
}
.sl-c-playground__panel-content {
grid-area: editor-code;
overflow: hidden auto;
}
// Precompiled and Compiled code container
.sl-c-playground__code-editor-wrapper {
background-color: var(--sl-color-editor-background);
border: var(--sl-border--small) solid var(--sl-color--code-background-darker);
}
2023-06-07 21:45:42 +02:00
[data-code='precompiled'] {
--sl-color-editor-background: var(--sl-color--white);
2023-06-13 16:44:48 +02:00
2023-06-21 00:07:07 +02:00
grid-area: sass;
}
2023-06-07 21:13:23 +02:00
2023-06-13 16:44:48 +02:00
[data-code='compiled'] {
--sl-color-editor-background: var(--sl-color--code-background);
}
2023-06-07 21:13:23 +02:00
2023-06-13 18:42:28 +02:00
// Codemirror overrides
.cm-editor {
background-color: var(--sl-color-editor-background);
color: var(--sl-color--code-base, var(--sl-color--code-text));
font-size: var(--sl-font-size--x-small);
2023-06-21 00:07:07 +02:00
height: 100%;
overflow-x: auto;
overflow-y: inherit;
2023-06-13 18:42:28 +02:00
.cm-gutters {
background-color: var(--sl-color-editor-background);
border-right: none;
}
.cm-lineNumbers .cm-gutterElement {
min-width: var(--sl-gutter--double);
}
2023-06-13 18:42:28 +02:00
.cm-content,
.cm-tooltip-lint {
font-family: typography.$sl-font-family--code;
}
.cm-scroller {
overflow: unset;
}
.cm-line {
padding-left: var(--sl-gutter);
2023-06-13 18:42:28 +02:00
}
2023-06-14 23:29:52 +02:00
.cm-activeLineGutter,
2023-06-13 18:42:28 +02:00
.cm-activeLine {
2023-06-14 23:29:52 +02:00
background-color: var(--sl-color--highlight-blush);
[data-code='compiled'] & {
background-color: var(--sl-color--code-background);
}
2023-06-13 18:42:28 +02:00
}
2023-06-14 23:29:52 +02:00
&.cm-focused {
[data-code='precompiled'] & {
outline: 1px solid var(--sl-color--border-blush);
}
[data-code='compiled'] & {
outline: 0;
}
2023-06-13 18:42:28 +02:00
}
2023-06-15 21:19:37 +02:00
.sl-code-is-precompiled & {
cursor: text;
}
}
2023-06-07 21:13:23 +02:00
// Compiled CSS error
.sl-c-playground__error {
display: none;
font-weight: typography.$sl-font-weight--bold;
2023-06-21 00:07:07 +02:00
grid-area: editor-error;
[data-compiler-has-error='true'] & {
display: block;
}
}
// Console specific styles
.sl-c-playground__console-wrapper {
grid-area: debug;
}
2023-06-15 21:19:37 +02:00
.sl-c-playground__console {
2023-06-12 20:38:42 +02:00
font-family: typography.$sl-font-family--code;
2023-06-21 00:07:07 +02:00
height: 100%;
margin: 0;
2023-06-14 23:30:09 +02:00
.console-line {
display: grid;
gap: var(--sl-gutter);
2023-06-15 21:19:37 +02:00
grid-template: 'location message' auto / 10ch 1fr;
2023-06-14 23:30:09 +02:00
}
.console-message {
display: grid;
}
2023-06-06 22:25:37 +02:00
$console-type-colors: (
2023-06-14 23:29:52 +02:00
'error': var(--sl-color--error),
'warn': var(--sl-color--warn),
'debug': var(--sl-color--success),
);
@each $name, $color in $console-type-colors {
.console-type-#{$name} {
color: $color;
}
}
}
// Playground Tab Bar & Buttons
.sl-c-playground__editor-tabbar {
background-color: var(--sl-color--code-background-darker);
display: flex;
2023-06-21 00:07:07 +02:00
grid-area: editor-tabbar;
2023-06-15 20:50:34 +02:00
[data-active='true'] {
2023-06-21 00:07:07 +02:00
--color-button-text-focus: var(--color-button-tab-active);
--color-button-text: var(--sl-color--pale-sky);
2023-06-15 20:50:34 +02:00
}
2023-06-13 16:44:48 +02:00
2023-06-15 20:50:34 +02:00
[data-code='precompiled'] & {
[data-active='true'] {
2023-06-21 00:07:07 +02:00
--color-button-background: var(--sl-color--white);
--color-button-background-state: var(--sl-color--white);
}
}
2023-06-15 20:50:34 +02:00
[data-code='compiled'] & {
[data-active='true'] {
2023-06-21 00:07:07 +02:00
--color-button-background: var(--sl-color--code-background);
--color-button-background-state: var(--sl-color--code-background);
}
}
}
// Make sure all tab bar buttons and text get the same padding
[data-tabbar~='item'] {
padding: var(--sl-gutter--half) var(--sl-gutter);
}
.sl-c-playground__tabbar-title {
// For nested caps in tab title, reset a few styles
.caps {
--sl-font-size--caps: var(--sl-font-size--medium);
2023-06-15 20:50:34 +02:00
font-weight: normal;
letter-spacing: 0;
}
2023-06-21 18:04:08 +02:00
// align the code editor titles to the right of the panel header area
.sl-c-playground__code-editor-wrapper & {
margin-left: auto;
text-align: right;
}
}
.sl-c-footer-link-grid {
align-items: center;
display: grid;
gap: var(--sl-gutter);
grid-template-columns: minmax(var(--twitter-link-width), auto) 1fr;
@include breakpoints.sl-breakpoint--large {
2023-06-20 18:59:40 +02:00
grid-template-columns: minmax(var(--twitter-link-width), auto) minmax(
2023-06-21 00:08:26 +02:00
var(--mac-stadium-icon-width),
auto
);
}
}