1- import React from 'react' ;
1+ import React , { useState , useEffect } from 'react' ;
22import { SplitPane , Pane } from '../src' ;
33
44export function NestedExample ( ) {
5+ const [ isMobile , setIsMobile ] = useState ( false ) ;
6+
7+ useEffect ( ( ) => {
8+ setIsMobile ( window . innerWidth <= 768 ) ;
9+ } , [ ] ) ;
10+
511 return (
612 < div className = "example-container" >
713 < div className = "example-info" >
814 < h2 > Nested Split Panes</ h2 >
915 < p >
10- Create complex layouts by nesting split panes. This shows a typical
11- IDE layout.
16+ Create complex layouts by nesting split panes. IDE-style layout.
1217 </ p >
1318 </ div >
1419 < div className = "example-content" >
15- < SplitPane direction = " horizontal" >
16- < Pane minSize = { 150 } defaultSize = { 200 } >
20+ < SplitPane direction = { isMobile ? 'vertical' : ' horizontal' } >
21+ < Pane minSize = { 80 } defaultSize = { isMobile ? '30%' : 200 } >
1722 < div className = "pane-content sidebar" >
1823 < h2 > Explorer</ h2 >
1924 < div className = "file-tree" >
@@ -42,55 +47,24 @@ export function NestedExample() {
4247 >
4348 Pane.tsx
4449 </ div >
45- < div
46- className = "file-tree-item folder"
47- style = { { marginLeft : '1rem' } }
48- >
49- examples
50- </ div >
51- < div
52- className = "file-tree-item file"
53- style = { { marginLeft : '2rem' } }
54- >
55- BasicExample.tsx
56- </ div >
57- < div
58- className = "file-tree-item file"
59- style = { { marginLeft : '2rem' } }
60- >
61- NestedExample.tsx
62- </ div >
63- < div
64- className = "file-tree-item file"
65- style = { { marginLeft : '1rem' } }
66- >
67- package.json
68- </ div >
69- < div
70- className = "file-tree-item file"
71- style = { { marginLeft : '1rem' } }
72- >
73- README.md
74- </ div >
7550 </ div >
7651 </ div >
7752 </ Pane >
78- < Pane >
53+ < Pane minSize = { 100 } >
7954 < SplitPane direction = "vertical" >
80- < Pane minSize = { 100 } >
55+ < Pane minSize = { 60 } >
8156 < div className = "pane-content editor" >
82- < h2 > Editor - SplitPane.tsx </ h2 >
57+ < h2 > Editor</ h2 >
8358 < div className = "code-block" >
8459 < code >
85- { `export function SplitPane(props: SplitPaneProps ) {
60+ { `export function SplitPane(props) {
8661 const {
8762 direction = 'horizontal',
88- resizable = true,
8963 children,
9064 } = props;
9165
9266 return (
93- <div className={containerClassName }>
67+ <div className={className }>
9468 {renderChildren()}
9569 </div>
9670 );
@@ -99,37 +73,16 @@ export function NestedExample() {
9973 </ div >
10074 </ div >
10175 </ Pane >
102- < Pane minSize = { 80 } defaultSize = { 150 } >
76+ < Pane minSize = { 50 } defaultSize = { isMobile ? 80 : 150 } >
10377 < div className = "pane-content console" >
10478 < h2 > Terminal</ h2 >
105- < div style = { { marginTop : '0.5rem' , fontSize : '0.8rem ' } } >
79+ < div style = { { marginTop : '0.5rem' , fontSize : '0.75rem ' } } >
10680 < div style = { { color : '#50fa7b' } } > $ npm test</ div >
10781 < div style = { { color : '#888' , marginTop : '0.25rem' } } >
108- ✓ src/utils/calculations.test.ts (14 tests)
109- </ div >
110- < div style = { { color : '#888' } } >
111- ✓ src/components/SplitPane.test.tsx (6 tests)
82+ ✓ 14 tests passed
11283 </ div >
11384 < div style = { { color : '#50fa7b' , marginTop : '0.25rem' } } >
114- Tests: 20 passed
115- </ div >
116- < div
117- style = { {
118- color : '#888' ,
119- marginTop : '0.5rem' ,
120- animation : 'blink 1s infinite' ,
121- } }
122- >
123- $
124- < span
125- style = { {
126- display : 'inline-block' ,
127- width : '8px' ,
128- height : '14px' ,
129- background : '#50fa7b' ,
130- marginLeft : '4px' ,
131- } }
132- />
85+ All tests passed
13386 </ div >
13487 </ div >
13588 </ div >
0 commit comments