Skip to content

Commit 4a013a9

Browse files
author
Asier Cidon
committed
Added dark and light themes
1 parent fc6e5fe commit 4a013a9

11 files changed

+176
-88
lines changed

public/logo-color.png

852 KB
Loading

src/App.module.css

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.theme-button h1 {
2+
color: var(--on-secondary-color);
3+
margin: var(--l);
4+
font-size: var(--body-size-l);
5+
cursor: pointer;
6+
font-weight: bold;
7+
text-decoration: underline;
8+
}

src/App.tsx

+34-6
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,42 @@
1-
import React from "react";
2-
import { Header } from "./ui/header/Header";
3-
import { Home } from "./ui/home/Home";
1+
import React, { useState } from 'react';
2+
import { Header } from './ui/header/Header';
3+
import { Home } from './ui/home/Home';
4+
import { bind } from './utils/bind';
5+
import stylesApp from './App.module.css';
6+
import classNamesBind from 'classnames/bind';
7+
import stylesDark from './styles/themeDark.module.css';
8+
// import stylesLight from './styles/themeLight.module.css';
9+
10+
const cx = bind(stylesApp);
411

512
function App() {
13+
const [selectTheme, setSelectTheme] = useState('light');
14+
15+
classNamesBind.bind(stylesDark);
16+
17+
const changeTheme = async () => {
18+
if (selectTheme === 'light') {
19+
console.log('Importing Light');
20+
await import('./styles/themeLight.module.css');
21+
setSelectTheme('dark');
22+
} else {
23+
console.log('Importing Dark');
24+
window.location.reload();
25+
setSelectTheme('light');
26+
}
27+
};
28+
629
return (
730
<>
8-
<Header />
31+
<header>
32+
<div className={cx('theme-button')}>
33+
<h1 onClick={changeTheme}>{selectTheme}</h1>
34+
</div>
35+
<Header />
36+
</header>
937
<Home />
1038
</>
11-
)
39+
);
1240
}
1341

14-
export default App;
42+
export default App;

