Projekt

Obecné

Profil

« Předchozí | Další » 

Revize ce63b2ab

Přidáno uživatelem Dominik Poch před více než 2 roky(ů)

Removed ant layout and used css grid

Changed layouting technology and added main layout for all pages.

Zobrazit rozdíly:

webapp/layouts/mainLayout.tsx
1 1
import { LayoutProps } from '../components/types/layoutProps';
2
import { Layout } from 'antd';
3 2
import { UserNavBar } from '../components/navigation/userNavBar';
4 3
import { AdminNavBar } from '../components/navigation/adminNavBar';
5 4
import 'antd/dist/antd.css';
6

  
7
const { Header, Content, Footer } = Layout;
5
import styles from '/styles/mainLayout.module.scss';
8 6

  
9 7
/**
10 8
 * Creates layout of main screens.
......
13 11
 */
14 12
export function MainLayout(props: LayoutProps) {
15 13
    return (
16
        <Layout>
17
            <Header>
14
        <div className={styles.layoutwrapper}>
15
            <div className={styles.header}>
18 16
                {/**
19 17
                 @todo: Select correct navigation bar
20 18
                 {user && <UserNavBar />}
21 19
                 {admin && <AdminNavBar />}
22 20
                **/}
23
            </Header>
24
            <Content>
25
                <main>{props.children}</main>
26
            </Content>
27
            <Footer></Footer>
28
        </Layout>
21
            </div>
22
            <main className={styles.content}>{props.children}</main>
23
            <div className={styles.footer}></div>
24
        </div>
29 25
    );
30 26
}
webapp/pages/annotation/index.tsx
1
import { Layout } from 'antd';
2 1
import { AnnotationPanel } from '../../components/annotation/annotationPanel';
3 2
import { DocumentAnnotationView } from '../../components/annotation/documentAnnotationView';
4 3
import { TagPanel } from '../../components/annotation/tagPanel';
......
6 5
import 'antd/dist/antd.css';
7 6
import styles from '/styles/annotation.module.scss';
8 7

  
9
const { Content, Sider } = Layout;
10

  
11 8
/**
12 9
 * Creates an annotation screen.
13 10
 * @returns The annotation screen.
......
15 12
function Annotation() {
16 13
    return (
17 14
        <MainLayout>
18
            <Layout hasSider>
19
                <Sider className={styles.leftSidePanel}>
15
            <div className={styles.layoutwrapper}>
16
                <div className={styles.tags}>
20 17
                    <TagPanel />
21
                </Sider>
22
                <Content className={styles.mainView}>
18
                </div>
19
                <div className={styles.document}>
23 20
                    <DocumentAnnotationView />
24
                </Content>
25
                <Sider className={styles.rightSidePanel}>
21
                </div>
22
                <div className={styles.annotations}>
26 23
                    <AnnotationPanel />
27
                </Sider>
28
            </Layout>
24
                </div>
25
            </div>
29 26
        </MainLayout>
30 27
    );
31 28
}
webapp/styles/annotation.module.scss
1 1
%lightBackground {
2
    background: white;
2
    background-color: white;
3 3
}
4 4

  
5
%sidePanel {
6
    @extend %lightBackground;
7
    overflow: auto;
8
    height: 100vh;
9
    position: sticky;
10
    top: 0;
5
.layoutwrapper {
6
    display: grid;
7

  
8
    grid:
9
        [main-start] 'tags document annotations' [main-end]
10
        / 1fr 3fr 1fr;
11

  
12
    width:100%;
13
    height:100%;
14
    place-items: stretch;
15
    place-content: stretch;
16
    gap: 3px;
11 17
}
12 18

  
13
.leftSidePanel {
14
    @extend %sidePanel;
15
    left: 0;
19

  
20
.tags {
21
    @extend %lightBackground;
22
    grid-area: tags;
16 23
}
17 24

  
18
.rightSidePanel {
19
    @extend %sidePanel;
20
    right: 0;
25
.annotations {
26
    @extend %lightBackground;
27
    grid-area: annotations;
21 28
}
22 29

  
23
.mainView {
30
.document {
24 31
    @extend %lightBackground;
25
    margin: 20px;
32
    grid-area: document;
26 33
}
webapp/styles/mainLayout.module.scss
1
.layoutwrapper {
2
    background-color: lightgray;
3
    display: grid;
4

  
5
    grid:
6
        [header-start] 'header' 60px [header-end]
7
        [main-start] 'content' [main-end]
8
        [footer-start] 'footer' 30px [footer-end];
9

  
10
    place-items: stretch;
11
    place-content: stretch;
12

  
13
    width: 100vw;
14
    height: 100vh;
15

  
16
    gap: 3px;
17
}
18

  
19
.header {
20
    grid-area: header;
21
}
22

  
23
.content {
24
    grid-area: content;
25
}
26

  
27
.footer {
28
    grid-area: footer;
29
}

Také k dispozici: Unified diff