Skip to content

Commit 30bb940

Browse files
authored
Merge pull request #110 from Lemoncode/#89--Update-theme
#89 update theme
2 parents 9b5f765 + b361e9b commit 30bb940

10 files changed

Lines changed: 290 additions & 253 deletions

File tree

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,86 +1,86 @@
11
import { css } from 'emotion';
22
import { theme } from 'core/theme';
3-
const { palette, typography, spacing } = theme;
3+
4+
const { palette, spacing, breakpoints } = theme;
5+
const color = palette.customPalette;
46

57
export const appbarContainer = css`
6-
width: 100%;
78
display: flex;
89
align-items: center;
9-
height: ${spacing(86)};
10+
width: 100%;
11+
height: ${spacing(10.75)};
1012
background-image: linear-gradient(
1113
60deg,
12-
white 250px,
13-
#d9d900 250px,
14+
white ${spacing(31.25)},
15+
${color.primary} ${spacing(31.25)},
1416
white 90%
1517
);
16-
border-bottom: 2px solid ${palette.text.primary};
17-
18-
@media (max-width: 578px) {
19-
height: auto;
20-
min-height: ${spacing(86)};
18+
border-bottom: 2px solid ${color.secondary};
19+
@media (max-width: ${breakpoints.values.sm}px) {
2120
flex-direction: column;
2221
justify-content: center;
2322
align-items: center;
24-
background-image: linear-gradient(60deg, white, white);
23+
height: auto;
24+
min-height: ${spacing(10.75)};
25+
background-image: linear-gradient(
26+
60deg,
27+
${color.background},
28+
${color.background}
29+
);
2530
}
2631
`;
2732

2833
export const logo = (showLinks: boolean): string => css`
29-
margin-top: ${spacing(5)};
30-
height: ${spacing(60)};
31-
fill: ${palette.text.primary};
32-
margin-left: 2.4rem;
33-
34-
@media (max-width: 578px) {
34+
height: ${spacing(7.5)};
35+
margin-top: ${spacing(0.625)};
36+
margin-left: ${spacing(4.8)};
37+
fill: ${color.secondary};
38+
@media (max-width: ${breakpoints.values.sm}px) {
39+
margin-top: ${showLinks ? spacing(3) : 0};
3540
margin-left: 0;
36-
margin-top: ${showLinks ? '1.5rem' : '0'};
3741
}
3842
`;
3943

4044
export const navContainer = css`
4145
margin-left: auto;
42-
43-
@media (max-width: 578px) {
46+
@media (max-width: ${breakpoints.values.sm}px) {
4447
margin-left: 0;
4548
}
4649
`;
4750

4851
export const navList = css`
4952
display: flex;
5053
list-style: none;
51-
52-
@media (max-width: 578px) {
54+
@media (max-width: ${breakpoints.values.sm}px) {
5355
padding: 0;
5456
}
5557
`;
5658

5759
export const listItem = css`
58-
margin-right: 1.5rem;
60+
margin-right: ${spacing(3)};
5961
overflow: hidden;
60-
6162
&:last-of-type {
62-
margin-right: 2.4rem;
63-
64-
@media (max-width: 578px) {
63+
margin-right: ${spacing(4.8)};
64+
@media (max-width: ${breakpoints.values.sm}px) {
6565
margin-right: 0;
6666
}
6767
}
6868
`;
6969

