Skip to content

Commit 581147f

Browse files
committed
Rework the view layout
1 parent 3466be0 commit 581147f

29 files changed

Lines changed: 639 additions & 976 deletions

packages/ui/src/components/editor/EditView/EditView.tsx

Lines changed: 0 additions & 36 deletions
This file was deleted.

packages/ui/src/components/editor/EditView/index.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

packages/ui/src/components/editor/Header/Header.module.scss

Lines changed: 0 additions & 56 deletions
This file was deleted.

packages/ui/src/components/editor/Header/Header.stories.tsx

Lines changed: 0 additions & 19 deletions
This file was deleted.

packages/ui/src/components/editor/Header/Header.tsx

Lines changed: 0 additions & 64 deletions
This file was deleted.

packages/ui/src/components/editor/Header/index.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

packages/ui/src/components/editor/EditView/EditView.module.scss renamed to packages/ui/src/components/editor/Page/Page.module.scss

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,36 @@
1111
display: flex;
1212
align-items: center;
1313
justify-content: space-between;
14-
height: var(--header-height);
15-
gap: var(--padding-2px);
16-
padding: 0 15px var(--padding-6px) var(--padding-14px);
14+
padding: var(--padding-8px) var(--padding-12px) var(--padding-6px)
15+
var(--padding-14px);
1716
border-bottom: 1px solid var(--vscode-sideBarSectionHeader-border);
17+
position: relative;
18+
19+
&__title {
20+
position: absolute;
21+
left: 50%;
22+
font-weight: 600;
23+
transform: translateX(-50%);
24+
font-size: var(--font-size-14px);
25+
}
1826

1927
&__back {
2028
display: flex;
2129
align-items: center;
30+
gap: var(--padding-2px);
2231

2332
> span {
2433
font-size: var(--font-size-13px);
25-
color: var(--vscode-foreground);
34+
font-weight: 500;
35+
color: var(--vscode-editor-foreground);
36+
}
37+
}
38+
39+
&__right {
40+
display: flex;
41+
42+
&__slot {
43+
padding-right: var(--padding-3px);
2644
}
2745
}
2846
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import styles from './Page.module.scss'
2+
import { IconButton } from '../IconButton/IconButton'
3+
import SimpleBar from 'simplebar-react'
4+
5+
type Props = {
6+
title?: string
7+
on_back_click?: () => void
8+
on_close_click?: () => void
9+
header_slot?: React.ReactNode
10+
children: React.ReactNode
11+
}
12+
13+
export const Page: React.FC<Props> = (props) => {
14+
return (
15+
<div className={styles.container}>
16+
<div className={styles.header}>
17+
{props.title && (
18+
<div className={styles.header__title}>{props.title}</div>
19+
)}
20+
<div className={styles.header__back}>
21+
{props.on_back_click && (
22+
<>
23+
<IconButton
24+
codicon_icon="chevron-left"
25+
on_click={props.on_back_click}
26+
title="Return to previous screen"
27+
/>
28+
<span>Back</span>
29+
</>
30+
)}
31+
</div>
32+
<div className={styles.header__right}>
33+
<div className={styles.header__right__slot}>{props.header_slot}</div>
34+
{props.on_close_click && (
35+
<IconButton
36+
codicon_icon="chrome-close"
37+
on_click={props.on_close_click}
38+
title="Close"
39+
/>
40+
)}
41+
</div>
42+
</div>
43+
<div className={styles.content}>
44+
<SimpleBar
45+
style={{
46+
height: '100%'
47+
}}
48+
>
49+
<div className={styles.content__inner}>{props.children}</div>
50+
</SimpleBar>
51+
</div>
52+
</div>
53+
)
54+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './Page'

packages/ui/src/components/editor/Presets/Presets.module.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
.container {
22
display: flex;
33
flex-direction: column;
4-
gap: var(--padding-6px);
54

65
&--disabled {
76
opacity: var(--disabled-opacity);
@@ -14,6 +13,7 @@
1413
align-items: center;
1514
justify-content: space-between;
1615
padding: 0 var(--padding-12px);
16+
margin-bottom: var(--padding-2px);
1717

1818
&__left {
1919
display: flex;
@@ -129,6 +129,6 @@
129129
}
130130

131131
&__create {
132-
margin: 0 var(--padding-12px);
132+
margin: var(--padding-8px) var(--padding-12px) 0 var(--padding-12px);
133133
}
134134
}

0 commit comments

Comments
 (0)