File tree 9 files changed +379
-2
lines changed
9 files changed +379
-2
lines changed Original file line number Diff line number Diff line change @@ -203,6 +203,7 @@ import { Accordion } from 'webcoreui/react'
203
203
- [ Checkbox] ( https://github.com/Frontendland/webcoreui/tree/main/src/components/Checkbox )
204
204
- [ Collapsible] ( https://github.com/Frontendland/webcoreui/tree/main/src/components/Collapsible )
205
205
- [ ConditionalWrapper] ( https://github.com/Frontendland/webcoreui/tree/main/src/components/ConditionalWrapper )
206
+ - [ Group] ( https://github.com/Frontendland/webcoreui/tree/main/src/components/Group )
206
207
- [ Icon] ( https://github.com/Frontendland/webcoreui/tree/main/src/components/Icon )
207
208
- [ Input] ( https://github.com/Frontendland/webcoreui/tree/main/src/components/Input )
208
209
- [ List] ( https://github.com/Frontendland/webcoreui/tree/main/src/components/List )
Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ const templates = {
24
24
astro : `
25
25
---
26
26
import type { ${ component } Props } from './${ lowerCaseComponent } '
27
+
27
28
import styles from './${ lowerCaseComponent } .module.scss'
28
29
29
30
interface Props extends ${ component } Props {}
@@ -89,8 +90,8 @@ const templates = {
89
90
` ,
90
91
page : `
91
92
---
92
- import Layout from '@static/Layout.astro'
93
93
import ComponentWrapper from '@static/ComponentWrapper.astro'
94
+ import Layout from '@static/Layout.astro'
94
95
95
96
import Astro${ component } from '@components/${ component } /${ component } .astro'
96
97
import Svelte${ component } from '@components/${ component } /${ component } .svelte'
Original file line number Diff line number Diff line change @@ -18,5 +18,5 @@ export type SvelteButtonProps = {
18
18
19
19
export type ReactButtonProps = {
20
20
onClick ?: ( ) => any
21
- children ? : React . ReactNode
21
+ children : React . ReactNode
22
22
} & ButtonProps
Original file line number Diff line number Diff line change
1
+ ---
2
+ import type { GroupProps } from ' ./group'
3
+
4
+ import styles from ' ./group.module.scss'
5
+
6
+ interface Props extends GroupProps {}
7
+
8
+ const {
9
+ withSeparator,
10
+ outline,
11
+ className
12
+ } = Astro .props
13
+
14
+ const classes = [
15
+ styles .group ,
16
+ withSeparator && styles .separator ,
17
+ outline && styles .outline ,
18
+ className
19
+ ]
20
+ ---
21
+
22
+ <div class:list ={ classes } >
23
+ <slot />
24
+ </div >
Original file line number Diff line number Diff line change
1
+ <script lang =" ts" >
2
+ import type { GroupProps } from ' ./group'
3
+
4
+ import { classNames } from ' ../../utils/classNames'
5
+
6
+ import styles from ' ./group.module.scss'
7
+
8
+ export let withSeparator: GroupProps [' withSeparator' ] = false
9
+ export let outline: GroupProps [' outline' ] = false
10
+ export let className: GroupProps [' className' ] = ' '
11
+
12
+ const classes = classNames ([
13
+ styles .group ,
14
+ withSeparator && styles .separator ,
15
+ outline && styles .outline ,
16
+ className
17
+ ])
18
+ </script >
19
+
20
+ <div class ={classes }>
21
+ <slot />
22
+ </div >
Original file line number Diff line number Diff line change
1
+ import React from 'react'
2
+ import type { ReactGroupProps } from './group'
3
+
4
+ import { classNames } from '../../utils/classNames'
5
+
6
+ import styles from './group.module.scss'
7
+
8
+ const Group = ( {
9
+ withSeparator,
10
+ outline,
11
+ className,
12
+ children
13
+ } : ReactGroupProps ) => {
14
+ const classes = classNames ( [
15
+ styles . group ,
16
+ withSeparator && styles . separator ,
17
+ outline && styles . outline ,
18
+ className
19
+ ] )
20
+
21
+ return < div className = { classes } > { children } </ div >
22
+ }
23
+
24
+ export default Group
Original file line number Diff line number Diff line change
1
+ @import ' ../../scss/config.scss' ;
2
+
3
+ .group {
4
+ @include layout (flex , none );
5
+
6
+ button ,
7
+ span {
8
+ @include border-radius (none );
9
+
10
+ & :first-child {
11
+ @include border-radius (left , md);
12
+ }
13
+
14
+ & :last-child {
15
+ @include border-radius (right , md);
16
+ }
17
+ }
18
+
19
+ & .separator button ,
20
+ & .separator span {
21
+ @include border (1px , primary- 70);
22
+
23
+ & :first-child {
24
+ @include border (right , 0 );
25
+ }
26
+
27
+ & :last-child {
28
+ @include border (left , 0 );
29
+ }
30
+ }
31
+
32
+ & .outline button
33
+ & .outline span {
34
+ @include border (1px , primary- 20);
35
+ box-shadow : none ;
36
+
37
+ & :hover {
38
+ @include border (1px , primary);
39
+ box-shadow : none ;
40
+ }
41
+
42
+ & :first-child {
43
+ @include border (right , 0 );
44
+ }
45
+
46
+ & :last-child {
47
+ @include border (left , 0 );
48
+ }
49
+ }
50
+ }
Original file line number Diff line number Diff line change
1
+ export type GroupProps = {
2
+ withSeparator ?: boolean
3
+ outline ?: boolean
4
+ className ?: string
5
+ }
6
+
7
+ export type ReactGroupProps = {
8
+ children : React . ReactNode
9
+ } & GroupProps
You can’t perform that action at this time.
0 commit comments