Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/dull-knives-fall.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@launchpad-ui/components": patch
---

Fix the way snippet colors are being set
6 changes: 5 additions & 1 deletion packages/components/src/Snippet.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { cx } from 'classix';

Check failure on line 1 in packages/components/src/Snippet.tsx

View workflow job for this annotation

GitHub Actions / Type Check

Cannot find module 'classix' or its corresponding type declarations.
import Prism from 'prismjs';
import { type JSX, useLayoutEffect, useRef } from 'react';

Expand Down Expand Up @@ -152,7 +153,10 @@
</div>
)}
<div
className={`${styles.snippet} ${className ?? ''} ${withCopyButton ? styles.copyable : ''} ${useDefaultHighlighting ? styles.useDefaultHighlighting : ''}`}
className={cx(styles.snippet, className, {
[styles.copyable]: withCopyButton,
[styles.useDefaultHighlighting]: useDefaultHighlighting,
})}
>
<pre
className={withLineNumbers ? styles['line-numbers'] : ''}
Expand Down
20 changes: 10 additions & 10 deletions packages/components/src/styles/Snippet.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
background: #3c4200;
}

.snippet pre[class*='language-'].line-numbers {
.snippet :global(pre[class*='language-'].line-numbers) {
line-height: 0.625rem;
padding-bottom: var(--lp-spacing-400);
padding-top: var(--lp-spacing-400);
Expand All @@ -92,36 +92,36 @@
z-index: var(--stacking-above-new-context);
}

.snippet .line-numbers .line-numbers-rows {
.snippet :global(.line-numbers .line-numbers-rows) {
border: none;
left: -3em;
width: 2em;
}

.snippet .token.operator,
.snippet .token.punctuation {
.snippet :global(.token.operator),
.snippet :global(.token.punctuation) {
color: var(--lp-color-text-ui-primary-base);
}

.snippet .token.function {
.snippet :global(.token.function) {
color: var(--lp-color-text-code-function);
font-weight: var(--lp-font-weight-regular);
}

.snippet .token.tag {
.snippet :global(.token.tag) {
color: var(--lp-color-text-code-tag);
}

.token.attr-value,
.token.string {
.snippet :global(.token.attr-value),
.snippet :global(.token.string) {
color: var(--lp-color-text-code-string);
}

.snippet .token.property {
.snippet :global(.token.property) {
color: var(--lp-color-text-code-keyword);
}

.snippet .token.keyword {
.snippet :global(.token.keyword) {
color: var(--lp-color-text-code-keyword);
}

Expand Down
Loading