diff --git a/components/CodeBlocks/BlockCode.module.css b/components/CodeBlocks/BlockCode.module.css index 2c05cf4ae..dffb3605c 100644 --- a/components/CodeBlocks/BlockCode.module.css +++ b/components/CodeBlocks/BlockCode.module.css @@ -1,5 +1,4 @@ .code { - @apply static; @apply mb-0 px-0 py-5; } @@ -9,26 +8,29 @@ .hover, .highlight { - @apply absolute; - @apply w-full h-full; + @apply border-l-4 border-solid; +} + +.hover { + @apply border-transparent; } -.hover:hover, .highlight { - @apply bg-gray-100/10; + @apply border-l-primary; } +.hover:hover, .highlight { - @apply border-l-4 border-solid border-l-primary; + @apply bg-gray-100/10; } .number { @apply inline-block; @apply w-6; - @apply ml-5 mr-3; + @apply ml-4 mr-3; @apply text-secondary select-none; } .placeholder { - @apply ml-5; + @apply ml-4; } diff --git a/components/CodeBlocks/BlockCode.tsx b/components/CodeBlocks/BlockCode.tsx index 4c2153e59..567f8ddd0 100644 --- a/components/CodeBlocks/BlockCode.tsx +++ b/components/CodeBlocks/BlockCode.tsx @@ -26,12 +26,14 @@ const BlockCode = ({ {({ className, style, tokens, getLineProps, getTokenProps }) => (
           {tokens.map((line, index) => (
-            
- {lines.has(index + 1) ? ( - - ) : ( - +
{enableLine ? ( {index + 1} ) : ( diff --git a/components/CodeBlocks/LiveCode.test.tsx b/components/CodeBlocks/LiveCode.test.tsx index f482d84b0..8c2f0e259 100644 --- a/components/CodeBlocks/LiveCode.test.tsx +++ b/components/CodeBlocks/LiveCode.test.tsx @@ -4,7 +4,7 @@ import LiveCode from './LiveCode'; describe('LiveCode', () => { test('should render live code correctly (snapshot)', () => { const { container } = render( - Live Code + ); expect(container).toMatchSnapshot(); diff --git a/components/CodeBlocks/LiveCode.tsx b/components/CodeBlocks/LiveCode.tsx index 53037edfa..32833fe56 100644 --- a/components/CodeBlocks/LiveCode.tsx +++ b/components/CodeBlocks/LiveCode.tsx @@ -3,13 +3,13 @@ import styles from './LiveCode.module.css'; import { normalizeCode } from './utils'; interface Props { - children?: string; + code?: string; className?: string; } -const LiveCode = ({ children, className }: Props): JSX.Element => ( +const LiveCode = ({ code, className }: Props): JSX.Element => (
-    {normalizeCode(children)}
+    {normalizeCode(code)}
   
); diff --git a/components/CodeBlocks/Pre.tsx b/components/CodeBlocks/Pre.tsx index 94e57ebe1..c79d1a377 100644 --- a/components/CodeBlocks/Pre.tsx +++ b/components/CodeBlocks/Pre.tsx @@ -38,7 +38,7 @@ const Pre = ({ > {!nocopy ? : null} {live ? ( - {code} + ) : (
- @@ -35,12 +32,9 @@ exports[`BlockCode should render different language correctly (snapshot) 2`] = ` style="color: rgb(118, 217, 230); background-color: rgb(42, 42, 42);" >
- @@ -63,12 +57,9 @@ exports[`BlockCode should render different language correctly (snapshot) 3`] = ` style="color: rgb(118, 217, 230); background-color: rgb(42, 42, 42);" >
- @@ -91,12 +82,9 @@ exports[`BlockCode should render different language correctly (snapshot) 4`] = ` style="color: rgb(118, 217, 230); background-color: rgb(42, 42, 42);" >
- @@ -119,12 +107,9 @@ exports[`BlockCode should render different language correctly (snapshot) 5`] = ` style="color: rgb(118, 217, 230); background-color: rgb(42, 42, 42);" >
- @@ -171,12 +156,9 @@ exports[`BlockCode should render different language correctly (snapshot) 6`] = ` style="color: rgb(118, 217, 230); background-color: rgb(42, 42, 42);" >
- @@ -199,12 +181,9 @@ exports[`BlockCode should render different language correctly (snapshot) 7`] = ` style="color: rgb(118, 217, 230); background-color: rgb(42, 42, 42);" >
- @@ -227,12 +206,9 @@ exports[`BlockCode should render different language correctly (snapshot) 8`] = ` style="color: rgb(118, 217, 230); background-color: rgb(42, 42, 42);" >
- @@ -255,12 +231,9 @@ exports[`BlockCode should render different language correctly (snapshot) 9`] = ` style="color: rgb(118, 217, 230); background-color: rgb(42, 42, 42);" >
- @@ -324,12 +297,9 @@ exports[`BlockCode should render different language correctly (snapshot) 10`] = style="color: rgb(118, 217, 230); background-color: rgb(42, 42, 42);" >
- @@ -393,12 +363,9 @@ exports[`BlockCode should render different language correctly (snapshot) 11`] = style="color: rgb(118, 217, 230); background-color: rgb(42, 42, 42);" >
- @@ -462,12 +429,9 @@ exports[`BlockCode should render different language correctly (snapshot) 12`] = style="color: rgb(118, 217, 230); background-color: rgb(42, 42, 42);" >
- @@ -531,12 +495,9 @@ exports[`BlockCode should render different language correctly (snapshot) 13`] = style="color: rgb(118, 217, 230); background-color: rgb(42, 42, 42);" >
- @@ -594,12 +555,9 @@ exports[`BlockCode should render different language correctly (snapshot) 14`] = style="color: rgb(118, 217, 230); background-color: rgb(42, 42, 42);" >
- @@ -657,12 +615,9 @@ exports[`BlockCode should render different language correctly (snapshot) 15`] = style="color: rgb(118, 217, 230); background-color: rgb(42, 42, 42);" >
- @@ -726,12 +681,9 @@ exports[`BlockCode should render different language correctly (snapshot) 16`] = style="color: rgb(118, 217, 230); background-color: rgb(42, 42, 42);" >
- @@ -795,12 +747,9 @@ exports[`BlockCode should render different language correctly (snapshot) 17`] = style="color: rgb(118, 217, 230); background-color: rgb(42, 42, 42);" >
- @@ -864,12 +813,9 @@ exports[`BlockCode should render different language correctly (snapshot) 18`] = style="color: rgb(118, 217, 230); background-color: rgb(42, 42, 42);" >
- @@ -933,12 +879,9 @@ exports[`BlockCode should render different language correctly (snapshot) 19`] = style="color: rgb(118, 217, 230); background-color: rgb(42, 42, 42);" >
- @@ -961,12 +904,9 @@ exports[`BlockCode should render different language correctly (snapshot) 20`] = style="color: rgb(118, 217, 230); background-color: rgb(42, 42, 42);" >
- @@ -1030,12 +970,9 @@ exports[`BlockCode should render different language correctly (snapshot) 21`] = style="color: rgb(118, 217, 230); background-color: rgb(42, 42, 42);" >
- @@ -1058,12 +995,9 @@ exports[`BlockCode should render different language correctly (snapshot) 22`] = style="color: rgb(118, 217, 230); background-color: rgb(42, 42, 42);" >
- diff --git a/components/CodeBlocks/__snapshots__/Pre.test.tsx.snap b/components/CodeBlocks/__snapshots__/Pre.test.tsx.snap index 2099d0db2..a1d035215 100644 --- a/components/CodeBlocks/__snapshots__/Pre.test.tsx.snap +++ b/components/CodeBlocks/__snapshots__/Pre.test.tsx.snap @@ -11,12 +11,9 @@ exports[`Pre should hidden copy button correctly (snapshot) 1`] = ` style="color: rgb(118, 217, 230); background-color: rgb(42, 42, 42);" >
- @@ -81,12 +78,9 @@ exports[`Pre should hidden line number correctly (snapshot) 1`] = ` style="color: rgb(118, 217, 230); background-color: rgb(42, 42, 42);" >
- @@ -149,12 +143,9 @@ exports[`Pre should render code title correctly (snapshot) 1`] = ` style="color: rgb(118, 217, 230); background-color: rgb(42, 42, 42);" >
- @@ -219,12 +210,9 @@ exports[`Pre should render different language correctly (snapshot) 1`] = ` style="color: rgb(118, 217, 230); background-color: rgb(42, 42, 42);" >
- @@ -289,12 +277,9 @@ exports[`Pre should render different language correctly (snapshot) 2`] = ` style="color: rgb(118, 217, 230); background-color: rgb(42, 42, 42);" >
- @@ -359,12 +344,9 @@ exports[`Pre should render different language correctly (snapshot) 3`] = ` style="color: rgb(118, 217, 230); background-color: rgb(42, 42, 42);" >
- @@ -429,12 +411,9 @@ exports[`Pre should render different language correctly (snapshot) 4`] = ` style="color: rgb(118, 217, 230); background-color: rgb(42, 42, 42);" >
- @@ -499,12 +478,9 @@ exports[`Pre should render different language correctly (snapshot) 5`] = ` style="color: rgb(118, 217, 230); background-color: rgb(42, 42, 42);" >
- @@ -569,12 +545,9 @@ exports[`Pre should render different language correctly (snapshot) 6`] = ` style="color: rgb(118, 217, 230); background-color: rgb(42, 42, 42);" >
- @@ -639,12 +612,9 @@ exports[`Pre should render different language correctly (snapshot) 7`] = ` style="color: rgb(118, 217, 230); background-color: rgb(42, 42, 42);" >
- @@ -709,12 +679,9 @@ exports[`Pre should render different language correctly (snapshot) 8`] = ` style="color: rgb(118, 217, 230); background-color: rgb(42, 42, 42);" >
- @@ -779,12 +746,9 @@ exports[`Pre should render different language correctly (snapshot) 9`] = ` style="color: rgb(118, 217, 230); background-color: rgb(42, 42, 42);" >
- @@ -849,12 +813,9 @@ exports[`Pre should render different language correctly (snapshot) 10`] = ` style="color: rgb(118, 217, 230); background-color: rgb(42, 42, 42);" >
- @@ -919,12 +880,9 @@ exports[`Pre should render different language correctly (snapshot) 11`] = ` style="color: rgb(118, 217, 230); background-color: rgb(42, 42, 42);" >
- @@ -989,12 +947,9 @@ exports[`Pre should render different language correctly (snapshot) 12`] = ` style="color: rgb(118, 217, 230); background-color: rgb(42, 42, 42);" >
- @@ -1059,12 +1014,9 @@ exports[`Pre should render different language correctly (snapshot) 13`] = ` style="color: rgb(118, 217, 230); background-color: rgb(42, 42, 42);" >
- @@ -1129,12 +1081,9 @@ exports[`Pre should render different language correctly (snapshot) 14`] = ` style="color: rgb(118, 217, 230); background-color: rgb(42, 42, 42);" >
- @@ -1199,12 +1148,9 @@ exports[`Pre should render different language correctly (snapshot) 15`] = ` style="color: rgb(118, 217, 230); background-color: rgb(42, 42, 42);" >
- @@ -1269,12 +1215,9 @@ exports[`Pre should render different language correctly (snapshot) 16`] = ` style="color: rgb(118, 217, 230); background-color: rgb(42, 42, 42);" >
- @@ -1339,12 +1282,9 @@ exports[`Pre should render different language correctly (snapshot) 17`] = ` style="color: rgb(118, 217, 230); background-color: rgb(42, 42, 42);" >
- @@ -1409,12 +1349,9 @@ exports[`Pre should render different language correctly (snapshot) 18`] = ` style="color: rgb(118, 217, 230); background-color: rgb(42, 42, 42);" >
- @@ -1479,12 +1416,9 @@ exports[`Pre should render different language correctly (snapshot) 19`] = ` style="color: rgb(118, 217, 230); background-color: rgb(42, 42, 42);" >
- @@ -1549,12 +1483,9 @@ exports[`Pre should render different language correctly (snapshot) 20`] = ` style="color: rgb(118, 217, 230); background-color: rgb(42, 42, 42);" >
- @@ -1619,12 +1550,9 @@ exports[`Pre should render different language correctly (snapshot) 21`] = ` style="color: rgb(118, 217, 230); background-color: rgb(42, 42, 42);" >
- @@ -1689,12 +1617,9 @@ exports[`Pre should render different language correctly (snapshot) 22`] = ` style="color: rgb(118, 217, 230); background-color: rgb(42, 42, 42);" >
- @@ -1759,12 +1684,9 @@ exports[`Pre should render empty children correctly (snapshot) 1`] = ` style="color: rgb(118, 217, 230); background-color: rgb(42, 42, 42);" >
- @@ -1831,12 +1753,9 @@ exports[`Pre should render empty className correctly (snapshot) 1`] = ` style="color: rgb(118, 217, 230); background-color: rgb(42, 42, 42);" >
- @@ -1901,12 +1820,9 @@ exports[`Pre should render highlight lines correctly (snapshot) 1`] = ` style="color: rgb(118, 217, 230); background-color: rgb(42, 42, 42);" >
- diff --git a/components/MDX/__snapshots__/MDX.test.tsx.snap b/components/MDX/__snapshots__/MDX.test.tsx.snap index 319d09922..df06e9546 100644 --- a/components/MDX/__snapshots__/MDX.test.tsx.snap +++ b/components/MDX/__snapshots__/MDX.test.tsx.snap @@ -96,12 +96,9 @@ exports[`MDXPre should render correctly (snapshot) 1`] = ` style="color: rgb(118, 217, 230); background-color: rgb(42, 42, 42);" >
-