Skip to content

Commit

Permalink
Merge pull request #1490 from nextstrain/fix/web-md-details
Browse files Browse the repository at this point in the history
  • Loading branch information
ivan-aksamentov authored Jun 19, 2024
2 parents 27d1c32 + 42f3aee commit eef7019
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 16 deletions.
28 changes: 28 additions & 0 deletions packages/nextclade-web/src/mdx-components.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,33 @@ function Table({ ...restProps }) {
return <TableSlim striped {...restProps} />
}

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,
Expand All @@ -137,4 +164,5 @@ export const mdxComponents = {
pre: Pre,
code: Code,
table: Table,
details: Details,
}
16 changes: 0 additions & 16 deletions packages/nextclade-web/src/styles/global.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit eef7019

Please sign in to comment.