7070
export const link = css`
71-
font-size: 1.1rem;
72-
margin-top: 0.2rem;
7371
position: relative;
7472
display: inline-block;
73+
margin-top: ${spacing(0.4)};
74+
padding-bottom: ${spacing(0.4)};
75+
font-size: 1.1rem;
7576
text-decoration: none;
76-
color: ${palette.text.primary};
77-
padding-bottom: 0.2rem;
77+
color: ${color.secondary};
7878
border-bottom: 2px solid transparent;
7979
transition: all 0.3s ease;
8080
-webkit-transition: all 0.3s ease;
8181
&:hover {
82-
padding-bottom: 3px;
83-
border-bottom: 2px solid rgb(255, 87, 51);
84-
color: rgb(255, 87, 51);
82+
padding-bottom: ${spacing(0.375)};
83+
border-bottom: 2px solid ${color.alertLight};
84+
color: ${color.alertLight};
8585
}
8686
`;
Lines changed: 38 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,122 +1,119 @@
11
import { css } from 'emotion';
22
import { theme } from 'core/theme';
3-
const { palette, typography, spacing } = theme;
3+
4+
const { palette, spacing, breakpoints } = theme;
5+
const color = palette.customPalette;
46

57
export const footerContainer = css`
68
display: flex;
79
flex-direction: column;
810
justify-content: space-between;
9-
height: ${spacing(300)};
10-
padding: ${spacing(20)} ${spacing(100)};
11-
background-color: ${palette.text.primary};
12-
13-
@media (max-width: 728px) {
14-
padding: ${spacing(20)} ${spacing(40)} ${spacing(30)} ${spacing(40)};
11+
height: ${spacing(37.5)};
12+
padding: ${spacing(2.5)} ${spacing(12.5)};
13+
background-color: ${color.secondary};
14+
@media (max-width: ${breakpoints.values.md}px) {
15+
padding: ${spacing(2.5)} ${spacing(5)} ${spacing(3.75)} ${spacing(5)};
1516
}
16-
17-
@media (max-width: 380px) {
18-
height: ${spacing(350)};
17+
@media (max-width: ${breakpoints.values.xs}px) {
18+
height: ${spacing(43.75)};
1919
}
2020
`;
2121

2222
export const topContainer = css`
23-
padding: 0 1rem;
2423
display: flex;
2524
justify-content: space-between;
26-
height: ${spacing(195)};
25+
height: ${spacing(24.375)};
26+
padding: 0 ${spacing(2)};
2727
align-items: center;
28-
29-
@media (max-width: 380px) {
28+
@media (max-width: ${breakpoints.values.xs}px) {
3029
flex-direction: column-reverse;
31-
align-items: center;
3230
justify-content: center;
33-
height: ${spacing(220)};
31+
align-items: center;
32+
height: ${spacing(27.5)};
3433
}
3534
`;
3635

3736
export const topContainerCenter = css`
38-
padding: 0 1rem;
3937
display: flex;
4038
justify-content: center;
4139
align-items: center;
42-
height: ${spacing(195)};
40+
height: ${spacing(24.375)};
41+
padding: 0 ${spacing(2)};
4342
`;
4443

4544
export const linkList = css`
46-
padding: 0;
4745
margin: 0;
46+
padding: 0;
4847
list-style: none;
49-
50-
@media (max-width: 380px) {
48+
@media (max-width: ${breakpoints.values.xs}px) {
49+
margin-top: ${spacing(2.4)};
5150
text-align: center;
52-
margin-top: 1.2rem;
5351
}
5452
`;
5553

5654
export const link = css`
5755
font-size: 1.1rem;
58-
color: #eee;
5956
text-decoration: none;
57+
color: ${color.greyLight};
6058
&:hover {
61-
color: #d9d900;
59+
color: ${color.primary};
6260
}
6361
`;
6462

6563
export const bottomContainer = css`
6664
display: flex;
6765
justify-content: space-between;
68-
border-top: 1px solid #d9d900;
69-
padding-top: 1rem;
70-
71-
@media (max-width: 380px) {
66+
padding-top: ${spacing(2)};
67+
border-top: 1px solid ${color.primary};
68+
@media (max-width: ${breakpoints.values.xs}px) {
7269
flex-direction: column;
73-
align-items: center;
7470
justify-content: center;
71+
align-items: center;
7572
}
7673
`;
7774

7875
export const lemoncodeIcon = css`
79-
height: 100px;
76+
height: ${spacing(12.5)};
8077
`;
8178

