Skip to content

Commit 50e483d

Browse files
committed
code
1 parent 9fc0603 commit 50e483d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+3278
-3293
lines changed

.prettierrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"trailingComma": "es5",
33
"tabWidth": 4,
4-
"semi": false,
4+
"semi": true,
55
"singleQuote": true
66
}

.vscode/extensions.json

+7-11
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
{
2-
// See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
3-
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp
2+
// See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
3+
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp
44

5-
// List of extensions which should be recommended for users of this workspace.
6-
"recommendations": [
7-
"esbenp.prettier-vscode"
8-
],
9-
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
10-
"unwantedRecommendations": [
11-
12-
]
13-
}
5+
// List of extensions which should be recommended for users of this workspace.
6+
"recommendations": ["esbenp.prettier-vscode"],
7+
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
8+
"unwantedRecommendations": []
9+
}

jest.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ module.exports = {
1313
'<rootDir>/src/__tests__/**/*.spec.tsx',
1414
],
1515
setupFilesAfterEnv: ['<rootDir>/src/__tests__/setupTests.ts'],
16-
}
16+
};

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"description": "",
55
"main": "index.js",
66
"scripts": {
7-
"test": "echo \"Error: no test specified\" && exit 1"
7+
"test": "echo \"Error: no test specified\" && exit 1",
8+
"format": "prettier --write ."
89
},
910
"repository": {
1011
"type": "git",

packages/splitview-demo/src/app.tsx

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
1-
import * as React from 'react'
1+
import * as React from 'react';
22
// import { LoadFromConfig } from "./loadFromConfig";
33
// import { FromApi } from "./fromApi";
44
// import { PaneDemo } from "./pane";
5-
import { TestGrid } from './layout-grid/reactgrid'
6-
import { Application } from './layout-grid/application'
5+
import { TestGrid } from './layout-grid/reactgrid';
6+
import { Application } from './layout-grid/application';
77

88
const options = [
99
// { id: "config", component: LoadFromConfig },
1010
// { id: "api", component: FromApi },
1111
// { id: "pane", component: PaneDemo },
1212
{ id: 'grid', component: Application },
13-
]
13+
];
1414

1515
export const App = () => {
16-
const [value, setValue] = React.useState<string>(options[0].id)
16+
const [value, setValue] = React.useState<string>(options[0].id);
1717

1818
const onChange = (event: React.ChangeEvent<HTMLSelectElement>) =>
19-
setValue(event.target.value)
19+
setValue(event.target.value);
2020

2121
const Component = React.useMemo(
2222
() => options.find((o) => o.id === value)?.component,
2323
[value]
24-
)
24+
);
2525

2626
return (
2727
<div
@@ -48,5 +48,5 @@ export const App = () => {
4848
</div>
4949
)}
5050
</div>
51-
)
52-
}
51+
);
52+
};

packages/splitview-demo/src/index.tsx

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import * as React from 'react'
2-
import * as ReactDOM from 'react-dom'
3-
import { App } from './app'
4-
import './index.scss'
1+
import * as React from 'react';
2+
import * as ReactDOM from 'react-dom';
3+
import { App } from './app';
4+
import './index.scss';
55

6-
ReactDOM.render(<App />, document.getElementById('app'))
6+
ReactDOM.render(<App />, document.getElementById('app'));
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,83 @@
1-
import * as React from 'react'
1+
import * as React from 'react';
22
import {
33
Orientation,
44
GridviewComponent,
55
LayoutPriority,
66
GridviewReadyEvent,
77
ComponentGridview,
88
IGridviewPanelProps,
9-
} from 'splitview'
10-
import { TestGrid } from './reactgrid'
9+
} from 'splitview';
10+
import { TestGrid } from './reactgrid';
1111

1212
const rootcomponents: {
13-
[index: string]: React.FunctionComponent<IGridviewPanelProps>
13+
[index: string]: React.FunctionComponent<IGridviewPanelProps>;
1414
} = {
1515
sidebar: (props: IGridviewPanelProps) => {
1616
return (
1717
<div style={{ backgroundColor: 'rgb(37,37,38)', height: '100%' }}>
1818
sidebar
1919
</div>
20-
)
20+
);
2121
},
2222
editor: TestGrid,
2323
panel: () => {
2424
return (
2525
<div style={{ backgroundColor: 'rgb(30,30,30)', height: '100%' }}>
2626
panel
2727
</div>
28-
)
28+
);
2929
},
30-
}
30+
};
3131

