Skip to content

Commit 42990bd

Browse files
Fixes for layout and pre styles (#45)
* Prevent global `pre` styles on ReactcodeBlock * Fix layout overflow * Update pre fix * Update packages/theme/components/layout/article/Article.module.css Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update packages/theme/components/layout/article/Article.module.css Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Fix layout of articles without ToC * Make IndexCards full width --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 2b99ba6 commit 42990bd

4 files changed

Lines changed: 18 additions & 22 deletions

File tree

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,38 @@
11
.Article {
22
display: grid;
3+
grid-template-areas: 'main';
4+
grid-template-columns: 1fr;
35
}
46

57
.Article--withToc {
68
gap: var(--base-size-48);
9+
grid-template-areas: 'main aside';
10+
grid-template-columns: 1fr 200px;
711
}
812

913
.main {
10-
order: 1;
14+
grid-area: main;
15+
max-width: 100%;
16+
overflow-x: hidden;
1117
}
1218

1319
.aside {
14-
order: 0;
20+
grid-area: aside;
21+
position: relative;
1522
}
1623

17-
@media screen and (max-width: 48rem) {
24+
@media screen and (max-width: 1023px) {
1825
.Article--withToc {
19-
display: flex; /* Prevents column overflow */
20-
flex-direction: column;
21-
}
22-
}
23-
24-
@media screen and (min-width: 1023px) {
25-
.main {
26-
order: 0;
27-
}
28-
29-
.aside {
30-
order: 1;
31-
}
32-
33-
.Article--withToc {
34-
grid-template-columns: 1fr 200px;
26+
grid-template-areas:
27+
'aside'
28+
'main';
29+
grid-template-columns: 1fr;
3530
}
3631
}
3732

3833
@media screen and (min-width: 2048px) {
3934
.Article--withToc {
35+
grid-template-areas: 'main';
4036
grid-template-columns: 1fr;
4137
}
4238
}

packages/theme/components/layout/index-cards/IndexCards.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ export function IndexCards({route, folderData}: IndexCardsProps) {
9696
return (
9797
<Grid.Column span={{xsmall: 12, small: 12, medium: 12, large: 6, xlarge: 4}} key={item.frontMatter.title}>
9898
<Link legacyBehavior passHref href={item.route}>
99-
<Card href="#" hasBorder>
99+
<Card href="#" hasBorder fullWidth>
100100
<Card.Image src={thumbnailUrl} alt="" aspectRatio="4:3" />
101101
<Card.Heading>{item.frontMatter.title}</Card.Heading>
102102
{item.frontMatter.description && <Card.Description>{item.frontMatter.description}</Card.Description>}

packages/theme/components/layout/table-of-contents/TableOfContents.module.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
display: flex;
2727
flex-direction: column;
2828
min-width: 280px;
29-
right: 0;
3029
overflow: auto;
3130
padding: var(--base-size-40) var(--base-size-40) var(--base-size-40) 0;
3231
top: 65px;

packages/theme/css/global.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ body {
1818
margin-block-start: 0 !important;
1919
}
2020

21-
pre {
21+
/* Pre styles are scoped to Nextra code blocks to prevent unintended styling of other code blocks (e.g., ReactCodeBlock previews). */
22+
.nextra-code pre {
2223
background-color: var(--brand-color-canvas-subtle);
2324
border-radius: var(--brand-borderRadius-large);
2425
padding-top: 1rem;

0 commit comments

Comments
 (0)