before switching from sass to styled components

This commit is contained in:
2021-10-02 20:07:16 +02:00
parent 0dbb7f8528
commit ad52fdb08f
20 changed files with 1041 additions and 90 deletions
+22 -65
View File
@@ -1,70 +1,27 @@
import "./App.sass"
import {
BrowserRouter as Router,
Switch,
Route,
Link
} from "react-router-dom";
import {CreateUserWidget, RecentActivityWidget, SystemStatusWidget} from './components'
import {AccountManager, AdminUI, Logger} from './views'
function App() {
return (
<>
<div id="header">
<h1>Doorlock Systems</h1>
<div id="header__search"><input id="header__search__input" type="text" placeholder="..."></input><button>Search</button></div>
<div id="header__menu">
<ul>
<li><a>User Settings</a></li>
<li><a>Logout</a></li>
</ul>
</div>
</div>
<div id="menu">
<h3>Menu</h3>
<ul>
<li><a className="menu__active">Status</a></li>
<li><a>Account</a></li>
<li><a>Log</a></li>
<li><a>Backup</a></li>
<li><a>Admin</a></li>
</ul>
</div>
<div id="main">
<div className="main__card">
<h4>Add User</h4>
<hr />
<p>Add new user</p>
<p><label>First Name</label><input type="text"></input></p>
<p><label>Last Name</label><input type="text"></input></p>
<p><label>PIN</label><input type="text"></input></p>
<p><label>RFID</label><input type="text"></input><button>Scan</button></p>
<p><label>Expire Date</label><input type="date"></input></p>
<button>Add</button>
</div>
<div className="main__card">
<h4>Recent Activity</h4>
<hr />
<table>
<thead>
<tr>
<td>Name</td>
<td>Method</td>
<td>Time</td>
</tr>
</thead>
<tbody>
<tr>
<td>Max Mustermann</td>
<td>RFID</td>
<td>1.10.2020 08:30</td>
</tr>
</tbody>
</table>
</div>
<div className="main__card">
<h4>System Status</h4>
<hr />
<p>Uptime: since 3days 15hours</p>
<p>LastDB Update: before 7hours</p>
<p>Last administrator login: Admin (12.9.2021 09:30)</p>
</div>
</div>
<div id="footer">Footer</div>
</>
<Router>
<AdminUI>
<Switch>
<Route path="/" exact>
<CreateUserWidget />
<RecentActivityWidget />
<SystemStatusWidget />
</Route>
<Route path="/accounts">
<AccountManager/>
</Route>
</Switch>
</AdminUI>
</Router>
);
}
+1
View File
@@ -0,0 +1 @@
/* No CSS *//*# sourceMappingURL=Card.css.map */
+9
View File
@@ -0,0 +1,9 @@
{
"version": 3,
"mappings": "",
"sources": [
"Card.sass"
],
"names": [],
"file": "Card.css"
}
+21
View File
@@ -0,0 +1,21 @@
import React from 'react'
import styled from 'styled-components'
import { theme } from '../theme';
const CardDiv = styled.div`
flex-grow: 1;
color: ${theme.color6};
background: ${theme.color1};
border-radius: 1em;
padding: 1em;
margin: 1em;
h4 {
margin: 0;
}
`;
export default function Card({children}) {
return (
<CardDiv theme={theme}>
{children}
</CardDiv>
)
}
+74
View File
@@ -0,0 +1,74 @@
.main
&__card
flex-grow: 1
color: $color6
background: $color1
border-radius: 1em
padding: 1em
margin: 1em
h4
margin: 0
&__input
padding: 1em .2em .1em 0.2em
display: inline-block
flex-grow: 1
with: auto
z-index: 1
border: none
background: none
outline: none
font-size: 1em
&__box
font-size: 1.1em
overflow: hidden
position: relative
margin: 0.2em 0
display: flex
flex-direction: row
align-items: stretch
background: $color6
border-bottom: .3em solid $color5
&:hover
border-bottom: .3em solid $color3
outline: auto
>button
position: relative
background: $color2
color: $color6
border: none
font-size: 0.8em
font-weight: bold
padding: 0 .5em
transition: ease all 300ms
z-index: 1
&::before
position: absolute
display: block
content: ''
clip-path: polygon(0% 0%, 100% 100%, 0% 100%)
transform: translateX(-90%) rotate(45deg)
height: 1em
width: 1em
background: $color2
transition: ease all 300ms
&:hover
background: $color3
&::before
background: $color3
transform: translateX(-90%) rotate(45deg) scale(1.2)
&__label
padding: 0
color: $color2
z-index: 0
position: absolute
left: 0.2em
padding-bottom: 0.2em
bottom: 0
transition: all ease-in-out 350ms
&:focus + &__label, &:not(:placeholder-shown) + &__label
color: $color5
font-size: 0.7em
transform: translateY(0)
bottom: 50%
font-weight: bold
+22
View File
@@ -0,0 +1,22 @@
import React, { Component } from 'react'
import TextInput from './TextInput'
export class CreateUserWidget extends Component {
render() {
return (
<div className="main__card">
<h4>Add User</h4>
<hr />
<p>Add new user</p>
<div className="main__card__input__box"><input id="main__card__input__box__0" placeholder=" " type="text" className="main__card__input"></input><label for="main__card__input__box__0" className="main__card__input__label">First Name</label></div>
<div className="main__card__input__box"><input id="main__card__input__box__1" placeholder=" " type="text" className="main__card__input"></input><label for="main__card__input__box__1" className="main__card__input__label">Last Name</label></div>
<div className="main__card__input__box"><input id="main__card__input__box__2" placeholder=" " type="text" className="main__card__input"></input><label for="main__card__input__box__2" className="main__card__input__label">PIN</label></div>
<div className="main__card__input__box"><input id="main__card__input__box__3" placeholder=" " type="text" className="main__card__input"></input><label for="main__card__input__box__3" className="main__card__input__label">RFID</label><button>Scan</button></div>
<TextInput/>
<div className="main__card__input__box"><input id="main__card__input__box__4" placeholder=" " type="date" className="main__card__input"></input><label for="main__card__input__box__4" className="main__card__input__label">Expire Date</label></div>
<button>Add</button>
</div>
)
}
}
export default CreateUserWidget
@@ -0,0 +1,30 @@
import React, { Component } from 'react'
export class RecentActivityWidget extends Component {
render() {
return (
<div className="main__card">
<h4>Recent Activity</h4>
<hr />
<table>
<thead>
<tr>
<td>Name</td>
<td>Method</td>
<td>Time</td>
</tr>
</thead>
<tbody>
<tr>
<td>Max Mustermann</td>
<td>RFID</td>
<td>1.10.2020 08:30</td>
</tr>
</tbody>
</table>
</div>
)
}
}
export default RecentActivityWidget
+17
View File
@@ -0,0 +1,17 @@
import React, { Component } from 'react'
import Card from './Card'
export class SystemStatusWidget extends Component {
render() {
return (
<Card>
<h4>System Status</h4>
<hr />
<p>Uptime: since 3days 15hours</p>
<p>LastDB Update: before 7hours</p>
<p>Last administrator login: Admin (12.9.2021 09:30)</p>
</Card>
)
}
}
export default SystemStatusWidget
+36
View File
@@ -0,0 +1,36 @@
import React, { Component } from 'react'
import styled from 'styled-components'
import { theme } from '../theme'
const InputWrapper = styled.div`
font-size: 1.1em;
overflow: hidden;
position: relative;
margin: 0.2em 0;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-orient: horizontal;
-webkit-box-direction: normal;
-ms-flex-direction: row;
flex-direction: row;
-webkit-box-align: stretch;
-ms-flex-align: stretch;
align-items: stretch;
background: #ddd9ebbf;
border-bottom: 0.3em solid #490428c6;
`;
export class TextInput extends Component {
render() {
return (
<InputWrapper>
<input id="main__card__input__box__3" placeholder=" " type="text" className="main__card__input"></input>
<label for="main__card__input__box__3" className="main__card__input__label">RFID</label>
<button>Scan</button>
</InputWrapper>
)
}
}
export default TextInput
+4
View File
@@ -0,0 +1,4 @@
import CreateUserWidget from "./CreateUserWidget";
import RecentActivityWidget from "./RecentActivityWidget";
import SystemStatusWidget from "./SystemStatusWidget";
export { CreateUserWidget, RecentActivityWidget, SystemStatusWidget }
+10
View File
@@ -0,0 +1,10 @@
const theme = {
color1: "#1F1E2E",
color2: "#27283A",
color3: "#438AF4",
color4: "rgba(2,0,36,0.7455182756696428)",
color5: "#490428c6",
color6: "#ddd9ebbf",
}
export {theme}
+15
View File
@@ -0,0 +1,15 @@
import React, { Component } from 'react'
import Card from '../components/Card'
export class AccountManager extends Component {
render() {
return (
<Card>
<h4>Account Manager</h4>
<hr/>
Hello World
</Card>
)
}
}
export default AccountManager
+444
View File
@@ -0,0 +1,444 @@
* {
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
html, body {
margin: 0;
}
#root {
min-height: 100vh;
display: -ms-grid;
display: grid;
-ms-grid-columns: auto 1fr auto;
grid-template-columns: auto 1fr auto;
-ms-grid-rows: auto 1fr 2em;
grid-template-rows: auto 1fr 2em;
grid-template-areas: "header header header" " menu main ." "footer footer footer";
background: #27283A;
overflow: auto;
}
#header {
position: relative;
-ms-grid-row: 1;
-ms-grid-column: 1;
-ms-grid-column-span: 3;
grid-area: header;
display: -webkit-inline-box;
display: -ms-inline-flexbox;
display: inline-flex;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
-webkit-box-orient: horizontal;
-webkit-box-direction: normal;
-ms-flex-direction: row;
flex-direction: row;
min-height: auto;
padding: .5em;
-webkit-box-pack: end;
-ms-flex-pack: end;
justify-content: flex-end;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
background: #1F1E2E;
color: #ddd9ebbf;
}
#header h1 {
-ms-flex-wrap: nowrap;
flex-wrap: nowrap;
white-space: nowrap;
display: -webkit-inline-box;
display: -ms-inline-flexbox;
display: inline-flex;
font-size: 1.5em;
}
#header::after {
-ms-grid-column-align: start;
justify-self: start;
position: absolute;
display: block;
content: '';
left: 0;
right: 0;
top: 100%;
background: #438AF4;
height: .1em;
}
#header__search {
margin: .5em;
border-radius: .5rem;
display: -webkit-inline-box;
display: -ms-inline-flexbox;
display: inline-flex;
white-space: nowrap;
margin-left: auto;
-webkit-transition: ease-in-out all 500ms;
transition: ease-in-out all 500ms;
-webkit-box-flex: 0;
-ms-flex-positive: 0;
flex-grow: 0;
max-width: 20em;
}
#header__search:hover {
-webkit-box-shadow: 0 0 1em #438AF4;
box-shadow: 0 0 1em #438AF4;
-webkit-box-flex: 1;
-ms-flex-positive: 1;
flex-grow: 1;
}
#header__search:hover__input {
-webkit-box-flex: 1;
-ms-flex-positive: 1;
flex-grow: 1;
}
#header__search__input {
height: 2rem;
-webkit-transition: ease all 500ms;
transition: ease all 500ms;
border-radius: .5rem 0 0 .5rem;
display: -webkit-inline-box;
display: -ms-inline-flexbox;
display: inline-flex;
background: #438AF4;
border: none;
outline: none;
color: #ddd9ebbf;
-webkit-box-flex: 0;
-ms-flex-positive: 0;
flex-grow: 0;
margin-left: auto;
width: 100%;
-webkit-box-shadow: 0 0 0.2em #490428c6;
box-shadow: 0 0 0.2em #490428c6;
padding: .5em;
}
#header__search__input:hover, #header__search__input:not(:placeholder-shown) {
-webkit-transition: ease all 500ms;
transition: ease all 500ms;
-webkit-box-flex: 1;
-ms-flex-positive: 1;
flex-grow: 1;
}
#header__search__input + button {
height: 2rem;
border: none;
color: #ddd9ebbf;
border-radius: 0 .5rem .5rem 0;
display: -webkit-inline-box;
display: -ms-inline-flexbox;
display: inline-flex;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
background: #27283A;
font-size: 1em;
border: 0.1rem inset #438AF4;
border-style: solid;
padding: .5em;
}
#header__search__input + button:hover {
background: #ddd9ebbf;
color: #438AF4;
}
#header__menu {
display: -webkit-inline-box;
display: -ms-inline-flexbox;
display: inline-flex;
-ms-flex-wrap: nowrap;
flex-wrap: nowrap;
-ms-flex-negative: 1;
flex-shrink: 1;
}
#header__menu ul {
list-style: none;
padding: 0;
}
#header__menu ul li {
display: inline;
}
#header__menu ul li a {
text-decoration: none;
color: #ddd9ebbf;
padding: .5em;
white-space: nowrap;
}
#header__menu ul li a:hover {
color: #438AF4;
}
#menu {
-ms-grid-row: 2;
-ms-grid-column: 1;
grid-area: menu;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
min-height: 100;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
-ms-flex-direction: column;
flex-direction: column;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
background: #1F1E2E;
padding: .5em 0;
overflow: visible;
}
#menu h3 {
margin: 0;
color: #ddd9ebbf;
-webkit-text-decoration: bold;
text-decoration: bold;
}
#menu ul {
list-style: none;
padding-left: 0;
margin: .4em 0;
}
#menu ul a {
position: relative;
display: block;
text-decoration: none;
margin-left: .4em;
color: #ddd9ebbf;
padding: .3em .5em;
font-size: 1.05em;
-webkit-transition: ease all 500ms;
transition: ease all 500ms;
}
#menu ul a::after {
-webkit-transition: ease all 500ms;
transition: ease all 500ms;
position: absolute;
top: 0;
bottom: 0;
right: 100%;
width: 0em;
content: '';
background: #ddd9ebbf;
}
#menu ul a:hover {
background: #438AF4;
}
#menu ul a:hover::after {
width: 0.4em;
}
#menu ul a.menu__active {
color: #438AF4;
}
#menu ul a.menu__active::after {
width: 0.4em;
background: #27283A;
}
#menu ul a.menu__active:hover {
color: #fff;
}
#menu ul a.menu__active:hover::after {
width: 0.4em;
background: #ddd9ebbf;
}
#main {
position: relative;
-ms-grid-row: 2;
-ms-grid-column: 2;
grid-area: main;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-ms-flex-line-pack: start;
align-content: flex-start;
-webkit-box-align: start;
-ms-flex-align: start;
align-items: flex-start;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
padding: 1em;
border-top-left-radius: 1em;
}
.main__card {
-webkit-box-flex: 1;
-ms-flex-positive: 1;
flex-grow: 1;
color: #ddd9ebbf;
background: #1F1E2E;
border-radius: 1em;
padding: 1em;
margin: 1em;
}
.main__card h4 {
margin: 0;
}
.main__card__input {
padding: 1em .2em .1em 0.2em;
display: inline-block;
-webkit-box-flex: 1;
-ms-flex-positive: 1;
flex-grow: 1;
with: auto;
z-index: 1;
border: none;
background: none;
outline: none;
font-size: 1em;
}
.main__card__input__box {
font-size: 1.1em;
overflow: hidden;
position: relative;
margin: 0.2em 0;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-orient: horizontal;
-webkit-box-direction: normal;
-ms-flex-direction: row;
flex-direction: row;
-webkit-box-align: stretch;
-ms-flex-align: stretch;
align-items: stretch;
background: #ddd9ebbf;
border-bottom: 0.3em solid #490428c6;
}
.main__card__input__box:hover {
border-bottom: 0.3em solid #438AF4;
outline: auto;
}
.main__card__input__box > button {
position: relative;
background: #27283A;
color: #ddd9ebbf;
border: none;
font-size: 0.8em;
font-weight: bold;
padding: 0 .5em;
-webkit-transition: ease all 300ms;
transition: ease all 300ms;
z-index: 1;
}
.main__card__input__box > button::before {
position: absolute;
display: block;
content: '';
-webkit-clip-path: polygon(0% 0%, 100% 100%, 0% 100%);
clip-path: polygon(0% 0%, 100% 100%, 0% 100%);
-webkit-transform: translateX(-90%) rotate(45deg);
transform: translateX(-90%) rotate(45deg);
height: 1em;
width: 1em;
background: #27283A;
-webkit-transition: ease all 300ms;
transition: ease all 300ms;
}
.main__card__input__box > button:hover {
background: #438AF4;
}
.main__card__input__box > button:hover::before {
background: #438AF4;
-webkit-transform: translateX(-90%) rotate(45deg) scale(1.2);
transform: translateX(-90%) rotate(45deg) scale(1.2);
}
.main__card__input__label {
padding: 0;
color: #27283A;
z-index: 0;
position: absolute;
left: 0.2em;
padding-bottom: 0.2em;
bottom: 0;
-webkit-transition: all ease-in-out 350ms;
transition: all ease-in-out 350ms;
}
.main__card__input:focus + .main__card__input__label, .main__card__input:not(:placeholder-shown) + .main__card__input__label {
color: #490428c6;
font-size: 0.7em;
-webkit-transform: translateY(0);
transform: translateY(0);
bottom: 50%;
font-weight: bold;
}
#footer {
position: relative;
-ms-grid-row: 3;
-ms-grid-column: 1;
-ms-grid-column-span: 3;
grid-area: footer;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
color: #ffffff67;
text-transform: uppercase;
}
#footer::after {
position: absolute;
left: 0;
right: 0;
bottom: 0;
height: 2em;
widht: 100vw;
opacity: 0.5;
background: #000;
background: -webkit-gradient(linear, left top, right top, from(#27283A), color-stop(#110d13), color-stop(50%, #490428c6), color-stop(65%, rgba(2, 0, 36, 0.745518)), to(#1F1E2E));
background: linear-gradient(90deg, #27283A 0%, #110d13, #490428c6 50%, rgba(2, 0, 36, 0.745518) 65%, #1F1E2E 100%);
content: '';
}
#footer::before {
position: absolute;
left: 0;
right: 0;
bottom: 100%;
height: .2em;
opacity: 0.5;
content: '';
background: -webkit-gradient(linear, left top, left bottom, from(#27283A), to(#438AF4));
background: linear-gradient(#27283A, #438AF4);
}
/*# sourceMappingURL=AdminUI.css.map */
File diff suppressed because one or more lines are too long
+39
View File
@@ -0,0 +1,39 @@
import React, { Component } from 'react'
import "./AdminUI.sass"
import {Link, NavLink} from 'react-router-dom'
export class AdminUI extends Component {
render() {
const children = this.props.children;
return (
<>
<div id="header">
<h1>Doorlock Systems</h1>
<div id="header__search"><input id="header__search__input" type="text" placeholder="..."></input><button>Search</button></div>
<div id="header__menu">
<ul>
<li><Link to="/user_cp">User Settings</Link></li>
<li><Link to="/logout">Logout</Link></li>
</ul>
</div>
</div>
<div id="menu">
<h3>Menu</h3>
<ul>
<li><NavLink activeClassName="menu__active" exact to="/">Status</NavLink></li>
<li><NavLink activeClassName="menu__active" to="/accounts">Account</NavLink></li>
<li><NavLink activeClassName="menu__active" to="/log">Log</NavLink></li>
<li><NavLink activeClassName="menu__active" to="/backup">Backup</NavLink></li>
<li><NavLink activeClassName="menu__active" to="/admin">Admin</NavLink></li>
</ul>
</div>
<div id="main">
{children}
</div>
<div id="footer">Footer</div>
</>
)
}
}
export default AdminUI
+95 -18
View File
@@ -2,7 +2,7 @@ $color1: #1F1E2E
$color2: #27283A
$color3: #438AF4
$color4: rgba(2,0,36,0.7455182756696428)
$color5: rgba(43,2,23,0.7763306005996149)
$color5: #490428c6
$color6: #ddd9ebbf
*
box-sizing: border-box
@@ -25,11 +25,11 @@ html, body
flex-direction: row
min-height: auto
padding: .5em
justify-content: space-between
justify-content: flex-end
align-items: center
background: $color1
color: $color6
h1
flex-wrap: nowrap
white-space: nowrap
@@ -48,26 +48,31 @@ html, body
&__search
margin: 1em
position: relative
margin: .5em
border-radius: .5rem
display: inline-flex
white-space: nowrap
margin-left: auto
transition: ease all 500ms
&:hover
transition: ease-in-out all 500ms
flex-grow: 0
max-width: 20em
&:hover
box-shadow: 0 0 1em $color3
flex-grow: 1
&__input
flex-grow: 1
&__input
height: 2rem
transition: ease all 500ms
border-radius: .5rem 0 0 .5rem
display: flex
display: inline-flex
background: $color3
border: none
outline: none
color: $color6
flex-grow: 0
margin-left: auto
max-width: 50%
width: 100%
box-shadow: 0 0 .2em $color5
padding: .5em
&:hover, &:not(:placeholder-shown)
@@ -78,7 +83,7 @@ html, body
border: none
color: $color6
border-radius: 0 .5rem .5rem 0
display: flex
display: inline-flex
align-items: center
background: $color2
font-size: 1em
@@ -98,8 +103,12 @@ html, body
li
display: inline
a
text-decoration: none
color: $color6
padding: .5em
white-space: nowrap
&:hover
color: $color3
#menu
grid-area: menu
display: flex
@@ -153,20 +162,88 @@ html, body
background: $color6
#main
position: relative
grid-area: main
display: flex
align-content: flex-start
align-items: flex-start
flex-wrap: wrap
padding: 1em
border-top-left-radius: 1em
.main
&__card
.main
&__card
flex-grow: 1
color: $color6
background: $color1
border-radius: 1em
padding: 1em
margin: 1em
h4
margin: 0
&__input
padding: 1em .2em .1em 0.2em
display: inline-block
flex-grow: 1
background: $color6
border-radius: 1em
padding: 1em
margin: 1em
h4
margin: 0
with: auto
z-index: 1
border: none
background: none
outline: none
font-size: 1em
&__box
font-size: 1.1em
overflow: hidden
position: relative
margin: 0.2em 0
display: flex
flex-direction: row
align-items: stretch
background: $color6
border-bottom: .3em solid $color5
&:hover
border-bottom: .3em solid $color3
outline: auto
>button
position: relative
background: $color2
color: $color6
border: none
font-size: 0.8em
font-weight: bold
padding: 0 .5em
transition: ease all 300ms
z-index: 1
&::before
position: absolute
display: block
content: ''
clip-path: polygon(0% 0%, 100% 100%, 0% 100%)
transform: translateX(-90%) rotate(45deg)
height: 1em
width: 1em
background: $color2
transition: ease all 300ms
&:hover
background: $color3
&::before
background: $color3
transform: translateX(-90%) rotate(45deg) scale(1.2)
&__label
padding: 0
color: $color2
z-index: 0
position: absolute
left: 0.2em
padding-bottom: 0.2em
bottom: 0
transition: all ease-in-out 350ms
&:focus + &__label, &:not(:placeholder-shown) + &__label
color: $color5
font-size: 0.7em
transform: translateY(0)
bottom: 50%
font-weight: bold
#footer
position: relative
grid-area: footer
+15
View File
@@ -0,0 +1,15 @@
import React, { Component } from 'react'
export class Logger extends Component {
render() {
return (
<div>
<div className="main__card">
</div>
</div>
)
}
}
export default Logger
+4
View File
@@ -0,0 +1,4 @@
import Logger from "./Logger";
import AdminUI from "./AdminUI";
import AccountManager from "./AccountManager";
export {AccountManager, AdminUI, Logger}