This commit is contained in:
Erik 2022-11-23 19:18:17 +02:00
commit 74b4c343ea
Signed by: Navy.gif
GPG Key ID: 811EC0CD80E7E5FB
15 changed files with 220 additions and 59 deletions

View File

@ -32,7 +32,7 @@ function App() {
return ( return (
<div className='app is-full-screen'> <div className='app is-full-screen'>
<header> <header className="card">
<UserControls /> <UserControls />
</header> </header>

View File

@ -1,6 +1,7 @@
import React from 'react'; import React from 'react';
import '../css/components/Sidebar.css'; import '../css/components/Sidebar.css';
import NavLink from '../structures/NavLink'; import NavLink from '../structures/NavLink';
import logoImg from '../img/logo.png';
const Sidebar = ({children}) => { const Sidebar = ({children}) => {
@ -15,6 +16,8 @@ const SidebarMenu = ({menuItems, children}) => {
let key = 0; let key = 0;
return <div className='sidebar-menu'> return <div className='sidebar-menu'>
<img className="sidebar-logo" src={logoImg}/>
<hr/>
{menuItems.map(link => { {menuItems.map(link => {
const { label, ...rest } = link; const { label, ...rest } = link;
return <NavLink activeClassName='active' className='sidebar-menu-item' key={key++} {...rest}>{ label}</NavLink>; return <NavLink activeClassName='active' className='sidebar-menu-item' key={key++} {...rest}>{ label}</NavLink>;

View File

@ -2,7 +2,7 @@ import React from "react";
export const TableListEntry = ({onClick, item, itemKeys}) => { export const TableListEntry = ({onClick, item, itemKeys}) => {
return <tr onClick={onClick} style={{cursor: 'pointer'}}> return <tr onClick={onClick}>
{itemKeys.map(key => <td key={key}>{item[key]}</td>)} {itemKeys.map(key => <td key={key}>{item[key]}</td>)}
</tr>; </tr>;
}; };
@ -10,7 +10,7 @@ export const TableListEntry = ({onClick, item, itemKeys}) => {
export const Table = ({headerItems, children, items, itemKeys, maxWidth = '30em'}) => { export const Table = ({headerItems, children, items, itemKeys, maxWidth = '30em'}) => {
let i = 0; let i = 0;
return <table className="striped" style={{ maxWidth, marginBottom: '10px' }}> return <table className="striped hover" style={{ maxWidth, marginBottom: '10px' }}>
<thead> <thead>
<tr> <tr>
{headerItems.map(item => <th key={item}>{item}</th>)} {headerItems.map(item => <th key={item}>{item}</th>)}

View File

@ -8,11 +8,17 @@ const UserControls = () => {
if (!user) return; if (!user) return;
return <div className='user-controls'> return <details className='dropdown user-controls'>
<div> <summary className="is-vertical-align">
Hello {user.displayName} Hello {user.displayName}
</div> <img className="profile-picture" src="https://cdn.discordapp.com/avatars/187613017733726210/ee764860975d78bfd52652c6ddaed47b.webp?size=64"></img>
</div>; </summary>
<div className="card">
<p><a href="#">Profile</a></p>
<hr/>
<p><a href="#" className="text-error">Logout</a></p>
</div>
</details>;
}; };

View File

@ -1,26 +1,26 @@
.app { .app {
background-color: var(--background-primary); background-color: var(--background-primary);
} }
header { header {
position: absolute; position: absolute;
right: 0; right: 15px;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
text-align: center; text-align: center;
height: 50px; height: 50px;
background-color: var(--background-tertiary); border-radius: 0px 0px 4px 4px !important;
} }
.background { .background {
display: flex; display: flex;
height: 100%; height: 100%;
width: 100%; width: 100%;
} }
.main-content { .main-content {
width: 100%; width: 100%;
height: 100%; height: 100%;
padding-right: 30px; padding: 0 15px;
background-color: var(--background-secondary); background-color: var(--background-secondary);
} }

View File

@ -1,7 +1,6 @@
.sidebar { .sidebar {
min-width: 200px; min-width: 200px;
height: 100%; height: 100%;
margin-right: 10px;
} }
.sidebar-menu { .sidebar-menu {
@ -9,6 +8,11 @@
flex-direction: column; flex-direction: column;
} }
.sidebar-logo{
margin: 1rem;
max-width: 170px;
}
.sidebar-menu-item { .sidebar-menu-item {
margin: 5px; margin: 5px;
margin-right: 10px; margin-right: 10px;
@ -19,7 +23,12 @@
text-decoration: none; text-decoration: none;
font-weight: bold; font-weight: bold;
} }
.sidebar-menu-item.active {
opacity: .75;
border-right: solid 3px var(--color-primary);
width: calc(100% + 15px);
border-radius: 0;
}
.active { .active {
background-color: var(--light-blue); background-color: var(--light-blue);
} }

View File

@ -1,3 +1,38 @@
.user-controls { .user-controls {
display: flex; display: flex;
cursor: pointer;
-webkit-user-select: none; /* Safari */
-ms-user-select: none; /* IE 10 and IE 11 */
user-select: none; /* Standard syntax */
}
.user-controls summary::marker{
display: none;
font-size: 0px;
}
.user-controls .profile-picture {
height: 30px;
width: 30px;
margin-left: 10px;
border-radius: 50%;
}
.user-controls.dropdown>:last-child {
right: 0;
margin-top: 15px;
box-shadow: unset;
filter: drop-shadow(0px 0px 4px #00000085);
transition: .25s transform ease;
}
.user-controls.dropdown>:last-child:before {
content: ' ';
border-left: 10px solid transparent;
border-right: 10px solid transparent;
border-bottom: 15px solid #343434;
position: absolute;
display: block;
right: 5px;
top: -10px;
} }

View File

@ -3,6 +3,7 @@
:root { :root {
--bg-color: #232323; --bg-color: #232323;
--bg-secondary-color: #343434; --bg-secondary-color: #343434;
--bg-tertiary-color: #45454545;
--color-primary: #2760aa; --color-primary: #2760aa;
--color-lightGrey: #d2d6dd; --color-lightGrey: #d2d6dd;
--color-grey: #ccc; --color-grey: #ccc;
@ -17,6 +18,59 @@
--font-family-mono: monaco, "Consolas", "Lucida Console", monospace; --font-family-mono: monaco, "Consolas", "Lucida Console", monospace;
} }
details[open] summary ~ * {
animation: sweep .15s ease-in-out;
}
@keyframes sweep {
0% {opacity: 0;}
100% {opacity: 1;}
}
.main-content .card{
padding: 1rem 2rem 2rem 2rem;
}
table.hover tbody tr{
cursor: pointer;
}
table.striped tr:nth-of-type(2n) {
background-color: var(--bg-tertiary-color);
}
.button, [type=button], [type=reset], [type=submit], button {
padding: 1rem;
}
.page-controls button{
min-width: 120px;
}
.page-controls p{
margin: 0;
}
.page-controls{
margin-top: 2rem;
}
td, th {
padding: 1.2rem;
}
h1, h2, h3, h4, h5, h6 {
margin: 0.35em 0 0.35em;
}
body{
line-height: 1.95;
}
.pageTitle{
margin: 0.7em 0 0.7em;
}
.flex { .flex {
display: flex; display: flex;
gap: 10px; gap: 10px;
@ -28,7 +82,6 @@ html {
ul { ul {
list-style-type: none; list-style-type: none;
/* padding: 0; */
} }
tbody tr:hover { tbody tr:hover {
@ -66,10 +119,6 @@ tbody tr:hover {
flex-direction: row; flex-direction: row;
} }
button{
margin: 0.35em 0 0.7em;
}
.flex-wrap{ .flex-wrap{
flex-wrap: wrap; flex-wrap: wrap;
} }

0
src/css/pages/Admin.css Normal file
View File

0
src/css/pages/Empty.css Normal file
View File

View File

@ -1,11 +1,52 @@
.user-page {
height: 100%;
}
.user-list {
height: 95%;
}
li input { li input {
margin: 0; margin: 0;
}
.tree li {
list-style-type: none;
margin: 2px 0 2px 2px;
position: relative;
}
.tree span *:hover{
cursor: pointer
}
.tree li:before {
content: "";
position: absolute;
top: 4px;
left: -20px;
border-left: 1px solid #ddd;
border-bottom: 1px solid #ddd;
width: 18px;
height: 15px;
}
.tree ul li:before{
top: -8px;
left: -20px;
width: 17px;
height: 28px;
}
.tree ul li:after{
top: 19px;
left: -20px;
width: 18px;
height: 100%;
}
.tree .groupName{
padding-top: 3px;
}
.tree li:after {
position: absolute;
content: "";
top: 18px;
left: -20px;
border-left: 1px solid #ddd;
border-top: 1px solid #ddd;
width: 18px;
height: 100%;
}
.tree li:last-child:after {
display: none;
}
.tree > li:first-child:before {
display: none;
} }

View File

@ -1,11 +1,13 @@
import React from "react"; import React from "react";
import '../css/pages/Admin.css';
const Admin = () => { const Admin = () => {
return <div> return <div className="user-page">
ADMIN <h4 className="pageTitle">Admin</h4>
<div className='card'>
</div>
</div>; </div>;
}; };
export default Admin; export default Admin;

13
src/pages/Empty.js Normal file
View File

@ -0,0 +1,13 @@
import React from "react";
import '../css/pages/Empty.css';
const Empty = () => {
return <div className="user-page">
<h4 className="pageTitle">Empty</h4>
<div className='card'>
</div>
</div>;
};
export default Empty;

View File

@ -3,10 +3,11 @@ import '../css/pages/Home.css';
const Home = () => { const Home = () => {
return <div className='home'> return <div className="user-page">
HOME <h4 className="pageTitle">Home</h4>
<div className='card'>
</div>
</div>; </div>;
}; };
export default Home; export default Home;

View File

@ -21,7 +21,9 @@ const PermissionGroup = ({ name, value }) => {
else elements.push(<Permission {...props} />); else elements.push(<Permission {...props} />);
} }
return <li> return <li>
<b>Group: {name}</b> <div className="groupName">
<b>Group: {name}</b>
</div>
<ul> <ul>
{elements} {elements}
</ul> </ul>
@ -54,7 +56,7 @@ const Permissions = ({ perms }) => {
return <div> return <div>
<h4>Permissions </h4> <h4>Permissions </h4>
<ul> <ul className="tree">
{elements} {elements}
</ul> </ul>
</div>; </div>;
@ -104,7 +106,7 @@ const User = ({ user }) => {
<div className="row"> <div className="row">
<div className="col-6"> <div className="col-6">
<div className="flex"> <div className="flex is-vertical-align">
<button className="button primary" onClick={() => { <button className="button primary" onClick={() => {
navigate(-1); navigate(-1);
}}>Back</button> }}>Back</button>
@ -212,9 +214,9 @@ const Users = () => {
</Table> </Table>
<div className='flex is-vertical-align page-controls'> <div className='flex is-vertical-align page-controls'>
<button className="col-1 button dark" onClick={() => setPage(page - 1 || 1)}>Previous</button> <button className="button dark" onClick={() => setPage(page - 1 || 1)}>Previous</button>
<p>Page: {page}</p> <p>Page: {page}</p>
<button className="col-1 button dark" onClick={() => { <button className="button dark" onClick={() => {
if (users.length === 10) setPage(page + 1); if (users.length === 10) setPage(page + 1);
}}>Next</button> }}>Next</button>
</div> </div>
@ -223,7 +225,7 @@ const Users = () => {
}; };
return <div className="user-page"> return <div className="user-page">
<p>USERS</p> <h4 className="pageTitle">Users</h4>
{error && <p>{error}</p>} {error && <p>{error}</p>}
<div className='user-list card'> <div className='user-list card'>