8279
export const iconContainer = css`
8380
display: flex;
84-
padding: 0;
8581
margin: 0;
82+
padding: 0;
8683
list-style: none;
8784
`;
8885

8986
export const iconListItem = css`
90-
margin-right: 0.5rem;
87+
margin-right: ${spacing(1)};
9188
&:first-of-type {
92-
margin-right: 0.7rem;
89+
margin-right: ${spacing(1.4)};
9390
}
9491
&:last-of-type {
9592
margin-right: 0;
9693
}
9794
`;
9895

9996
export const icon = css`
100-
color: #eee;
10197
font-size: 1.5rem;
98+
color: ${color.greyLight};
10299
&:hover {
103100
cursor: pointer;
104-
color: #d9d900;
101+
color: ${color.primary};
105102
}
106103
`;
107104

108105
export const githubIcon = css`
109-
height: 22px;
110-
fill: #eee;
106+
height: ${spacing(2.75)};
107+
fill: ${color.greyLight};
111108
&:hover {
112109
cursor: pointer;
113-
fill: #d9d900;
110+
fill: ${color.primary};
114111
}
115112
`;
116113

117114
export const copyright = css`
118-
color: #eee;
119-
@media (max-width: 380px) {
120-
margin-top: 0.4rem;
115+
color: ${color.greyLight};
116+
@media (max-width: ${breakpoints.values.xs}px) {
117+
margin-top: ${spacing(0.8)};
121118
}
122119
`;

‎front/src/core/theme/theme.ts‎

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,33 @@
1-
import { createMuiTheme, Theme } from '@material-ui/core/styles';
1+
import merge from 'lodash.merge';
2+
import { createMuiTheme } from '@material-ui/core/styles';
3+
import { Theme } from './theme.vm';
24

3-
export const theme: Theme = createMuiTheme({
5+
const defaultTheme = createMuiTheme();
6+
7+
export const theme: Theme = merge(defaultTheme, {
48
palette: {
5-
primary: {
6-
main: '#625261',
7-
contrastText: '#ffffff',
8-
},
9-
secondary: {
10-
main: '#89beb3',
9+
background: {
10+
default: '#fff',
1111
},
12-
text: {
13-
primary: '#2E2800',
14-
secondary: '#323300',
12+
customPalette: {
13+
background: '#fff',
14+
primary: '#d9d900',
15+
secondary: '#2E2800',
16+
successLight: '#11ae64',
17+
successDark: '#0f834c',
18+
alertLight: 'rgb(255, 87, 51)',
19+
alertDark: 'rgb(207, 70, 41)',
20+
greyLight: '#eee',
21+
greyMedium: '#ccc',
1522
},
16-
background: {
17-
paper: '#ffffff',
18-
default: '#ffffff',
23+
},
24+
breakpoints: {
25+
values: {
26+
xs: 380,
27+
sm: 578,
28+
md: 728,
29+
lg: 1100,
1930
},
2031
},
21-
spacing: (pixel: number): string => `${pixel / 16}rem`,
32+
spacing: (factor: number) => `${0.5 * factor}rem`, // 1 unit = 8px / 0.5rem
2233
});

‎front/src/core/theme/theme.vm.ts‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { Theme as DefaultTheme } from '@material-ui/core/styles';
2+
import { Palette as DefaultPalette } from '@material-ui/core/styles/createPalette';
3+
4+
interface Palette extends DefaultPalette {
5+
customPalette: {
6+
background: string;
7+
primary: string;
8+
secondary: string;
9+
successLight: string;
10+
successDark: string;
11+
alertLight: string;
12+
alertDark: string;
13+
greyLight: string;
14+
greyMedium: string;
15+
};
16+
}
17+
18+
export interface Theme extends Omit<DefaultTheme, 'palette'> {
19+
palette: Palette;
20+
}

0 commit comments

Comments
 (0)