src/core/components/logo/Logo.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ export const Logo: React.FunctionComponent<Props> = ({ size }) => {
1212
return (
1313
<>
1414
<img
15-
src='./logo.png'
16-
data-testid='Logo'
17-
alt='Jump Logo'
15+
src="./logo-color.png"
16+
data-testid="Logo"
17+
alt="Jump Logo"
1818
className={cx(size)}
1919
/>
2020
</>

src/styles/index.css

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
@import './reset.css';
2-
@import './theme.css';
32

43
body {
54
font-family: var(--body-font);
@@ -15,3 +14,11 @@ input {
1514
select {
1615
font-family: var(--body-font);
1716
}
17+
18+
* {
19+
-ms-overflow-style: none;
20+
}
21+
22+
::-webkit-scrollbar {
23+
display: none;
24+
}

src/styles/theme.css src/styles/themeDark.module.css

+5-4
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,13 @@
1919
--body-font: Comfortaa;
2020
--title-font: Comfortaa;
2121

22-
--primary-color: linear-gradient(to bottom right, #72ebbc, #3c7497);
22+
/* --primary-color: linear-gradient(to bottom right, #72ebbc, #3c7497); */
23+
--primary-color: linear-gradient(to bottom right, #000000, #363738);
2324
--on-primary-color: white;
2425

25-
--secondary-color: white;
26-
--on-secondary-color: #547386;
27-
--shadow-secondary-color: #cfd6e2;
26+
--secondary-color: linear-gradient(to bottom right, #202020, #3a3a3a);
27+
--on-secondary-color: white;
28+
--shadow-secondary-color: #5e6166;
2829

2930
--logo-xxl: 150px;
3031
--logo-xl: 125px;

src/styles/themeLight.module.css

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
@import url('https://fonts.googleapis.com/css?family=Comfortaa');
2+
3+
:root {
4+
--xs: 0.25rem;
5+
--s: 0.5rem;
6+
--m: 1rem;
7+
--l: 2rem;
8+
--xl: 4rem;
9+
--xxl: 8rem;
10+
11+
--body-size-s: 10px;
12+
--body-size-m: 14px;
13+
--body-size-l: 16px;
14+
--body-size-xl: 20px;
15+
--body-size-xxl: 24px;
16+
17+
--body-size: 22px;
18+
19+
--body-font: Comfortaa;
20+
--title-font: Comfortaa;
21+
22+
/* --primary-color: linear-gradient(to bottom right, #72ebbc, #3c7497); */
23+
--primary-color: linear-gradient(to bottom right, #ffffff, #ffffff);
24+
--on-primary-color: rgb(56, 56, 56);
25+
26+
--secondary-color: linear-gradient(to bottom right, #fafafa, #f1f1f1);
27+
--on-secondary-color: rgb(24, 24, 24);
28+
--shadow-secondary-color: #ffffff;
29+
30+
--logo-xxl: 150px;
31+
--logo-xl: 125px;
32+
--logo-l: 60px;
33+
--logo-m: 40px;
34+
--logo-s: 25px;
35+
--logo-xs: 10px;
36+
}

src/ui/header/Header.module.css

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
border: none;
55
flex-direction: column;
66
align-items: center;
7-
padding-top: var(--xl);
87
padding-bottom: var(--xxl);
98
}
109

src/ui/header/Header.tsx

+6-8
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,12 @@ interface Props {}
1010
export const Header: React.FunctionComponent<Props> = () => {
1111
return (
1212
<>
13-
<header>
14-
<div className={cx('logo')}>
15-
<a href='/'>
16-
<Logo size='xxl'></Logo>
17-
</a>
18-
<h1>Jump App v2.0</h1>
19-
</div>
20-
</header>
13+
<div className={cx('logo')}>
14+
<a href='/'>
15+
<Logo size='xxl'></Logo>
16+
</a>
17+
<h1>Jump App v2.0</h1>
18+
</div>
2119
</>
2220
);
2321
};

src/ui/home/Home.module.css

+19-6
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,33 @@
1212
flex-direction: column;
1313
}
1414

15+
.jumps-buttons-images {
16+
color: #282c34;
17+
display: flex;
18+
flex-direction: row;
19+
padding-top: var(--m);
20+
padding-left: var(--l);
21+
}
22+
23+
.jumps-buttons-images-item {
24+
padding-right: var(--l);
25+
}
26+
1527
.jumps-buttons h1 {
1628
color: var(--on-secondary-color);
1729
padding-top: var(--l);
1830
font-size: var(--body-size-l);
1931
}
2032

2133
.jumps-buttons-button {
22-
background-color: var(--secondary-color);
34+
background-image: var(--secondary-color);
2335
color: var(--on-secondary-color);
2436
border: 1px solid var(--shadow-secondary-color);
2537
width: var(--logo-l);
2638
height: var(--logo-l);
2739
margin-top: var(--m);
2840
margin-right: var(--m);
29-
border-radius: 25px;
41+
border-radius: 50%;
3042
}
3143

3244
.jumps-buttons-button-img {
@@ -35,7 +47,7 @@
3547
}
3648

3749
.jumps-buttons-calls {
38-
background-color: var(--secondary-color);
50+
background-image: var(--secondary-color);
3951
color: var(--on-secondary-color);
4052
border: 1px solid var(--shadow-secondary-color);
4153
font-size: var(--body-size-l);
@@ -46,7 +58,7 @@
4658
}
4759

4860
.jumps-box {
49-
background-color: var(--secondary-color);
61+
background-image: var(--secondary-color);
5062
color: var(--on-secondary-color);
5163
padding: var(--l);
5264
margin-left: var(--xl);
@@ -57,7 +69,6 @@
5769
}
5870

5971
.jumps-box h1 {
60-
background-color: var(--secondary-color);
6172
color: var(--on-secondary-color);
6273
padding-bottom: var(--m);
6374
font-size: var(--body-size-xl);
@@ -95,6 +106,7 @@
95106
cursor: pointer;
96107
overflow: hidden;
97108
outline: none;
109+
color: var(--secondary-color);
98110
margin-left: var(--m);
99111
}
100112

@@ -109,7 +121,8 @@
109121
font-size: var(--body-size-l);
110122
color: var(--on-secondary-color);
111123
justify-content: center;
112-
padding-top: var(--xl);
124+
padding: var(--xxl) var(--xl) var(--xl) var(--l);
125+
text-align: center;
113126
}
114127

115128
.logs-items {

0 commit comments

Comments
 (0)