-
Notifications
You must be signed in to change notification settings - Fork 2
/
theme.js
144 lines (141 loc) · 4.03 KB
/
theme.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
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
133
134
135
136
137
138
139
140
141
142
143
144
import {createTheme} from '@mui/material/styles'
export const generateGradient = (alphaLeft, alphaRight) =>
`linear-gradient(103.7427deg, rgba(159, 238, 255, ${alphaLeft}) 30%, rgba(186, 117, 255, ${alphaRight}) 100%)`
// Create a theme instance.
const theme = createTheme({
components: {
MuiChip: {
variants: [
{
props: {variant: 'gradient'},
style: {
overflow: 'hidden',
color: '#191919',
border: 'none',
fontWeight: 'bold',
backgroundImage: generateGradient(0.6, 0.6),
},
},
],
},
MuiButton: {
variants: [
{
props: {variant: 'gradient'},
style: {
overflow: 'hidden',
color: '#191919',
border: '1px solid #191919',
// Workaround for creating transitioned linear-gradient hover effect
// it is not possible to transition backgroundImage
// HOW DOES IT WORK?
// pseudo element positioned absolutely outside of the button is being "bring in" on hover effect
// the actual change in positioning CAN be transitioned
'&:after': {
backgroundImage: generateGradient(0.6, 0.6),
height: '200%',
// positions button outside of the viewport
left: '-121%',
position: 'absolute',
top: '-50%',
transform: 'skewX(0deg)',
transition: 'all .35s',
width: 0,
zIndex: -1,
content: "''",
},
'&:hover': {
borderColor: 'rgba(159, 238, 255, 0.6)',
'&:after': {
content: "''",
// brings pseudo element to the button viewport
left: '-10%',
transform: 'skewX(-30deg)',
width: '120%',
},
},
},
},
{
props: {variant: 'gradient-solid'},
style: {
overflow: 'hidden',
color: '#191919',
backgroundImage: generateGradient(0.6, 0.6),
'&:after': {
backgroundImage: generateGradient(0.6, 0.6),
height: '200%',
// positions button outside of the viewport
left: '-121%',
position: 'absolute',
top: '-50%',
transform: 'skewX(0deg)',
transition: 'all .35s',
width: 0,
zIndex: -1,
content: "''",
},
'&:hover': {
borderColor: 'rgba(159, 238, 255, 0.6)',
'&:after': {
content: "''",
// brings pseudo element to the button viewport
left: '-10%',
transform: 'skewX(-30deg)',
width: '120%',
},
},
},
},
],
},
MuiListItemButton: {
styleOverrides: {
color: 'pink',
root: {
position: 'relative',
overflow: 'hidden',
'&:after': {
position: 'absolute',
width: '100%',
height: '100%',
top: 0,
left: 0,
backgroundImage: generateGradient(1, 1),
transition: 'all .5s ease-in',
opacity: 0,
content: "''",
zIndex: -1,
},
'&.Mui-selected': {
backgroundColor: 'transparent',
'&:hover': {
backgroundColor: 'transparent',
},
'&:after': {
opacity: 0.2,
content: "''",
},
},
'&:hover': {
backgroundColor: 'transparent',
'&:after': {
opacity: 0.4,
content: "''",
},
},
},
},
},
},
palette: {
primary: {
light: '#42424a',
main: '#191919',
},
secondary: {
main: 'rgb(186, 117, 255)',
},
},
})
export default theme