-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathdemo.tsx
132 lines (125 loc) · 3.06 KB
/
demo.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
import styled, { ThemeProvider } from "styled-components";
import { Container, Row, Col, ScreenClass, ScreenBadge } from "@site/lib";
import Layout from "@theme/Layout";
import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
const customConf = {
mediaQuery: "only screen",
columns: {
xs: 4,
sm: 8,
md: 8,
lg: 12,
xl: 12
},
gutterWidth: {
xs: 1,
sm: 1,
md: 1.5,
lg: 1.5,
xl: 1.5
},
paddingWidth: {
xs: 1,
sm: 1,
md: 1.5,
lg: 1.5,
xl: 1.5
},
container: {
xs: "full", // 'full' = max-width: 100%
sm: "full", // 'full' = max-width: 100%
md: "full", // 'full' = max-width: 100%
lg: 90, // max-width: 1440px
xl: 90 // max-width: 1440px
},
breakpoints: {
xs: 1,
sm: 48, // 768px
md: 64, // 1024px
lg: 90, // 1440px
xl: 120 // 1920px
}
};
type DemoProps = {
className: string;
};
const Demo = ({ className }: DemoProps) => {
return (
<ThemeProvider theme={{ awesomegrid: customConf }}>
<div className={className}>
<Container className="grid-container" debug>
<div>
<p>Resize your browser window and see what happens!</p>
</div>
<ScreenBadge />
<Row>
<Col>
<ScreenClass
render={(screen) => (
<p
style={{
color: ["sm", "md"].includes(screen) ? "green" : "blue"
}}
>
Current screen is {screen.toUpperCase()}
</p>
)}
/>
</Col>
</Row>
<Row>
<Col xs={2} sm={3} md={4} lg={3} xl={6}>
<div className="grid-col">
xs={2} sm={3} md={4} lg={3} xl={6}
</div>
</Col>
<Col xs={2} sm={5} md={4} lg={3} xl={6}>
<div className="grid-col">
xs={2} sm={5} md={4} lg={3} xl={6}
</div>
</Col>
<Col xs={4} sm={5} md={4} lg={6} xl={6}>
<div className="grid-col">
xs={4} sm={5} md={4} lg={6} xl={6}
</div>
</Col>
<Col xs={4} sm={3} md={4} lg={12} xl={6}>
<div className="grid-col">
xs={4} sm={3} md={4} lg={12} xl={6}
</div>
</Col>
</Row>
</Container>
</div>
</ThemeProvider>
);
};
export default styled(({ className }) => {
const { siteConfig } = useDocusaurusContext();
return (
<Layout
title={siteConfig.title}
description={`${siteConfig.title} demonstration`}
>
<main>
<Demo className={className} />
</main>
</Layout>
);
})`
display: flex;
padding-top: 48px;
.grid-container {
padding-top: 20px;
position: relative;
background-color: rgb(243, 100, 2, 0.3);
border-radius: 2px;
}
.grid-col {
width: 100%;
background-color: rgb(243, 4, 242, 0.3);
min-height: 100px;
margin-bottom: 20px;
border-radius: 2px;
}
`;