-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcustomtheme.js
91 lines (86 loc) · 2.11 KB
/
customtheme.js
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
import { extendTheme } from "@chakra-ui/react";
const colors = {
brand: {
mainPurple: "#580AFF",
secondaryPurple: "#9E89F1",
primaryDark: "#000000",
primaryLight: "#FFFFFF",
},
};
const variantOutlined = () => ({
field: {
_focus: {
borderColor: "var(--chakra-ui-focus-ring-color)",
boxShadow: "0 0 0 2px var(--chakra-ui-focus-ring-color)",
},
},
});
const variantFilled = () => ({
field: {
_focus: {
borderColor: "var(--chakra-ui-focus-ring-color)",
boxShadow: "0 0 0 1px var(--chakra-ui-focus-ring-color)",
},
},
});
const variantFlushed = () => ({
field: {
_focus: {
borderColor: "var(--chakra-ui-focus-ring-color)",
boxShadow: "0 1px 0 0 var(--chakra-ui-focus-ring-color)",
},
},
});
export const theme = extendTheme({
config: {
initialColorMode: "light",
useSystemColorMode: false,
},
colors,
styles: {
global: {
// Create a CSS variable with the focus ring color desired.
// rgba function does not work here so use the hex value.
// Either :host,:root or html work. body does not work for
// button, checkbox, radio, switch.
// html: {
":host,:root": {
"--chakra-ui-focus-ring-color": "#580aff",
},
},
},
shadows: {
// This is also possible. Not sure I like inject this into
// an existing theme section.
// It creates a CSS variable named --chakra-shadows-focus-ring-color
// 'focus-ring-color': 'rgba(255, 0, 125, 0.6)',
outline: "0 0 0 2px var(--chakra-ui-focus-ring-color)",
},
components: {
Input: {
variants: {
outline: variantOutlined,
filled: variantFilled,
flushed: variantFlushed,
},
},
Select: {
variants: {
outline: variantOutlined,
filled: variantFilled,
flushed: variantFlushed,
},
},
Textarea: {
variants: {
outline: () => variantOutlined().field,
filled: () => variantFilled().field,
flushed: () => variantFlushed().field,
},
},
},
});
export default theme;
export function create() {
return <p>create</p>;
}