Theme changing. Simple routing
This commit is contained in:
parent
573814ddac
commit
765418d3d2
19 changed files with 378 additions and 59 deletions
130
client/package-lock.json
generated
130
client/package-lock.json
generated
|
@ -1805,6 +1805,16 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"@mdi/js": {
|
||||
"version": "5.9.55",
|
||||
"resolved": "https://registry.npmjs.org/@mdi/js/-/js-5.9.55.tgz",
|
||||
"integrity": "sha512-BbeHMgeK2/vjdJIRnx12wvQ6s8xAYfvMmEAVsUx9b+7GiQGQ9Za8jpwp17dMKr9CgKRvemlAM4S7S3QOtEbp4A=="
|
||||
},
|
||||
"@mdi/react": {
|
||||
"version": "1.5.0",
|
||||
"resolved": "https://registry.npmjs.org/@mdi/react/-/react-1.5.0.tgz",
|
||||
"integrity": "sha512-NztRgUxSYD+ImaKN94Tg66VVVqXj4SmlDGzZoz48H9riJ+Awha56sfXH2fegw819NWo7KI3oeS1Es0lNQqwr0w=="
|
||||
},
|
||||
"@nodelib/fs.scandir": {
|
||||
"version": "2.1.4",
|
||||
"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.4.tgz",
|
||||
|
@ -2275,6 +2285,11 @@
|
|||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"@types/history": {
|
||||
"version": "4.7.8",
|
||||
"resolved": "https://registry.npmjs.org/@types/history/-/history-4.7.8.tgz",
|
||||
"integrity": "sha512-S78QIYirQcUoo6UJZx9CSP0O2ix9IaeAXwQi26Rhr/+mg7qqPy8TzaxHSUut7eGjL8WmLccT7/MXf304WjqHcA=="
|
||||
},
|
||||
"@types/html-minifier-terser": {
|
||||
"version": "5.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/html-minifier-terser/-/html-minifier-terser-5.1.1.tgz",
|
||||
|
@ -2373,6 +2388,25 @@
|
|||
"@types/react": "*"
|
||||
}
|
||||
},
|
||||
"@types/react-router": {
|
||||
"version": "5.1.14",
|
||||
"resolved": "https://registry.npmjs.org/@types/react-router/-/react-router-5.1.14.tgz",
|
||||
"integrity": "sha512-LAJpqYUaCTMT2anZheoidiIymt8MuX286zoVFPM3DVb23aQBH0mAkFvzpd4LKqiolV8bBtZWT5Qp7hClCNDENw==",
|
||||
"requires": {
|
||||
"@types/history": "*",
|
||||
"@types/react": "*"
|
||||
}
|
||||
},
|
||||
"@types/react-router-dom": {
|
||||
"version": "5.1.7",
|
||||
"resolved": "https://registry.npmjs.org/@types/react-router-dom/-/react-router-dom-5.1.7.tgz",
|
||||
"integrity": "sha512-D5mHD6TbdV/DNHYsnwBTv+y73ei+mMjrkGrla86HthE4/PVvL1J94Bu3qABU+COXzpL23T1EZapVVpwHuBXiUg==",
|
||||
"requires": {
|
||||
"@types/history": "*",
|
||||
"@types/react": "*",
|
||||
"@types/react-router": "*"
|
||||
}
|
||||
},
|
||||
"@types/resolve": {
|
||||
"version": "0.0.8",
|
||||
"resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-0.0.8.tgz",
|
||||
|
@ -7164,6 +7198,19 @@
|
|||
"resolved": "https://registry.npmjs.org/hex-color-regex/-/hex-color-regex-1.1.0.tgz",
|
||||
"integrity": "sha512-l9sfDFsuqtOqKDsQdqrMRk0U85RZc0RtOR9yPI7mRVOa4FsR/BVnZ0shmQRM96Ji99kYZP/7hn1cedc1+ApsTQ=="
|
||||
},
|
||||
"history": {
|
||||
"version": "4.10.1",
|
||||
"resolved": "https://registry.npmjs.org/history/-/history-4.10.1.tgz",
|
||||
"integrity": "sha512-36nwAD620w12kuzPAsyINPWJqlNbij+hpK1k9XRloDtym8mxzGYl2c17LnV6IAGB2Dmg4tEa7G7DlawS0+qjew==",
|
||||
"requires": {
|
||||
"@babel/runtime": "^7.1.2",
|
||||
"loose-envify": "^1.2.0",
|
||||
"resolve-pathname": "^3.0.0",
|
||||
"tiny-invariant": "^1.0.2",
|
||||
"tiny-warning": "^1.0.0",
|
||||
"value-equal": "^1.0.1"
|
||||
}
|
||||
},
|
||||
"hmac-drbg": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz",
|
||||
|
@ -7174,6 +7221,14 @@
|
|||
"minimalistic-crypto-utils": "^1.0.1"
|
||||
}
|
||||
},
|
||||
"hoist-non-react-statics": {
|
||||
"version": "3.3.2",
|
||||
"resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz",
|
||||
"integrity": "sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw==",
|
||||
"requires": {
|
||||
"react-is": "^16.7.0"
|
||||
}
|
||||
},
|
||||
"hoopy": {
|
||||
"version": "0.1.4",
|
||||
"resolved": "https://registry.npmjs.org/hoopy/-/hoopy-0.1.4.tgz",
|
||||
|
@ -10041,6 +10096,15 @@
|
|||
"resolved": "https://registry.npmjs.org/min-indent/-/min-indent-1.0.1.tgz",
|
||||
"integrity": "sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg=="
|
||||
},
|
||||
"mini-create-react-context": {
|
||||
"version": "0.4.1",
|
||||
"resolved": "https://registry.npmjs.org/mini-create-react-context/-/mini-create-react-context-0.4.1.tgz",
|
||||
"integrity": "sha512-YWCYEmd5CQeHGSAKrYvXgmzzkrvssZcuuQDDeqkT+PziKGMgE+0MCCtcKbROzocGBG1meBLl2FotlRwf4gAzbQ==",
|
||||
"requires": {
|
||||
"@babel/runtime": "^7.12.1",
|
||||
"tiny-warning": "^1.0.3"
|
||||
}
|
||||
},
|
||||
"mini-css-extract-plugin": {
|
||||
"version": "0.11.3",
|
||||
"resolved": "https://registry.npmjs.org/mini-css-extract-plugin/-/mini-css-extract-plugin-0.11.3.tgz",
|
||||
|
@ -12482,6 +12546,52 @@
|
|||
"resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.8.3.tgz",
|
||||
"integrity": "sha512-X8jZHc7nCMjaCqoU+V2I0cOhNW+QMBwSUkeXnTi8IPe6zaRWfn60ZzvFDZqWPfmSJfjub7dDW1SP0jaHWLu/hg=="
|
||||
},
|
||||
"react-router": {
|
||||
"version": "5.2.0",
|
||||
"resolved": "https://registry.npmjs.org/react-router/-/react-router-5.2.0.tgz",
|
||||
"integrity": "sha512-smz1DUuFHRKdcJC0jobGo8cVbhO3x50tCL4icacOlcwDOEQPq4TMqwx3sY1TP+DvtTgz4nm3thuo7A+BK2U0Dw==",
|
||||
"requires": {
|
||||
"@babel/runtime": "^7.1.2",
|
||||
"history": "^4.9.0",
|
||||
"hoist-non-react-statics": "^3.1.0",
|
||||
"loose-envify": "^1.3.1",
|
||||
"mini-create-react-context": "^0.4.0",
|
||||
"path-to-regexp": "^1.7.0",
|
||||
"prop-types": "^15.6.2",
|
||||
"react-is": "^16.6.0",
|
||||
"tiny-invariant": "^1.0.2",
|
||||
"tiny-warning": "^1.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"isarray": {
|
||||
"version": "0.0.1",
|
||||
"resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
|
||||
"integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8="
|
||||
},
|
||||
"path-to-regexp": {
|
||||
"version": "1.8.0",
|
||||
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.8.0.tgz",
|
||||
"integrity": "sha512-n43JRhlUKUAlibEJhPeir1ncUID16QnEjNpwzNdO3Lm4ywrBpBZ5oLD0I6br9evr1Y9JTqwRtAh7JLoOzAQdVA==",
|
||||
"requires": {
|
||||
"isarray": "0.0.1"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"react-router-dom": {
|
||||
"version": "5.2.0",
|
||||
"resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-5.2.0.tgz",
|
||||
"integrity": "sha512-gxAmfylo2QUjcwxI63RhQ5G85Qqt4voZpUXSEqCwykV0baaOTQDR1f0PmY8AELqIyVc0NEZUj0Gov5lNGcXgsA==",
|
||||
"requires": {
|
||||
"@babel/runtime": "^7.1.2",
|
||||
"history": "^4.9.0",
|
||||
"loose-envify": "^1.3.1",
|
||||
"prop-types": "^15.6.2",
|
||||
"react-router": "5.2.0",
|
||||
"tiny-invariant": "^1.0.2",
|
||||
"tiny-warning": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"react-scripts": {
|
||||
"version": "4.0.3",
|
||||
"resolved": "https://registry.npmjs.org/react-scripts/-/react-scripts-4.0.3.tgz",
|
||||
|
@ -12918,6 +13028,11 @@
|
|||
"resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz",
|
||||
"integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g=="
|
||||
},
|
||||
"resolve-pathname": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/resolve-pathname/-/resolve-pathname-3.0.0.tgz",
|
||||
"integrity": "sha512-C7rARubxI8bXFNB/hqcp/4iUeIXJhJZvFPFPiSPRnhU5UPxzMFIl+2E6yY6c4k9giDJAhtV+enfA+G89N6Csng=="
|
||||
},
|
||||
"resolve-url": {
|
||||
"version": "0.2.1",
|
||||
"resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz",
|
||||
|
@ -14569,6 +14684,16 @@
|
|||
"resolved": "https://registry.npmjs.org/timsort/-/timsort-0.3.0.tgz",
|
||||
"integrity": "sha1-QFQRqOfmM5/mTbmiNN4R3DHgK9Q="
|
||||
},
|
||||
"tiny-invariant": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/tiny-invariant/-/tiny-invariant-1.1.0.tgz",
|
||||
"integrity": "sha512-ytxQvrb1cPc9WBEI/HSeYYoGD0kWnGEOR8RY6KomWLBVhqz0RgTwVO9dLrGz7dC+nN9llyI7OKAgRq8Vq4ZBSw=="
|
||||
},
|
||||
"tiny-warning": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/tiny-warning/-/tiny-warning-1.0.3.tgz",
|
||||
"integrity": "sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA=="
|
||||
},
|
||||
"tmpl": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.4.tgz",
|
||||
|
@ -15047,6 +15172,11 @@
|
|||
"spdx-expression-parse": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"value-equal": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/value-equal/-/value-equal-1.0.1.tgz",
|
||||
"integrity": "sha512-NOJ6JZCAWr0zlxZt+xqCHNTEKOsrks2HQd4MqhP1qy4z1SkbEP467eNx6TgDKXMvUOb+OENfJCZwM+16n7fRfw=="
|
||||
},
|
||||
"vary": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@mdi/js": "^5.9.55",
|
||||
"@mdi/react": "^1.5.0",
|
||||
"@testing-library/jest-dom": "^5.12.0",
|
||||
"@testing-library/react": "^11.2.6",
|
||||
"@testing-library/user-event": "^12.8.3",
|
||||
|
@ -10,8 +12,10 @@
|
|||
"@types/node": "^12.20.12",
|
||||
"@types/react": "^17.0.5",
|
||||
"@types/react-dom": "^17.0.3",
|
||||
"@types/react-router-dom": "^5.1.7",
|
||||
"react": "^17.0.2",
|
||||
"react-dom": "^17.0.2",
|
||||
"react-router-dom": "^5.2.0",
|
||||
"react-scripts": "4.0.3",
|
||||
"typescript": "^4.2.4",
|
||||
"web-vitals": "^1.1.2"
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
.App {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.App-logo {
|
||||
height: 40vmin;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: no-preference) {
|
||||
.App-logo {
|
||||
animation: App-logo-spin infinite 20s linear;
|
||||
}
|
||||
}
|
||||
|
||||
.App-header {
|
||||
background-color: #282c34;
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: calc(10px + 2vmin);
|
||||
color: white;
|
||||
}
|
||||
|
||||
.App-link {
|
||||
color: #61dafb;
|
||||
}
|
||||
|
||||
@keyframes App-logo-spin {
|
||||
from {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
19
client/src/App.module.css
Normal file
19
client/src/App.module.css
Normal file
|
@ -0,0 +1,19 @@
|
|||
.SettingsButton {
|
||||
width: 35px;
|
||||
height: 35px;
|
||||
background-color: var(--color-accent);
|
||||
border-radius: 50%;
|
||||
position: absolute;
|
||||
bottom: 10px;
|
||||
left: 10px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
opacity: 0.25;
|
||||
transition: all 0.3s;
|
||||
}
|
||||
|
||||
.SettingsButton:hover {
|
||||
cursor: pointer;
|
||||
opacity: 1;
|
||||
}
|
|
@ -1,10 +1,23 @@
|
|||
import './App.css';
|
||||
import Themer from './components/Themer/Themer';
|
||||
import { BrowserRouter, Route, Switch, Link } from 'react-router-dom';
|
||||
|
||||
import classes from './App.module.css';
|
||||
|
||||
import Apps from './components/Apps/Apps';
|
||||
import Settings from './components/Settings/Settings';
|
||||
|
||||
import Icon from './components/UI/Icon/Icon';
|
||||
|
||||
const App = (): JSX.Element => {
|
||||
return (
|
||||
<Themer />
|
||||
<BrowserRouter>
|
||||
<Switch>
|
||||
<Route exact path='/' component={Apps} />
|
||||
<Route exact path='/settings' component={Settings} />
|
||||
</Switch>
|
||||
<Link to='/settings' className={classes.SettingsButton}>
|
||||
<Icon icon='mdiCog' />
|
||||
</Link>
|
||||
</BrowserRouter>
|
||||
);
|
||||
}
|
||||
|
||||
|
|
0
client/src/components/Apps/Apps.module.css
Normal file
0
client/src/components/Apps/Apps.module.css
Normal file
17
client/src/components/Apps/Apps.tsx
Normal file
17
client/src/components/Apps/Apps.tsx
Normal file
|
@ -0,0 +1,17 @@
|
|||
import { Link } from 'react-router-dom';
|
||||
|
||||
import classes from './Apps.module.css';
|
||||
|
||||
import { Container } from '../UI/Layout/Layout';
|
||||
import Headline from '../UI/Headline/Headline';
|
||||
|
||||
const Apps = (): JSX.Element => {
|
||||
return (
|
||||
<Container>
|
||||
<Headline title='Welcome' />
|
||||
<Link to='/settings'>settings</Link>
|
||||
</Container>
|
||||
)
|
||||
}
|
||||
|
||||
export default Apps;
|
15
client/src/components/Settings/Settings.tsx
Normal file
15
client/src/components/Settings/Settings.tsx
Normal file
|
@ -0,0 +1,15 @@
|
|||
import { Link } from 'react-router-dom';
|
||||
|
||||
import Themer from '../Themer/Themer';
|
||||
|
||||
const Settings = (): JSX.Element => {
|
||||
return (
|
||||
<div>
|
||||
<h1>settings</h1>
|
||||
<Link to='/'>Home</Link>
|
||||
<Themer />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default Settings;
|
27
client/src/components/Themer/ThemePreview.module.css
Normal file
27
client/src/components/Themer/ThemePreview.module.css
Normal file
|
@ -0,0 +1,27 @@
|
|||
.ThemePreview {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.ThemePreview:hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.ThemePreview p {
|
||||
text-transform: capitalize;
|
||||
margin: 8px 0;
|
||||
/* align-self: flex-start; */
|
||||
}
|
||||
|
||||
.ColorsPreview {
|
||||
display: flex;
|
||||
border: 1px solid silver;
|
||||
}
|
||||
|
||||
.ColorPreview {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
}
|
|
@ -1,10 +1,29 @@
|
|||
import { Theme } from '../../interfaces/Theme';
|
||||
import classes from './ThemePreview.module.css';
|
||||
|
||||
const ThemePreview = (theme: Theme): JSX.Element => {
|
||||
interface ComponentProps {
|
||||
theme: Theme;
|
||||
applyTheme: Function;
|
||||
}
|
||||
|
||||
const ThemePreview = (props: ComponentProps): JSX.Element => {
|
||||
return (
|
||||
<div>
|
||||
<p>Theme: {theme.name}</p>
|
||||
<p>{theme.colors.background}</p>
|
||||
<div className={classes.ThemePreview} onClick={() => props.applyTheme(props.theme.name)}>
|
||||
<div className={classes.ColorsPreview}>
|
||||
<div
|
||||
className={classes.ColorPreview}
|
||||
style={{ backgroundColor: props.theme.colors.background }}
|
||||
></div>
|
||||
<div
|
||||
className={classes.ColorPreview}
|
||||
style={{ backgroundColor: props.theme.colors.primary }}
|
||||
></div>
|
||||
<div
|
||||
className={classes.ColorPreview}
|
||||
style={{ backgroundColor: props.theme.colors.accent }}
|
||||
></div>
|
||||
</div>
|
||||
<p>{props.theme.name}</p>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
|
12
client/src/components/Themer/Themer.module.css
Normal file
12
client/src/components/Themer/Themer.module.css
Normal file
|
@ -0,0 +1,12 @@
|
|||
.ThemerGrid {
|
||||
width: 100%;
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
grid-auto-rows: 100px;
|
||||
}
|
||||
|
||||
@media (min-width: 900px) {
|
||||
.ThemerGrid {
|
||||
grid-template-columns: 1fr 1fr 1fr;
|
||||
}
|
||||
}
|
|
@ -1,13 +1,44 @@
|
|||
import { useEffect } from 'react';
|
||||
|
||||
import classes from './Themer.module.css';
|
||||
|
||||
import { themes } from './themes.json';
|
||||
import { Theme } from '../../interfaces/Theme';
|
||||
import ThemePreview from './ThemePreview';
|
||||
import { Container } from '../UI/Layout/Layout';
|
||||
import Headline from '../UI/Headline/Headline';
|
||||
|
||||
const Themer = (): JSX.Element => {
|
||||
useEffect((): void => {
|
||||
if (localStorage.theme) {
|
||||
applyTheme(localStorage.theme);
|
||||
}
|
||||
}, []);
|
||||
|
||||
const applyTheme = (themeName: string): void => {
|
||||
const newTheme = themes.find((theme: Theme) => theme.name === themeName);
|
||||
|
||||
if (newTheme) {
|
||||
for (const [key, value] of Object.entries(newTheme.colors)) {
|
||||
document.body.style.setProperty(`--color-${key}`, value);
|
||||
}
|
||||
localStorage.setItem('theme', themeName);
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<div>
|
||||
<h1>Themes</h1>
|
||||
{themes.map((theme: Theme): JSX.Element => <ThemePreview name={theme.name} colors={theme.colors} />)}
|
||||
</div>
|
||||
<Container>
|
||||
<div>
|
||||
<Headline
|
||||
title='Themes'
|
||||
subtitle='Select new theme by clicking on it'
|
||||
/>
|
||||
<div className={classes.ThemerGrid}>
|
||||
{themes.map((theme: Theme): JSX.Element => <ThemePreview theme={theme} applyTheme={applyTheme} />)}
|
||||
</div>
|
||||
</div>
|
||||
</Container>
|
||||
|
||||
)
|
||||
}
|
||||
|
||||
|
|
7
client/src/components/UI/Headline/Headline.module.css
Normal file
7
client/src/components/UI/Headline/Headline.module.css
Normal file
|
@ -0,0 +1,7 @@
|
|||
.HeadlineTitle {
|
||||
color: var(--color-primary);
|
||||
}
|
||||
|
||||
.HeadlineSubtitle {
|
||||
color: var(--color-primary);
|
||||
}
|
18
client/src/components/UI/Headline/Headline.tsx
Normal file
18
client/src/components/UI/Headline/Headline.tsx
Normal file
|
@ -0,0 +1,18 @@
|
|||
import { Fragment } from 'react';
|
||||
import classes from './Headline.module.css';
|
||||
|
||||
interface ComponentProps {
|
||||
title: string;
|
||||
subtitle?: string;
|
||||
}
|
||||
|
||||
const Headline = (props: ComponentProps): JSX.Element => {
|
||||
return (
|
||||
<Fragment>
|
||||
<h2 className={classes.HeadlineTitle}>{props.title}</h2>
|
||||
{props.subtitle && <p className={classes.HeadlineSubtitle}>{props.subtitle}</p>}
|
||||
</Fragment>
|
||||
)
|
||||
}
|
||||
|
||||
export default Headline;
|
4
client/src/components/UI/Icon/Icon.module.css
Normal file
4
client/src/components/UI/Icon/Icon.module.css
Normal file
|
@ -0,0 +1,4 @@
|
|||
.Icon {
|
||||
color: var(--color-primary);
|
||||
width: 90%;
|
||||
}
|
25
client/src/components/UI/Icon/Icon.tsx
Normal file
25
client/src/components/UI/Icon/Icon.tsx
Normal file
|
@ -0,0 +1,25 @@
|
|||
import classes from './Icon.module.css';
|
||||
|
||||
import { Icon as MDIcon } from '@mdi/react';
|
||||
|
||||
interface ComponentProps {
|
||||
icon: string;
|
||||
}
|
||||
|
||||
const Icon = (props: ComponentProps): JSX.Element => {
|
||||
const MDIcons = require('@mdi/js');
|
||||
let iconPath = MDIcons[props.icon];
|
||||
|
||||
if (!iconPath) {
|
||||
console.log('icon not found');
|
||||
iconPath = MDIcons.mdiCancel;
|
||||
}
|
||||
|
||||
return (
|
||||
<MDIcon className={classes.Icon}
|
||||
path={iconPath}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
export default Icon;
|
4
client/src/components/UI/Layout/Layout.module.css
Normal file
4
client/src/components/UI/Layout/Layout.module.css
Normal file
|
@ -0,0 +1,4 @@
|
|||
.Container {
|
||||
width: 100%;
|
||||
padding: var(--space-p-x);
|
||||
}
|
9
client/src/components/UI/Layout/Layout.tsx
Normal file
9
client/src/components/UI/Layout/Layout.tsx
Normal file
|
@ -0,0 +1,9 @@
|
|||
import classes from './Layout.module.css';
|
||||
|
||||
export const Container = (props: any): JSX.Element => {
|
||||
return (
|
||||
<div className={classes.Container}>
|
||||
{props.children}
|
||||
</div>
|
||||
)
|
||||
}
|
|
@ -1,13 +1,16 @@
|
|||
body {
|
||||
* {
|
||||
margin: 0;
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
|
||||
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
|
||||
sans-serif;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
code {
|
||||
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
|
||||
monospace;
|
||||
}
|
||||
body {
|
||||
--color-background: #2B2C56;
|
||||
--color-primary: #EFF1FC;
|
||||
--color-accent: #6677EB;
|
||||
|
||||
--space-p-x: 16px;
|
||||
|
||||
background-color: var(--color-background);
|
||||
font-family: -apple-system, BlinkMacSystemFont, Helvetica Neue, Roboto, sans-serif;
|
||||
}
|
Loading…
Add table
Reference in a new issue