Newer
Older
gnexus-ui-kit / src / scss / _demo-layout.scss
@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;

	/* 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;
  }
}