diff --git a/packages/nextclade-web/src/mdx-components.tsx b/packages/nextclade-web/src/mdx-components.tsx index 3d4a1b359..696d0a611 100644 --- a/packages/nextclade-web/src/mdx-components.tsx +++ b/packages/nextclade-web/src/mdx-components.tsx @@ -123,6 +123,33 @@ function Table({ ...restProps }) { return } +export const Details = styled.details` + & { + overflow: hidden; + position: relative; + border: 1px #ccc9 solid; + border-radius: 5px; + background-color: ${(props) => props.theme.gray100}; + } + + &[open] { + max-height: 300px; + overflow-y: auto; + } + + & summary { + position: sticky; + top: 0; + z-index: 1; + padding: 0.7rem; + cursor: pointer; + font-weight: bold; + border: 1px #ccc9 solid; + border-radius: 5px; + background-color: ${(props) => props.theme.gray200}; + } +` + export const mdxComponents = { h1: H1, h2: H2, @@ -137,4 +164,5 @@ export const mdxComponents = { pre: Pre, code: Code, table: Table, + details: Details, } diff --git a/packages/nextclade-web/src/styles/global.scss b/packages/nextclade-web/src/styles/global.scss index da3833ea2..30028fd8b 100644 --- a/packages/nextclade-web/src/styles/global.scss +++ b/packages/nextclade-web/src/styles/global.scss @@ -124,22 +124,6 @@ body { cursor: pointer; } -details { - height: auto; - max-height: 5rem; - transition: all 0.25s ease; -} - -details[open] { - max-height: 99rem; - transition: all 0.25s ease; -} - -details summary { - cursor: pointer; - font-weight: bold; -} - small { line-height: 100% !important; }