From 5940da5a08425d63dfeeef3d32835d9c7c3e8bd1 Mon Sep 17 00:00:00 2001 From: Barsnes Date: Thu, 28 Nov 2024 08:54:32 +0100 Subject: [PATCH 1/7] chore: storefront fix --- .../src/ClipboardButton/ClipboardButton.tsx | 2 +- .../src/CodeSnippet/CodeSnippet.module.css | 11 +++- .../src/CodeSnippet/CodeSnippet.tsx | 14 ++--- apps/_components/src/Footer/Footer.tsx | 9 ++- apps/_components/src/Header/Header.tsx | 4 +- .../app/monstre/feilmeldinger/page.mdx | 58 +++++++++---------- .../MdxContent/MdxContent.module.css | 1 + .../components/SidebarMenu/SidebarMenu.tsx | 2 +- apps/storefront/tsconfig.json | 1 + .../components/TokenModal/TokenModal.tsx | 2 +- 10 files changed, 58 insertions(+), 46 deletions(-) diff --git a/apps/_components/src/ClipboardButton/ClipboardButton.tsx b/apps/_components/src/ClipboardButton/ClipboardButton.tsx index d21df7faa1..0f7545317e 100644 --- a/apps/_components/src/ClipboardButton/ClipboardButton.tsx +++ b/apps/_components/src/ClipboardButton/ClipboardButton.tsx @@ -34,7 +34,7 @@ export const ClipboardButton = ({ title={title} icon={!text} variant='tertiary' - color='neutral' + data-color='neutral' data-size='sm' > diff --git a/apps/_components/src/CodeSnippet/CodeSnippet.module.css b/apps/_components/src/CodeSnippet/CodeSnippet.module.css index 40776471c0..ddbcf60327 100644 --- a/apps/_components/src/CodeSnippet/CodeSnippet.module.css +++ b/apps/_components/src/CodeSnippet/CodeSnippet.module.css @@ -8,7 +8,16 @@ } .codeSnippet > pre { - padding-right: var(--ds-spacing-11) !important; + padding-right: var(--ds-spacing-18) !important; + background-color: var(--ds-color-neutral-background-subtle) !important; +} + +.codeSnippet > pre > code { + padding: 0; +} + +.codeSnippet > pre > code span:empty { + display: none; } .copyButton { diff --git a/apps/_components/src/CodeSnippet/CodeSnippet.tsx b/apps/_components/src/CodeSnippet/CodeSnippet.tsx index c63de3aff0..9bb4ad2e6d 100644 --- a/apps/_components/src/CodeSnippet/CodeSnippet.tsx +++ b/apps/_components/src/CodeSnippet/CodeSnippet.tsx @@ -10,8 +10,8 @@ import * as prettierCSS from 'prettier/plugins/postcss.js'; import * as prettierTypescript from 'prettier/plugins/typescript.js'; import { format } from 'prettier/standalone.js'; import { useEffect, useState } from 'react'; -import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter'; -import { nightOwl } from 'react-syntax-highlighter/dist/esm/styles/prism'; +import SyntaxHighlighter from 'react-syntax-highlighter'; +import { stackoverflowDark } from 'react-syntax-highlighter/dist/esm/styles/hljs'; import classes from './CodeSnippet.module.css'; @@ -27,15 +27,13 @@ const plugins = [ ]; type CodeSnippetProps = { - language?: 'css' | 'html' | 'ts' | 'markdown' | 'json'; - syntax?: string; + language?: 'css' | 'html' | 'ts' | 'markdown' | 'json' | 'shell'; children: string; } & React.HTMLAttributes; const CodeSnippet = ({ language = 'markdown', className, - syntax = 'js', children, ...rest }: CodeSnippetProps) => { @@ -87,15 +85,15 @@ const CodeSnippet = ({ className={classes.copyButton} aria-label='Kopier' icon - color='neutral' + data-color='neutral' data-size='sm' > {
    {links.map((item, index) => (
  • - + {item.prefix} {item.text} @@ -64,7 +64,12 @@ export const Footer = forwardRef(function Footer( -