initial commit
This commit is contained in:
BIN
front/src/app/favicon.ico
Normal file
BIN
front/src/app/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 39 KiB |
22
front/src/app/layout.tsx
Normal file
22
front/src/app/layout.tsx
Normal file
@@ -0,0 +1,22 @@
|
||||
import type { Metadata } from "next";
|
||||
import { Inter } from "next/font/google";
|
||||
import "@/styles/main.scss";
|
||||
|
||||
const inter = Inter({ subsets: ["latin"] });
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "Personal finance - Home",
|
||||
description: "Manage your money blablabla",
|
||||
};
|
||||
|
||||
export default function RootLayout({
|
||||
children,
|
||||
}: Readonly<{
|
||||
children: React.ReactNode;
|
||||
}>) {
|
||||
return (
|
||||
<html lang="en">
|
||||
<body className={inter.className}>{children}</body>
|
||||
</html>
|
||||
);
|
||||
}
|
||||
10
front/src/app/page.tsx
Normal file
10
front/src/app/page.tsx
Normal file
@@ -0,0 +1,10 @@
|
||||
import ThemeSwitcher from "@/modules/common/theme-switcher";
|
||||
|
||||
export default function Home() {
|
||||
return (
|
||||
<main>
|
||||
Main page
|
||||
<ThemeSwitcher />
|
||||
</main>
|
||||
);
|
||||
}
|
||||
3
front/src/modules/common/theme-switcher/index.ts
Normal file
3
front/src/modules/common/theme-switcher/index.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
"use client";
|
||||
|
||||
export { ThemeSwitcher as default } from "./theme-switcher.component";
|
||||
@@ -0,0 +1,20 @@
|
||||
import React from "react";
|
||||
|
||||
// TODO: make it consistent and link current data-theme with checked state fo the checkbox, maybe with a react state
|
||||
export const ThemeSwitcher = () => {
|
||||
const changeHandler = () => {
|
||||
const isDarkTheme =
|
||||
document.documentElement.getAttribute("data-theme") === "dark";
|
||||
document.documentElement.setAttribute(
|
||||
"data-theme",
|
||||
isDarkTheme ? "light" : "dark",
|
||||
);
|
||||
};
|
||||
|
||||
return (
|
||||
<label className="switch">
|
||||
<input type="checkbox" onClick={changeHandler} />
|
||||
<span className="slider round"></span>
|
||||
</label>
|
||||
);
|
||||
};
|
||||
8
front/src/styles/_variables.scss
Normal file
8
front/src/styles/_variables.scss
Normal file
@@ -0,0 +1,8 @@
|
||||
$default-font-size: 1.6rem;
|
||||
|
||||
$color-primary: #ff7730;
|
||||
$color-secondary: #ff7730;
|
||||
$color-background: var(--color-white);
|
||||
$color-foreground: var(--color-black);
|
||||
|
||||
$color-white: var(--color-white);
|
||||
51
front/src/styles/main.scss
Normal file
51
front/src/styles/main.scss
Normal file
@@ -0,0 +1,51 @@
|
||||
// For variable definition
|
||||
:root {
|
||||
--color-white: #fafafa;
|
||||
--color-black: #101010;
|
||||
}
|
||||
|
||||
[data-theme="dark"] {
|
||||
--color-white: #101010;
|
||||
--color-black: #fafafa;
|
||||
}
|
||||
|
||||
*,
|
||||
::after,
|
||||
::before {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: inherit;
|
||||
}
|
||||
|
||||
html {
|
||||
max-width: 100vw;
|
||||
overflow-x: hidden;
|
||||
|
||||
font-size: 62.5%; // 1rem = 10px; 10px/16px = 62.5%
|
||||
@media only screen and (min-width: 112.5em) {
|
||||
font-size: 75%;
|
||||
}
|
||||
@media only screen and (max-width: 75em) {
|
||||
font-size: 56.25%;
|
||||
}
|
||||
@media only screen and (max-width: 56.25em) {
|
||||
font-size: 50%;
|
||||
}
|
||||
}
|
||||
|
||||
body {
|
||||
box-sizing: border-box;
|
||||
|
||||
background-color: $color-background;
|
||||
color: $color-foreground;
|
||||
}
|
||||
|
||||
a {
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
::selection {
|
||||
background-color: $color-primary;
|
||||
color: $color-white;
|
||||
}
|
||||
Reference in New Issue
Block a user