Newer
Older
gnexus-ui-kit / src / scss / _demo-layout.scss
@Eugene Sukhodolskiy Eugene Sukhodolskiy 1 day ago 3 KB Add Verdant color theme with demo switcher
@use "kit-deps" as *;
@use "components/typography" as *;

$docs-content-width: 1040px;

.docs-layout {
  display: block;
}

.docs-content {
  min-width: 0;
  max-width: $docs-content-width;
  margin: 0 auto;
}

.docs-section {
  scroll-margin-top: calc(58px + #{$space-6});
  padding-top: $space-12;
  margin-bottom: $space-12 * 2;
  border-top: 2px solid $color-dark;

  &:first-child {
    padding-top: 0;
  }

  &:target {
    border-top-color: $color-secondary;

    > .section-title {
      color: $color-secondary;
    }
  }
}

.docs-page {
  max-width: calc(#{$docs-content-width} + #{2 * $space-5});
  margin: 0 auto;
  padding-top: $space-8;
  padding-bottom: $space-12 * 2;
}

@include media_down("md") {
  .docs-page {
    padding-top: $space-6;
  }

  .docs-section {
    scroll-margin-top: calc(96px + #{$space-6});
  }
}

.demo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.docs-section-description {
  max-width: 760px;
  margin-bottom: $space-8;
  color: $color-text-medium;
}

.code-example {
	max-width: 900px;
	margin-top: $space-8;
	border: $border-width-base solid $border-color-muted;
	border-left-width: $border-width-accent;
	border-radius: $border-radius-md;
	overflow: hidden;

	/* collapsed by default: the header acts as the reveal toggle */
	> pre {
		display: none;
	}

	&.code-example-open > pre {
		display: block;
	}

  .code-example-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: $space-3;
    padding: $space-2 $space-3;
    color: $color-black;
    background: $color-primary;

    .code-example-toggle {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 24px;
      height: 24px;
      padding: 0;
      border: 0;
      background: transparent;
      color: inherit;
      cursor: pointer;
      flex-shrink: 0;

      .ph {
        font-size: 14px;
        transition-duration: $motion-fast;
        transition-property: transform;
      }

      &:focus-visible {
        @include focus_ring;
      }
    }

    .btn-icon {
      color: $color-black;

      &:not(.without-hover) {
        @include hover_touch {
          color: $color-black;
          border-color: $color-black;
        }
      }
    }
  }

  &.code-example-open .code-example-toggle .ph {
    transform: rotate(90deg);
  }

  .code-example-title {
    font-size: $font-size-sm;
    font-weight: $font-weight-bold;
    text-transform: uppercase;
  }

  pre {
    margin: 0;
    padding: $space-4;
    overflow: auto;
    background: $color-dark;
  }

  code {
    display: block;
    font-size: $font-size-sm;
    line-height: $line-height-relaxed;
    background: transparent;
  }

  .hljs {
    padding: 0;
    background: transparent;
  }
}

/* =========================
   THEME SWITCH (demo only)
========================= */

.theme-switch {
  position: fixed;
  bottom: $space-4;
  left: $space-4;
  z-index: 1000;
  display: inline-flex;
  gap: $space-1;
  padding: $space-1;
  border: $border-width-base solid $border-color-muted;
  border-radius: $border-radius-md;
  background: $surface-panel;
  box-shadow: 0 14px 36px rgba($color-black, 0.36);

  .theme-switch-btn {
    display: inline-flex;
    align-items: center;
    min-height: $control-height-sm;
    padding: 0 $space-3;
    border: $border-width-base solid transparent;
    border-radius: $border-radius-sm;
    color: $color-text-medium;
    background: transparent;
    font-family: $font-family-base;
    font-size: $font-size-xs;
    font-weight: $font-weight-bold;
    line-height: $line-height-base;
    text-transform: uppercase;
    cursor: pointer;
    transition-duration: $motion-base;
    transition-timing-function: $motion-ease;
    transition-property: color, background, border-color;

    &:focus-visible {
      @include focus_ring;
    }

    &:hover {
      color: $color-text-light;
    }

    &.is-active {
      color: $color-black;
      background: $color-primary;
      border-color: $color-primary;
    }
  }
}