init: layout with simple side navigation
All checks were successful
build / test (push) Successful in 21s

This commit is contained in:
Johannes Kirschbauer 2023-08-06 17:26:24 +02:00
parent a7b67be580
commit ca4282b159
13 changed files with 362 additions and 206 deletions

View File

@ -1,6 +1,7 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
output: "export",
images: { unoptimized: true },
};
module.exports = nextConfig;

View File

@ -895,6 +895,37 @@
version = "5.14.3";
};
};
"@mui/icons-material" = {
"5.14.3" = {
depInfo = {
"@babel/runtime" = {
descriptor = "^7.22.6";
pin = "7.22.6";
runtime = true;
};
};
fetchInfo = {
narHash = "sha256-wmY7EzOahWuCF2g5vpcOeFZ8+iJKwyFLHsQiXh1R2jY=";
type = "tarball";
url = "https://registry.npmjs.org/@mui/icons-material/-/icons-material-5.14.3.tgz";
};
ident = "@mui/icons-material";
ltype = "file";
peerInfo = {
"@mui/material" = {
descriptor = "^5.0.0";
};
"@types/react" = {
descriptor = "^17.0.0 || ^18.0.0";
optional = true;
};
react = {
descriptor = "^17.0.0 || ^18.0.0";
};
};
version = "5.14.3";
};
};
"@mui/material" = {
"5.14.3" = {
depInfo = {
@ -6643,6 +6674,11 @@
pin = "11.11.0";
runtime = true;
};
"@mui/icons-material" = {
descriptor = "^5.14.3";
pin = "5.14.3";
runtime = true;
};
"@mui/material" = {
descriptor = "^5.14.3";
pin = "5.14.3";
@ -6693,6 +6729,14 @@
pin = "8.4.27";
runtime = true;
};
prettier = {
descriptor = "^3.0.1";
pin = "3.0.1";
};
prettier-plugin-tailwindcss = {
descriptor = "^0.4.1";
pin = "0.4.1";
};
react = {
descriptor = "18.2.0";
pin = "18.2.0";
@ -6856,6 +6900,9 @@
"node_modules/@mui/core-downloads-tracker" = {
key = "@mui/core-downloads-tracker/5.14.3";
};
"node_modules/@mui/icons-material" = {
key = "@mui/icons-material/5.14.3";
};
"node_modules/@mui/material" = {
key = "@mui/material/5.14.3";
};
@ -7727,6 +7774,14 @@
"node_modules/prelude-ls" = {
key = "prelude-ls/1.2.1";
};
"node_modules/prettier" = {
dev = true;
key = "prettier/3.0.1";
};
"node_modules/prettier-plugin-tailwindcss" = {
dev = true;
key = "prettier-plugin-tailwindcss/0.4.1";
};
"node_modules/prop-types" = {
key = "prop-types/15.8.1";
};
@ -9062,6 +9117,102 @@
version = "1.2.1";
};
};
prettier = {
"3.0.1" = {
binInfo = {
binPairs = {
prettier = "bin/prettier.cjs";
};
};
fetchInfo = {
narHash = "sha256-rgaO4WYmjoHtlOu8SnOau8b/O9lIEDtt26ovEY7qseY=";
type = "tarball";
url = "https://registry.npmjs.org/prettier/-/prettier-3.0.1.tgz";
};
ident = "prettier";
ltype = "file";
treeInfo = { };
version = "3.0.1";
};
};
prettier-plugin-tailwindcss = {
"0.4.1" = {
fetchInfo = {
narHash = "sha256-39DJn6lvrLmDYTN/lXXuWzMC9pLI4+HNrhnHlYuOMRM=";
type = "tarball";
url = "https://registry.npmjs.org/prettier-plugin-tailwindcss/-/prettier-plugin-tailwindcss-0.4.1.tgz";
};
ident = "prettier-plugin-tailwindcss";
ltype = "file";
peerInfo = {
"@ianvs/prettier-plugin-sort-imports" = {
descriptor = "*";
optional = true;
};
"@prettier/plugin-pug" = {
descriptor = "*";
optional = true;
};
"@shopify/prettier-plugin-liquid" = {
descriptor = "*";
optional = true;
};
"@shufo/prettier-plugin-blade" = {
descriptor = "*";
optional = true;
};
"@trivago/prettier-plugin-sort-imports" = {
descriptor = "*";
optional = true;
};
prettier = {
descriptor = "^2.2 || ^3.0";
};
prettier-plugin-astro = {
descriptor = "*";
optional = true;
};
prettier-plugin-css-order = {
descriptor = "*";
optional = true;
};
prettier-plugin-import-sort = {
descriptor = "*";
optional = true;
};
prettier-plugin-jsdoc = {
descriptor = "*";
optional = true;
};
prettier-plugin-marko = {
descriptor = "*";
optional = true;
};
prettier-plugin-organize-attributes = {
descriptor = "*";
optional = true;
};
prettier-plugin-organize-imports = {
descriptor = "*";
optional = true;
};
prettier-plugin-style-order = {
descriptor = "*";
optional = true;
};
prettier-plugin-svelte = {
descriptor = "*";
optional = true;
};
prettier-plugin-twig-melody = {
descriptor = "*";
optional = true;
};
};
treeInfo = { };
version = "0.4.1";
};
};
prop-types = {
"15.8.1" = {
depInfo = {

View File

@ -10,6 +10,7 @@
"dependencies": {
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"@mui/icons-material": "^5.14.3",
"@mui/material": "^5.14.3",
"@types/node": "20.4.7",
"@types/react": "18.2.18",
@ -497,6 +498,31 @@
"url": "https://opencollective.com/mui"
}
},
"node_modules/@mui/icons-material": {
"version": "5.14.3",
"resolved": "https://registry.npmjs.org/@mui/icons-material/-/icons-material-5.14.3.tgz",
"integrity": "sha512-XkxWPhageu1OPUm2LWjo5XqeQ0t2xfGe8EiLkRW9oz2LHMMZmijvCxulhgquUVTF1DnoSh+3KoDLSsoAFtVNVw==",
"dependencies": {
"@babel/runtime": "^7.22.6"
},
"engines": {
"node": ">=12.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/mui"
},
"peerDependencies": {
"@mui/material": "^5.0.0",
"@types/react": "^17.0.0 || ^18.0.0",
"react": "^17.0.0 || ^18.0.0"
},
"peerDependenciesMeta": {
"@types/react": {
"optional": true
}
}
},
"node_modules/@mui/material": {
"version": "5.14.3",
"resolved": "https://registry.npmjs.org/@mui/material/-/material-5.14.3.tgz",

View File

@ -14,6 +14,7 @@
"dependencies": {
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"@mui/icons-material": "^5.14.3",
"@mui/material": "^5.14.3",
"@types/node": "20.4.7",
"@types/react": "18.2.18",

View File

@ -1,4 +0,0 @@
module.exports = {
plugins: [require("prettier-plugin-tailwindcss")],
tailwindFunctions: ['clsx', 'cx'],
};

1
pkgs/ui/public/logo.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -1,25 +0,0 @@
import { DashboardCard } from "../../components/card";
import { Grid } from "@mui/material";
import { Button } from "@mui/material";
export default function Dashboard() {
return (
<Grid container>
<Grid item xs={12}>
<DashboardCard />
<Button variant="contained" color="primary">
Click me!
</Button>
Hallo Mike !
</Grid>
<Grid item xs={6}>
<DashboardCard />
Server Stats
</Grid>
<Grid item xs={6}>
Network Stats
<DashboardCard />
</Grid>
</Grid>
);
}

View File

@ -1,27 +1,3 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
:root {
--foreground-rgb: 0, 0, 0;
--background-start-rgb: 214, 219, 220;
--background-end-rgb: 255, 255, 255;
}
@media (prefers-color-scheme: dark) {
:root {
--foreground-rgb: 255, 255, 255;
--background-start-rgb: 0, 0, 0;
--background-end-rgb: 0, 0, 0;
}
}
body {
color: rgb(var(--foreground-rgb));
background: linear-gradient(
to bottom,
transparent,
rgb(var(--background-end-rgb))
)
rgb(var(--background-start-rgb));
}

View File

@ -1,10 +1,15 @@
"use client";
import "./globals.css";
import type { Metadata } from "next";
import localFont from "next/font/local";
import * as React from "react";
import { CssBaseline, ThemeProvider } from "@mui/material";
import { ChangeEvent, useState } from "react";
import { StyledEngineProvider } from "@mui/material/styles";
import cx from "classnames";
// import { tw } from "../utils/tailwind";
import { darkTheme, lightTheme } from "./theme/themes";
import { Sidebar } from "@/components/sidebar";
const roboto = localFont({
src: [
@ -13,49 +18,42 @@ const roboto = localFont({
weight: "400",
style: "normal",
},
// {
// path: "./Roboto-Italic.woff2",
// weight: "400",
// style: "italic",
// },
// {
// path: "./Roboto-Bold.woff2",
// weight: "700",
// style: "normal",
// },
// {
// path: "./Roboto-BoldItalic.woff2",
// weight: "700",
// style: "italic",
// },
],
});
export const metadata: Metadata = {
title: "Create Next App",
description: "Generated by create next app",
};
export default function RootLayout({
children,
}: {
children: React.ReactNode;
}) {
let [useDarkTheme, setUseDarkTheme] = useState(false);
let [theme, setTheme] = useState(useDarkTheme ? darkTheme : lightTheme);
const changeThemeHandler = (target: ChangeEvent, currentValue: boolean) => {
setUseDarkTheme(currentValue);
setTheme(currentValue ? darkTheme : lightTheme);
};
return (
<html lang="en">
<head>
<title>Clan.lol</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Clan.lol - build your own network" />
<link rel="icon" href="/favicon.ico" />
</head>
<StyledEngineProvider injectFirst>
<body
className={cx(
"h-screen",
"min-h-screen",
"w-screen",
"bg-white",
// custom animation defined in tailwind.config
roboto.className
)}
>
{children}
</body>
<ThemeProvider theme={theme}>
<body id="__next" className={roboto.className}>
<CssBaseline />
<div className="flex h-screen overflow-hidden">
<Sidebar />
<div className="relative flex flex-1 flex-col overflow-y-auto overflow-x-hidden">
<main>{children}</main>
</div>
</div>
</body>
</ThemeProvider>
</StyledEngineProvider>
</html>
);

View File

@ -1,112 +1,14 @@
import Image from "next/image";
import { Button } from "@mui/material";
export default function Home() {
export default function Dashboard() {
return (
<main className="min-h-screen">
<div className="z-10 w-full max-w-5xl items-center justify-between font-mono text-sm lg:flex">
<p className="fixed left-0 top-0 flex w-full justify-center border-b border-gray-300 bg-gradient-to-b from-zinc-200 pb-6 pt-8 backdrop-blur-2xl dark:border-neutral-800 dark:bg-zinc-800/30 dark:from-inherit lg:static lg:w-auto lg:rounded-xl lg:border lg:bg-gray-200 lg:p-4 lg:dark:bg-zinc-800/30">
Get started by editing&nbsp;
<code className="font-mono font-bold">src/app/page.tsx</code>
</p>
<div className="fixed bottom-0 left-0 flex h-48 w-full items-end justify-center bg-gradient-to-t from-white via-white dark:from-black dark:via-black lg:static lg:h-auto lg:w-auto lg:bg-none">
<a
className="pointer-events-none flex place-items-center gap-2 p-8 lg:pointer-events-auto lg:p-0"
href="https://vercel.com?utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
>
<Image
src="/vercel.svg"
alt="Vercel Logo"
className="dark:invert"
width={100}
height={24}
priority
/>
</a>
</div>
<div className="w-full flex justify-center items-center h-screen">
<div className="grid">
Welcome to the Dashboard
<Button variant="contained" color="primary">
LOL
</Button>
</div>
<div className="relative flex place-items-center before:absolute before:h-[300px] before:w-[480px] before:-translate-x-1/2 before:rounded-full before:bg-gradient-radial before:from-white before:to-transparent before:blur-2xl before:content-[''] after:absolute after:-z-20 after:h-[180px] after:w-[240px] after:translate-x-1/3 after:bg-gradient-conic after:from-sky-200 after:via-blue-200 after:blur-2xl after:content-[''] before:dark:bg-gradient-to-br before:dark:from-transparent before:dark:to-blue-700 before:dark:opacity-10 after:dark:from-sky-900 after:dark:via-[#0141ff] after:dark:opacity-40 before:lg:h-[360px] z-[-1]">
<Image
className="relative dark:drop-shadow-[0_0_0.3rem_#ffffff70] dark:invert"
src="/next.svg"
alt="Next.js Logo"
width={180}
height={37}
priority
/>
</div>
<div className="mb-32 grid text-center lg:mb-0 lg:grid-cols-4 lg:text-left">
<a
href="https://nextjs.org/docs?utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
className="group rounded-lg border border-transparent px-5 py-4 transition-colors hover:border-gray-300 hover:bg-gray-100 hover:dark:border-neutral-700 hover:dark:bg-neutral-800/30"
target="_blank"
rel="noopener noreferrer"
>
<h2 className={`mb-3 text-2xl font-semibold`}>
Docs{" "}
<span className="inline-block transition-transform group-hover:translate-x-1 motion-reduce:transform-none">
-&gt;
</span>
</h2>
<p className={`m-0 max-w-[30ch] text-sm opacity-50`}>
Find in-depth information about Next.js features and API.
</p>
</a>
<a
href="https://nextjs.org/learn?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
className="group rounded-lg border border-transparent px-5 py-4 transition-colors hover:border-gray-300 hover:bg-gray-100 hover:dark:border-neutral-700 hover:dark:bg-neutral-800/30"
target="_blank"
rel="noopener noreferrer"
>
<h2 className={`mb-3 text-2xl font-semibold`}>
Learn{" "}
<span className="inline-block transition-transform group-hover:translate-x-1 motion-reduce:transform-none">
-&gt;
</span>
</h2>
<p className={`m-0 max-w-[30ch] text-sm opacity-50`}>
Learn about Next.js in an interactive course with&nbsp;quizzes!
</p>
</a>
<a
href="https://vercel.com/templates?framework=next.js&utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
className="group rounded-lg border border-transparent px-5 py-4 transition-colors hover:border-gray-300 hover:bg-gray-100 hover:dark:border-neutral-700 hover:dark:bg-neutral-800/30"
target="_blank"
rel="noopener noreferrer"
>
<h2 className={`mb-3 text-2xl font-semibold`}>
Templates{" "}
<span className="inline-block transition-transform group-hover:translate-x-1 motion-reduce:transform-none">
-&gt;
</span>
</h2>
<p className={`m-0 max-w-[30ch] text-sm opacity-50`}>
Explore the Next.js 13 playground.
</p>
</a>
<a
href="https://vercel.com/new?utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
className="group rounded-lg border border-transparent px-5 py-4 transition-colors hover:border-gray-300 hover:bg-gray-100 hover:dark:border-neutral-700 hover:dark:bg-neutral-800/30"
target="_blank"
rel="noopener noreferrer"
>
<h2 className={`mb-3 text-2xl font-semibold`}>
Deploy{" "}
<span className="inline-block transition-transform group-hover:translate-x-1 motion-reduce:transform-none">
-&gt;
</span>
</h2>
<p className={`m-0 max-w-[30ch] text-sm opacity-50`}>
Instantly deploy your Next.js site to a shareable URL with Vercel.
</p>
</a>
</div>
</main>
</div>
);
}

View File

@ -0,0 +1,13 @@
import { createTheme } from "@mui/material/styles";
export const darkTheme = createTheme({
palette: {
mode: "dark",
},
});
export const lightTheme = createTheme({
palette: {
mode: "light",
},
});

View File

@ -0,0 +1,122 @@
import {
Divider,
List,
ListItem,
ListItemButton,
ListItemIcon,
ListItemText,
} from "@mui/material";
import Image from "next/image";
import { ReactNode } from "react";
import DashboardIcon from "@mui/icons-material/Dashboard";
import DevicesIcon from "@mui/icons-material/Devices";
import LanIcon from "@mui/icons-material/Lan";
import AppsIcon from "@mui/icons-material/Apps";
import DesignServicesIcon from "@mui/icons-material/DesignServices";
import BackupIcon from "@mui/icons-material/Backup";
import Link from "next/link";
type MenuEntry = {
icon: ReactNode;
label: string;
to: string;
} & {
subMenuEntries?: MenuEntry[];
};
const menuEntries: MenuEntry[] = [
{
icon: <DashboardIcon />,
label: "Dashoard",
to: "/",
},
{
icon: <DevicesIcon />,
label: "Devices",
to: "/nodes",
},
{
icon: <AppsIcon />,
label: "Applications",
to: "/applications",
},
{
icon: <LanIcon />,
label: "Network",
to: "/network",
},
{
icon: <DesignServicesIcon />,
label: "Templates",
to: "/templates",
},
{
icon: <BackupIcon />,
label: "Backups",
to: "/backups",
},
];
export function Sidebar() {
return (
<aside className="absolute left-0 top-0 z-9999 flex h-screen w-12 sm:w-64 flex-col overflow-y-hidden bg-zinc-950 dark:bg-boxdark sm:static">
<div className="flex items-center justify-between gap-2 px-6 py-5.5 lg:py-6.5">
<div className="mt-8 font-semibold text-white w-full text-center hidden sm:block">
<Image
src="/logo.svg"
alt="Clan Logo"
width={58}
height={58}
priority
/>
</div>
</div>
<Divider flexItem className="bg-zinc-600 my-9 mx-8" />
<div className="overflow-hidden flex flex-col overflow-y-auto duration-200 ease-linear">
<List className="pb-4 mb-14 px-4 lg:mt-1 lg:px-6 text-white">
{menuEntries.map((menuEntry, idx) => {
return (
<ListItem key={idx}>
<ListItemButton
className="justify-center sm:justify-normal"
LinkComponent={Link}
href={menuEntry.to}
>
<ListItemIcon
color="inherit"
className="justify-center sm:justify-normal text-white"
>
{menuEntry.icon}
</ListItemIcon>
<ListItemText
primary={menuEntry.label}
primaryTypographyProps={{
color: "inherit",
}}
className="hidden sm:block"
/>
</ListItemButton>
</ListItem>
);
})}
</List>
<Divider flexItem className="bg-zinc-600 mx-8 my-10" />
<div className="hidden sm:block mx-auto mb-8 w-full max-w-60 rounded-sm py-6 px-4 text-center shadow-default align-bottom">
<h3 className="mb-1 w-full font-semibold text-white">
Clan.lol Admin
</h3>
<a
href=""
target="_blank"
rel="nofollow"
className="w-full text-center rounded-md bg-primary p-2 text-white hover:bg-opacity-95"
>
Donate
</a>
</div>
</div>
</aside>
);
}

View File

@ -1,22 +1,16 @@
/** @type {import('tailwindcss').Config} */
module.exports = {
corePlugins: {
preflight: false,
},
content: [
"./src/pages/**/*.{js,ts,jsx,tsx,mdx}",
"./src/components/**/*.{js,ts,jsx,tsx,mdx}",
"./src/app/**/*.{js,ts,jsx,tsx,mdx}",
],
important: "#root",
important: "#__next",
theme: {
extend: {
backgroundImage: {
"gradient-radial": "radial-gradient(var(--tw-gradient-stops))",
"gradient-conic":
"conic-gradient(from 180deg at 50% 50%, var(--tw-gradient-stops))",
},
},
extend: {},
},
plugins: [],
corePlugins: {
preflight: false,
},
};