Skip to content

Visualize Your Ideas With Code

2.6 KB
Raw Blame
$colors: (
  'error': var(--red),
  'warn': var(--yellow),
  'info': var(--blue),
  'http': #cccccc,
  'verbose': #cccccc,
  'debug': #cccccc,
  'silly': #cccccc,
);

.list {
  display: flex;
  flex-direction: column;
  gap: 8px;

  * {
    overflow-anchor: none;
  }
}

@each $level, $color in $colors {
  .list.#{$level} .log.#{$level} {
    display: block;
  }
}

.anchor {
  overflow-anchor: auto;
  height: 1px;
}

.log {
  border-left: 2px solid transparent;
  background-color: var(--background-color);
  border-radius: var(--radius);
  padding: 8px;
  overflow: hidden;
  display: none;

  @each $level, $color in $colors {
    &.#{$level} {
      border-color: $color;
    }
  }
}

.header {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0;

  .log.empty & {
    padding-left: 4px;
  }
}

.message {
  flex-grow: 1;
}

.duration {
  background-color: var(--surface-color);
  padding: 0 8px;
  border-radius: var(--radius);
  white-space: nowrap;
}

.stack {
  font-family: var(--font-family-mono);
  font-size: var(--font-size-small);
  overflow-x: auto;
  margin-top: 8px;

  --scrollbar-background: var(--background-color);
}

.section {
  margin: 16px 8px 8px;

  p {
    margin: 8px 0;
  }

  code {
    padding: 2px 0;
    border-radius: var(--radius);
  }

  pre {
    margin: 8px -8px;
    overflow-x: auto;
    background-color: var(--surface-color);
    padding: 8px;
    border-radius: var(--radius);

    code {
      padding: 0;
    }

    &:global(.wrong) code:before {
      color: #ff5257;
      font-weight: bold;
      content: '✗ WRONG\A';
    }
    &:global(.correct) code::before {
      color: #00a86b;
      font-weight: bold;
      content: '✓ CORRECT\A';
    }
  }

  a {
    color: var(--theme);
    text-decoration: none;

    &:hover,
    &:focus {
      text-decoration: underline;
    }
  }
}

.sourceCode {
  position: relative;
}

.viewSource {
  position: absolute;
  top: 0;
  right: -8px;
  border-radius: var(--radius);
  padding: 8px;
  background-color: var(--surface-color);
  opacity: 0;
  transition: opacity var(--duration-fast);

  &:focus,
  .sourceCode:hover & {
    opacity: 1;
  }
}

.entry {
  line-height: 20px;
  white-space: nowrap;

  &.external {
    opacity: 0.54;
  }
}

.link {
  cursor: pointer;
  color: inherit;

  &:hover {
    text-decoration: underline;
  }
}

.navbar {
  display: flex;
  background-color: rgba(36, 36, 36, 0.54);
  backdrop-filter: blur(5px);
  padding: 12px 16px;
  margin: -8px -16px 16px;
  position: sticky;
  top: -16px;
  z-index: 1;
}

.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex-grow: 1;
}