File tree Expand file tree Collapse file tree 3 files changed +38
-22
lines changed
@chakra-ui/gatsby-plugin/components Expand file tree Collapse file tree 3 files changed +38
-22
lines changed Original file line number Diff line number Diff line change
1
+ import type { ComponentStyleConfig } from "@chakra-ui/theme"
2
+
3
+ export const Tabs : ComponentStyleConfig = {
4
+ variants : {
5
+ primary : {
6
+ tab : {
7
+ borderTopRadius : "0.3rem" ,
8
+ borderBottom : "1px solid" ,
9
+ borderBottomColor : "primary" ,
10
+ px : 4 ,
11
+ py : "0.3rem" ,
12
+ _selected : {
13
+ color : "background" ,
14
+ bg : "primary" ,
15
+ } ,
16
+ } ,
17
+ tabpanels : {
18
+ mt : 4 ,
19
+ } ,
20
+ tabpanel : {
21
+ p : 6 ,
22
+ bg : "ednBackground" ,
23
+ border : "1px solid" ,
24
+ borderColor : "lightBorder" ,
25
+ borderRadius : "lg" ,
26
+ } ,
27
+ } ,
28
+ } ,
29
+ defaultProps : {
30
+ variant : "primary" ,
31
+ } ,
32
+ }
Original file line number Diff line number Diff line change @@ -3,11 +3,13 @@ import { Link } from "./Link"
3
3
import { Tag } from "./Tag"
4
4
import { Modal } from "./Modal"
5
5
import { Checkbox } from "./Checkbox"
6
+ import { Tabs } from "./Tabs"
6
7
7
8
export default {
8
9
Button,
9
10
Link,
10
11
Tag,
11
12
Modal,
12
13
Checkbox,
14
+ Tabs,
13
15
}
Original file line number Diff line number Diff line change @@ -25,35 +25,17 @@ const Tabs: React.FC<IProps> = ({ tabs, onTabClick }) => {
25
25
}
26
26
27
27
return (
28
- < ChakraTabs as = "nav" variant = "unstyled" >
28
+ < ChakraTabs as = "nav" >
29
29
< TabList >
30
30
{ tabs . map ( ( tab , index ) => (
31
- < Tab
32
- key = { index }
33
- px = { 4 }
34
- py = "0.3rem"
35
- borderBottom = "1px solid"
36
- borderColor = "primary"
37
- borderTopRadius = "0.3rem"
38
- _selected = { { color : "background" , bg : "primary" } }
39
- onClick = { ( ) => handleTabClick ( index ) }
40
- >
31
+ < Tab key = { index } onClick = { ( ) => handleTabClick ( index ) } >
41
32
{ tab . title }
42
33
</ Tab >
43
34
) ) }
44
35
</ TabList >
45
- < TabPanels as = "main" mt = { 4 } >
36
+ < TabPanels as = "main" >
46
37
{ tabs . map ( ( tab , index ) => (
47
- < TabPanel
48
- key = { index }
49
- p = { 6 }
50
- bg = "ednBackground"
51
- border = "1px solid"
52
- borderColor = "lightBorder"
53
- borderRadius = "lg"
54
- >
55
- { tab . content }
56
- </ TabPanel >
38
+ < TabPanel key = { index } > { tab . content } </ TabPanel >
57
39
) ) }
58
40
</ TabPanels >
59
41
</ ChakraTabs >
You can’t perform that action at this time.
0 commit comments