initial commit

This commit is contained in:
2024-07-19 19:55:57 +02:00
commit 049e063d48
53 changed files with 15239 additions and 0 deletions

View File

@@ -0,0 +1,9 @@
import styles from "./{{kebabCase name}}.module.scss";
type {{pascalCase name}}Props = {}
export const {{pascalCase name}}:React.FC<{{pascalCase name}}Props> = ({}) => {
return (
<div data-testid="{{{kebabCase name}}}" className={styles.container}></div>
)
}

View File

@@ -0,0 +1,2 @@
.container {
}

View File

@@ -0,0 +1,3 @@
"use client"
export { {{pascalCase name}} as default } from "./{{kebabCase name}}.component";

3
front/.eslintrc.json Normal file
View File

@@ -0,0 +1,3 @@
{
"extends": "next/core-web-vitals"
}

36
front/.gitignore vendored Normal file
View File

@@ -0,0 +1,36 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
/.pnp
.pnp.js
.yarn/install-state.gz
# testing
/coverage
# next.js
/.next/
/out/
# production
/build
# misc
.DS_Store
*.pem
# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# local env files
.env*.local
# vercel
.vercel
# typescript
*.tsbuildinfo
next-env.d.ts

36
front/README.md Normal file
View File

@@ -0,0 +1,36 @@
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
## Getting Started
First, run the development server:
```bash
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
```
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.
## Learn More
To learn more about Next.js, take a look at the following resources:
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
## Deploy on Vercel
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.

14
front/next.config.mjs Normal file
View File

@@ -0,0 +1,14 @@
import path from "path";
/** @type {import('next').NextConfig} */
const nextConfig = {
/**
* https://nextjs.org/docs/app/building-your-application/styling/sass
*/
sassOptions: {
prependData: `@import "@/styles/variables";`,
includePaths: [path.join("@", "styles")],
},
};
export default nextConfig;

4377
front/package-lock.json generated Normal file
View File

File diff suppressed because it is too large Load Diff

25
front/package.json Normal file
View File

@@ -0,0 +1,25 @@
{
"name": "front-next-archetype",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"next": "14.2.3",
"react": "^18",
"react-dom": "^18",
"sass": "^1.77.4"
},
"devDependencies": {
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
"eslint": "^8",
"eslint-config-next": "14.2.3",
"typescript": "^5"
}
}

BIN
front/src/app/favicon.ico Normal file
View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

22
front/src/app/layout.tsx Normal file
View 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
View File

@@ -0,0 +1,10 @@
import ThemeSwitcher from "@/modules/common/theme-switcher";
export default function Home() {
return (
<main>
Main page
<ThemeSwitcher />
</main>
);
}

View File

@@ -0,0 +1,3 @@
"use client";
export { ThemeSwitcher as default } from "./theme-switcher.component";

View File

@@ -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>
);
};

View 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);

View 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;
}

26
front/tsconfig.json Normal file
View File

@@ -0,0 +1,26 @@
{
"compilerOptions": {
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"plugins": [
{
"name": "next"
}
],
"paths": {
"@/*": ["./src/*"]
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules"]
}