apps/barista-design-system/src/components/live-example/live-example.scss
@import '../../../../../libs/barista-components/core/src/style/colors';
@import '../../styles/global/variables';
$code-font-size: 14px;

:host {
  display: block;
  width: 100%;
  max-width: $max-text-width;
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;

  --max-lines: 10.5;
}

:host.ba-live-example-full-width {
  max-width: 100%;
  width: 100%;
}

.ba-live-example-demo {
  padding: 1.5rem 1rem;
  border-top: 1px solid $gray-300;
  border-left: 1px solid $gray-300;
  border-right: 1px solid $gray-300;
  border-top-left-radius: 3px;
  border-top-right-radius: 3px;
  overflow: auto;
}

.ba-live-example-demo-background {
  background-color: $gray-100;
}

:host.ba-live-example-dark .ba-live-example-demo {
  background-color: $gray-860;
  color: #fff;
}

.ba-live-example-actions {
  background-color: $gray-200;
  position: relative;
  padding: 0;
  display: flex;
  border-left: 1px solid $gray-300;
  border-right: 1px solid $gray-300;
}

.ba-live-example-actions.ba-live-example-source-hidden {
  border-bottom: 1px solid $gray-300;
}

.ba-live-example-controls {
  position: absolute;
  right: 0;
  top: 0;
}

.ba-live-example-control {
  border: none;
  background: transparent;
  padding: 0.5rem 1.2rem;
  margin: 0;

  ::ng-deep svg {
    width: 20px;
    height: 20px;
    fill: $royalblue-600;
    transition: fill 150ms ease-out, transform 250ms ease-out;
  }
}

a.ba-live-example-control {
  display: inline-block;
  line-height: 0.9;
}

.ba-live-example-control:hover {
  cursor: pointer;
  background-color: $gray-300;

  ::ng-deep svg {
    fill: $royalblue-700;
  }
}

.ba-live-example-control[disabled] {
  pointer-events: none;

  ::ng-deep svg {
    fill: $gray-300;
  }
}

.ba-live-example-control-copied,
.ba-live-example-control-copied:hover {
  pointer-events: none;
  cursor: default;
}

.ba-live-example-control-expanded ::ng-deep svg {
  transform: rotate(-180deg);
}

.ba-live-example-tabs {
  display: flex;
}

.ba-live-example-tab {
  background-color: transparent;
  border: none;
  border-top: 3px solid transparent;
  border-bottom: 3px solid transparent;
  color: $royalblue-600;
  font-size: 0.875rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.5rem 1.2rem;
  margin: 0;
  position: relative;
  cursor: pointer;
  transition: all 150ms ease-out, background-color 150ms ease-out,
    border 150ms ease-out;

  &:hover {
    border-top: 3px solid $gray-300;
    background-color: $gray-300;
    text-decoration: none;
  }

  &.ba-live-example-tab-active {
    background-color: $gray-100;
    border-top: 3px solid $royalblue-600;
    color: $gray-900;
    cursor: default;
    pointer-events: none;
  }
}

.ba-live-example-tab[disabled] {
  color: $gray-300;
  border-top: 3px solid transparent;
  pointer-events: none;

  &.ba-live-example-tab-active {
    border-top-color: $gray-500;
  }
}

.ba-live-example-sources {
  counter-reset: codelines;
  font-size: $code-font-size;

  code {
    white-space: pre;
  }
}

.ba-live-example-template-source,
.ba-live-example-class-source {
  display: block;
  margin-bottom: 0;
  max-width: 100%;
  padding: 1rem;
  border-left: 1px solid $gray-300;
  border-right: 1px solid $gray-300;
  border-bottom: 1px solid $gray-300;
  border-bottom-left-radius: 3px;
  border-bottom-right-radius: 3px;
  max-height: calc(#{$code-font-size} * 1.5 * var(--max-lines));
  overflow: scroll;
}

.ba-live-example-sources-expanded {
  .ba-live-example-template-source,
  .ba-live-example-class-source {
    max-height: none;
  }
}

::ng-deep .ba-live-example-code-line::before {
  counter-increment: codelines;
  content: counter(codelines);
  font-family: 'Bitstream Vera', monospace;
  color: $gray-500;
  text-align: right;
  display: inline-block;
  width: 20px;
  margin-right: 16px;
}
