Skip to content

Commit 5ed6518

Browse files
authored
Merge pull request #476 from arty0928/feature/code-overflow
Fix: Code block overflow on mobile in N/M Base docs using responsive grid
2 parents 8787664 + 0c80bac commit 5ed6518

File tree

2 files changed

+24
-40
lines changed

2 files changed

+24
-40
lines changed

apps/landing/src/app/(detail)/docs/core-concepts/nm-base/page.mdx

Lines changed: 10 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { ExampleGrid } from '@/components/mdx/components/ExampleGrid'
2+
13
export const metadata = {
24
title: 'N/M Base',
35
alternates: {
@@ -48,15 +50,7 @@ Class name generation follows these steps:
4850

4951
### **Basic Class Names**
5052

51-
<div
52-
style={{
53-
display: 'grid',
54-
gridTemplateColumns: '1fr 1fr',
55-
gap: '2rem',
56-
marginBottom: '2rem',
57-
alignItems: 'start',
58-
}}
59-
>
53+
<ExampleGrid>
6054
<div>
6155
```tsx // Input
6256
<div>
@@ -75,19 +69,11 @@ Class name generation follows these steps:
7569
</div>
7670
```
7771
</div>
78-
</div>
72+
</ExampleGrid>
7973

8074
### **Responsive Class Names**
8175

82-
<div
83-
style={{
84-
display: 'grid',
85-
gridTemplateColumns: '1fr 1fr',
86-
gap: '2rem',
87-
marginBottom: '2rem',
88-
alignItems: 'start',
89-
}}
90-
>
76+
<ExampleGrid>
9177
<div>
9278
```tsx // Input
9379
<Box w={[100, 200, 300]} />
@@ -99,19 +85,11 @@ Class name generation follows these steps:
9985
{/* w: 100px, w: 200px, w: 300px */}
10086
```
10187
</div>
102-
</div>
88+
</ExampleGrid>
10389

10490
### **Pseudo-selector Class Names**
10591

106-
<div
107-
style={{
108-
display: 'grid',
109-
gridTemplateColumns: '1fr 1fr',
110-
gap: '2rem',
111-
marginBottom: '2rem',
112-
alignItems: 'start',
113-
}}
114-
>
92+
<ExampleGrid>
11593
<div>
11694
```tsx
11795
<Box _hover={{ bg: 'red' }} />
@@ -123,19 +101,11 @@ Class name generation follows these steps:
123101
{/* .g:hover { background: red; } */}
124102
```
125103
</div>
126-
</div>
104+
</ExampleGrid>
127105

128106
### **File-specific Class Names**
129107

130-
<div
131-
style={{
132-
display: 'grid',
133-
gridTemplateColumns: '1fr 1fr',
134-
gap: '2rem',
135-
marginBottom: '2rem',
136-
alignItems: 'start',
137-
}}
138-
>
108+
<ExampleGrid>
139109
<div>
140110
```tsx
141111
<div>
@@ -152,7 +122,7 @@ Class name generation follows these steps:
152122
</div>
153123
```
154124
</div>
155-
</div>
125+
</ExampleGrid>
156126

157127
## Ad-blocker Compatibility
158128

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { Grid } from '@devup-ui/react'
2+
import { ReactNode } from 'react'
3+
4+
interface ExampleGridProps {
5+
children: ReactNode
6+
}
7+
8+
export function ExampleGrid({ children }: ExampleGridProps) {
9+
return (
10+
<Grid gap="16px" gridTemplateColumns={['repeat(1, 1fr)', 'repeat(2, 1fr)']}>
11+
{children}
12+
</Grid>
13+
)
14+
}

0 commit comments

Comments
 (0)