3232
export const Application = () => {
33-
const api = React.useRef<ComponentGridview>()
33+
const api = React.useRef<ComponentGridview>();
3434

3535
const onReady = (event: GridviewReadyEvent) => {
3636
// event.api.deserialize(rootLayout);
3737
event.api.addComponent({
3838
id: '1',
3939
component: 'sidebar',
4040
snap: true,
41-
})
41+
});
4242
event.api.addComponent({
4343
id: '2',
4444
component: 'editor',
4545
snap: true,
4646
position: { reference: '1', direction: 'right' },
4747
priority: LayoutPriority.High,
48-
})
48+
});
4949

50-
api.current = event.api as ComponentGridview
51-
}
50+
api.current = event.api as ComponentGridview;
51+
};
5252

5353
React.useEffect(() => {
5454
const callback = (ev: UIEvent) => {
55-
const height = window.innerHeight - 20
56-
const width = window.innerWidth
55+
const height = window.innerHeight - 20;
56+
const width = window.innerWidth;
5757

58-
api.current?.layout(width, height)
59-
}
60-
window.addEventListener('resize', callback)
61-
callback(undefined)
58+
api.current?.layout(width, height);
59+
};
60+
window.addEventListener('resize', callback);
61+
callback(undefined);
6262

6363
api.current.addComponent({
6464
id: '3',
6565
component: 'panel',
6666
position: { reference: '2', direction: 'below' },
6767
size: 200,
6868
snap: true,
69-
})
69+
});
7070

7171
return () => {
72-
window.removeEventListener('resize', callback)
73-
}
74-
}, [])
72+
window.removeEventListener('resize', callback);
73+
};
74+
}, []);
7575

7676
return (
7777
<GridviewComponent
7878
components={rootcomponents}
7979
onReady={onReady}
8080
orientation={Orientation.HORIZONTAL}
8181
/>
82-
)
83-
}
82+
);
83+
};
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import * as React from 'react'
2-
import { IPanelProps } from 'splitview'
1+
import * as React from 'react';
2+
import { IPanelProps } from 'splitview';
33

44
export const CustomTab = (props: IPanelProps) => {
5-
return <div>hello</div>
6-
}
5+
return <div>hello</div>;
6+
};
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1-
import * as React from 'react'
2-
import { Api, IPanelProps } from 'splitview'
1+
import * as React from 'react';
2+
import { Api, IPanelProps } from 'splitview';
33

44
export const Editor = (props: IPanelProps & { layoutApi: Api }) => {
5-
const [tabHeight, setTabHeight] = React.useState<number>(0)
5+
const [tabHeight, setTabHeight] = React.useState<number>(0);
66

77
React.useEffect(() => {
88
if (props.layoutApi) {
9-
setTabHeight(props.layoutApi.getTabHeight())
9+
setTabHeight(props.layoutApi.getTabHeight());
1010
}
11-
}, [props.layoutApi])
11+
}, [props.layoutApi]);
1212

1313
const onTabHeightChange = (event: React.ChangeEvent<HTMLInputElement>) => {
14-
const value = Number(event.target.value)
14+
const value = Number(event.target.value);
1515
if (!Number.isNaN(value)) {
16-
setTabHeight(value)
16+
setTabHeight(value);
1717
}
18-
}
18+
};
1919

2020
const onClick = () => {
21-
props.layoutApi.setTabHeight(tabHeight)
22-
}
21+
props.layoutApi.setTabHeight(tabHeight);
22+
};
2323

2424
return (
2525
<div
@@ -35,5 +35,5 @@ export const Editor = (props: IPanelProps & { layoutApi: Api }) => {
3535
<button onClick={onClick}>Apply</button>
3636
</label>
3737
</div>
38-
)
39-
}
38+
);
39+
};

0 commit comments

Comments
 (0)