File tree 8 files changed +406
-0
lines changed
8 files changed +406
-0
lines changed Original file line number Diff line number Diff line change @@ -210,6 +210,7 @@ import { Accordion } from 'webcoreui/react'
210
210
- [ Progress] ( https://github.com/Frontendland/webcoreui/tree/main/src/components/Progress )
211
211
- [ Radio] ( https://github.com/Frontendland/webcoreui/tree/main/src/components/Radio )
212
212
- [ Rating] ( https://github.com/Frontendland/webcoreui/tree/main/src/components/Rating )
213
+ - [ Sheet] ( https://github.com/Frontendland/webcoreui/tree/main/src/components/Sheet )
213
214
- [ Slider] ( https://github.com/Frontendland/webcoreui/tree/main/src/components/Slider )
214
215
- [ Spinner] ( https://github.com/Frontendland/webcoreui/tree/main/src/components/Spinner )
215
216
- [ Switch] ( https://github.com/Frontendland/webcoreui/tree/main/src/components/Switch )
Original file line number Diff line number Diff line change
1
+ ---
2
+ import type { SheetProps } from ' ./sheet'
3
+
4
+ import Modal from ' ../Modal/Modal.astro'
5
+
6
+ import styles from ' ./sheet.module.scss'
7
+ import { classNames } from ' ../../utils/classNames'
8
+
9
+ interface Props extends SheetProps {}
10
+
11
+ const {
12
+ position,
13
+ className,
14
+ ... rest
15
+ } = Astro .props
16
+
17
+ const classes = classNames ([
18
+ styles .sheet ,
19
+ position && styles [position ],
20
+ className
21
+ ])
22
+ ---
23
+
24
+ <Modal
25
+ className ={ classes }
26
+ {... rest }
27
+ >
28
+ <slot />
29
+ </Modal >
Original file line number Diff line number Diff line change
1
+ <script lang =" ts" >
2
+ import type { SheetProps } from ' ./sheet'
3
+
4
+ import Modal from ' ../Modal/Modal.svelte'
5
+
6
+ import styles from ' ./sheet.module.scss'
7
+ import { classNames } from ' ../../utils/classNames'
8
+
9
+ export let position: SheetProps [' position' ] = null
10
+ export let className: SheetProps [' className' ] = ' '
11
+
12
+ const classes = classNames ([
13
+ styles .sheet ,
14
+ position && styles [position ],
15
+ className
16
+ ])
17
+ </script >
18
+
19
+ <Modal
20
+ className ={classes }
21
+ {...$$restProps }
22
+ >
23
+ <slot />
24
+ </Modal >
Original file line number Diff line number Diff line change
1
+ import React from 'react'
2
+ import type { ReactSheetProps } from './sheet'
3
+
4
+ import Modal from '../Modal/Modal.tsx'
5
+
6
+ import styles from './sheet.module.scss'
7
+ import { classNames } from '../../utils/classNames'
8
+
9
+ const Sheet = ( {
10
+ position,
11
+ className,
12
+ children,
13
+ ...rest
14
+ } : ReactSheetProps ) => {
15
+ const classes = classNames ( [
16
+ styles . sheet ,
17
+ position && styles [ position ] ,
18
+ className
19
+ ] )
20
+
21
+ return (
22
+ < Modal
23
+ className = { classes }
24
+ { ...rest }
25
+ >
26
+ { children }
27
+ </ Modal >
28
+
29
+ )
30
+ }
31
+
32
+ export default Sheet
Original file line number Diff line number Diff line change
1
+ @import ' ../../scss/config.scss' ;
2
+
3
+ .sheet {
4
+ @include position (t0, ' r-100%' , lauto);
5
+ @include visibility (1 );
6
+ @include border-radius (none );
7
+ @include size (100% );
8
+ @include border (0 );
9
+ @include border (left , primary- 50);
10
+
11
+ transform : none ;
12
+
13
+ & [data-show = " true" ] {
14
+ @include position (r0);
15
+
16
+ transform : none ;
17
+ }
18
+
19
+ & .left {
20
+ @include position (' l-100%' , rauto);
21
+ @include border (0 );
22
+ @include border (right , primary- 50);
23
+
24
+ & [data-show = " true" ] {
25
+ @include position (l0);
26
+ }
27
+ }
28
+
29
+ & .top {
30
+ @include position (t0, l0);
31
+ @include size (hauto);
32
+ @include border (0 );
33
+ @include border (bottom , primary- 50);
34
+
35
+ transform : translateY (-100% );
36
+ min-width : 100% ;
37
+
38
+ & [data-show = " true" ] {
39
+ transform : translateY (0 );
40
+ }
41
+ }
42
+
43
+ & .bottom {
44
+ @include position (b0, l0);
45
+ @include size (hauto);
46
+ @include border (0 );
47
+ @include border (top , primary- 50);
48
+
49
+ transform : translateY (100% );
50
+ top : auto ;
51
+ min-width : 100% ;
52
+
53
+ & [data-show = " true" ] {
54
+ transform : translateY (0 );
55
+ }
56
+ }
57
+ }
58
+
59
+ @include media (xs) {
60
+ .sheet {
61
+ @include position (r- 500px);
62
+ @include size (w500px);
63
+
64
+ & .left {
65
+ @include position (l- 500px);
66
+ }
67
+ }
68
+ }
Original file line number Diff line number Diff line change
1
+ import type { ModalProps , ReactModalProps } from '../Modal/modal'
2
+
3
+ export type SheetProps = {
4
+ position ?: 'left'
5
+ | 'top'
6
+ | 'bottom'
7
+ | null
8
+ } & ModalProps
9
+
10
+ export type ReactSheetProps = SheetProps & ReactModalProps
Original file line number Diff line number Diff line change @@ -161,6 +161,9 @@ const tabItems = [{
161
161
<CardWrapper title =" Rating" href =" /rating" >
162
162
<Rating score ={ 4 } />
163
163
</CardWrapper >
164
+ <CardWrapper title =" Sheet" href =" /sheet" >
165
+ <Button theme =" outline" >Open Sheet</Button >
166
+ </CardWrapper >
164
167
<CardWrapper title =" Slider" href =" /slider" >
165
168
<Slider min ={ 0 } max ={ 100 } value ={ 50 } />
166
169
</CardWrapper >
You can’t perform that action at this time.
0 commit comments