This commit is contained in:
Igor Barcik 2024-01-25 20:01:42 +01:00
parent 04a42f073b
commit 7395cb9bf4
Signed by: biggy
GPG Key ID: EA4CE0D1E2A6DC98
12 changed files with 6251 additions and 127 deletions

File diff suppressed because it is too large Load Diff

8
postcss.config.cjs Normal file
View File

@ -0,0 +1,8 @@
module.exports = {
plugins: [
require("autoprefixer"),
require("tailwindcss"),
require("postcss-import"),
require("tailwindcss/nesting"),
],
};

View File

@ -1,10 +0,0 @@
/** @type {import('postcss-load-config').Config} */
const config = {
plugins: [
require('autoprefixer'),
require('tailwindcss'),
require('postcss-import'),
require('tailwindcss/nesting'),
],
};
module.exports = config

View File

@ -70,9 +70,9 @@ export const floatingMenuStructure: MenuStructure[] = [
tabIndex={0} tabIndex={0}
className="dropdown-content z-[1] menu p-2 shadow bg-base-100 rounded-box w-52 mr-1" className="dropdown-content z-[1] menu p-2 shadow bg-base-100 rounded-box w-52 mr-1"
> >
{floatingLanguageMenuStructure.map((element) => { {floatingLanguageMenuStructure.map((element, index) => {
return ( return (
<li> <li key={element.label + index}>
<a <a
onClick={() => { onClick={() => {
if ("action" in element && typeof element.action === "function") if ("action" in element && typeof element.action === "function")

View File

@ -3,5 +3,6 @@
"login_button": "Login", "login_button": "Login",
"login_username": "Username", "login_username": "Username",
"login_password": "Password", "login_password": "Password",
"login_accept_terms": "I accept the terms and conditions" "login_accept_terms": "I accept the terms and conditions",
"homePage": { "click_me": "Click me!", "counter": "Counter" }
} }

View File

@ -3,5 +3,6 @@
"login_button": "Zaloguj", "login_button": "Zaloguj",
"login_username": "Nazwa użytkownika", "login_username": "Nazwa użytkownika",
"login_password": "Hasło", "login_password": "Hasło",
"login_accept_terms": "Akceptuję regulamin" "login_accept_terms": "Akceptuję regulamin",
"homePage": { "click_me": "Naciśnij tutaj!", "counter": "Licznik" }
} }

View File

@ -1,16 +1,22 @@
import { useState } from "react"; import { useState } from "react";
import HomePageTemplate from "../templates/HomePageTemplate";
import { useTranslation } from "react-i18next";
const HomePage = () => { const HomePage = () => {
const [counter, setCounter] = useState(0); const [counter, setCounter] = useState(0);
const { t } = useTranslation();
return ( return (
<div> <HomePageTemplate
<p>HomePage</p> buttonLabel={t("homePage.click_me", "Click me!!!")}
<button className="btn btn-sm" onClick={() => setCounter(counter + 1)}> buttonOnClick={() => {
Click me if (counter >= 10) {
</button> setCounter(0);
<div>Counter: {counter}</div> return;
</div> } else setCounter(counter + 1);
}}
value={counter}
/>
); );
}; };

View File

@ -1,19 +1,8 @@
// ----- IMPORT ICONS -----
// Importing necessary icons from 'react-icons' library
import { IoMdLogIn, IoMdOptions } from "react-icons/io"; import { IoMdLogIn, IoMdOptions } from "react-icons/io";
import { RiHome3Fill } from "react-icons/ri"; import { RiHome3Fill } from "react-icons/ri";
import { HOME, LOGIN, PAGE_NOT_FOUND, SETTINGS, USERS } from "../consts";
// ----- IMPORT PAGES -----
// Importing page components for route configuration
import HomePage from "../pages/HomePage"; import HomePage from "../pages/HomePage";
import LoginPage from "../pages/LoginPage"; import LoginPage from "../pages/LoginPage";
// ----- IMPORT CONSTANTS -----
// Importing route-related constants for route naming
import { HOME, LOGIN, PAGE_NOT_FOUND, SETTINGS, USERS } from "../consts";
// ----- IMPORT TYPES AND UTILITIES -----
// Importing types for route configuration and utility functions
import { RoutingTree } from "../types/routesTypes"; import { RoutingTree } from "../types/routesTypes";
import { capitalizeFirstLetter } from "../utils/StringTransformationUtils"; import { capitalizeFirstLetter } from "../utils/StringTransformationUtils";

View File

@ -0,0 +1,31 @@
import { useTranslation } from "react-i18next";
export interface HomePageTemplateProps {
buttonLabel: string;
buttonOnClick: () => void;
value: number;
}
const HomePageTemplate = (props: HomePageTemplateProps) => {
const { t } = useTranslation();
return (
<div className="hero">
<div className="hero-content prose flex-col">
<h1>HomePage</h1>
<div className="card card-bordered shadow-2xl bg-base-100 text-base-content items-center">
<div className="card-body">
{t("homePage.counter")}: {props.value}
</div>
<button
className="btn btn-sm btn-accent absolute w-fit -bottom-4"
onClick={props.buttonOnClick}
>
{props.buttonLabel}
</button>
</div>
</div>
</div>
);
};
export default HomePageTemplate;

View File

@ -1,12 +1,15 @@
import forms from "@tailwindcss/forms"; import forms from "@tailwindcss/forms";
import typography from "@tailwindcss/typography"; import typography from "@tailwindcss/typography";
import daisyUI from "daisyui"; import daisyUI from "daisyui";
import type { Config } from "tailwindcss"; import { Config } from "tailwindcss";
export default { export default {
content: ["./src/**/*.{js,ts,jsx,tsx}", "./index.html"], content: {
relative: true,
files: ["./src/**/*.{js,ts,jsx,tsx}", "./index.html"],
},
// safelist is used to allow classes to not be purged by tailwind; // safelist is used to allow classes to not be purged by tailwind;
// I made this to set this classes dyanmically in the code, somehow without this tailwind purges them; // I made this to set this classes dyanmically in the code, somehow without this tailwind purges them;
safelist: ["alert-info", "alert-success", "alert-warning", "alert-error"], // safelist: ["alert-info", "alert-success", "alert-warning", "alert-error"],
theme: { theme: {
extend: { extend: {
spacing: { spacing: {
@ -19,8 +22,8 @@ export default {
}, },
}, },
darkMode: "media", darkMode: "media",
plugins: [forms, daisyUI, typography], plugins: [forms, typography, daisyUI],
daisyui: { daisyui: {
themes: ["light", "dark"], themes: ["light", "dark"],
}, },
} satisfies Config; } as Config;

View File

@ -9,7 +9,7 @@
"ESNext" "ESNext"
], ],
// Enabling options for better interoperability and module handling // Enabling options for better interoperability and module handling
"moduleResolution": "bundler", "moduleResolution": "Bundler",
"esModuleInterop": true, "esModuleInterop": true,
"allowSyntheticDefaultImports": true, "allowSyntheticDefaultImports": true,
"resolveJsonModule": true, "resolveJsonModule": true,