feat: navbar and footer

This commit is contained in:
2025-08-19 11:59:58 +04:00
parent d3d8c5117b
commit be034ebbd0
24 changed files with 452 additions and 38 deletions

View File

@ -0,0 +1,14 @@
"use client";
import { FC, ReactNode } from "react";
import { AppShell } from "@mantine/core";
type Props = {
children: ReactNode;
};
const AppShellFooterWrapper: FC<Props> = ({ children }) => {
return <AppShell.Footer hiddenFrom={"sm"}>{children}</AppShell.Footer>;
};
export default AppShellFooterWrapper;

View File

@ -0,0 +1,14 @@
"use client";
import { FC, ReactNode } from "react";
import { AppShell } from "@mantine/core";
type Props = {
children: ReactNode;
};
const AppShellMainWrapper: FC<Props> = ({ children }) => {
return <AppShell.Main>{children}</AppShell.Main>;
};
export default AppShellMainWrapper;

View File

@ -0,0 +1,14 @@
"use client";
import { FC, ReactNode } from "react";
import { AppShell } from "@mantine/core";
type Props = {
children: ReactNode;
};
const AppShellNavbarWrapper: FC<Props> = ({ children }) => {
return <AppShell.Navbar>{children}</AppShell.Navbar>;
};
export default AppShellNavbarWrapper;

View File

@ -0,0 +1,32 @@
.container {
@mixin light {
border-top: solid gray 2px;
}
@mixin dark {
border-top: solid var(--mantine-color-dark-7) 2px;
}
}
.link {
width: 100%;
height: rem(50px);
border-radius: var(--mantine-radius-md);
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
@mixin light {
color: var(--mantine-color-gray-7);
}
@mixin dark {
color: var(--mantine-color-dark-0);
}
&[data-active] {
&,
&:hover {
color: var(--mantine-color-blue-light-color);
}
}
}

View File

@ -0,0 +1,31 @@
import { IconCircleDotted, IconLayoutKanban } from "@tabler/icons-react";
import FooterButtons from "@/components/layout/Footer/FooterButtons";
const buttonsData = [
{
icon: IconLayoutKanban,
label: "Сделки",
href: "/deals",
},
{
icon: IconCircleDotted,
label: "Label 1",
href: "/oiiai",
},
{
icon: IconCircleDotted,
label: "Label 2",
href: "/opaopa",
},
{
icon: IconCircleDotted,
label: "Label 3",
href: "/hihihaha",
},
];
const Footer = () => {
return <FooterButtons buttonsData={buttonsData} />;
};
export default Footer;

View File

@ -0,0 +1,39 @@
import { IconPlus } from "@tabler/icons-react";
import { Group, Stack, Text } from "@mantine/core";
import FooterClickable from "@/components/layout/Footer/FooterClickable";
import styles from "./Footer.module.css";
type LinkData = {
icon: typeof IconPlus;
label: string;
href: string;
};
type Props = {
buttonsData: LinkData[];
};
const FooterButtons = ({ buttonsData }: Props) => {
return (
<Group
className={styles.container}
p={"xs"}
wrap={"nowrap"}
justify={"space-between"}>
{buttonsData.map(data => (
<FooterClickable
href={data.href}
key={data.label}>
<Stack
gap={0}
align={"center"}>
<data.icon />
<Text>{data.label}</Text>
</Stack>
</FooterClickable>
))}
</Group>
);
};
export default FooterButtons;

View File

@ -0,0 +1,29 @@
"use client";
import { ReactNode } from "react";
import { usePathname, useRouter } from "next/navigation";
import { UnstyledButton } from "@mantine/core";
import styles from "./Footer.module.css";
type Props = {
href: string;
children: ReactNode;
};
const FooterClickable = ({ children, href }: Props) => {
const pathname = usePathname();
const router = useRouter();
const onClick = () => router.push(href);
return (
<UnstyledButton
onClick={onClick}
className={styles.link}
data-active={pathname === href || undefined}>
{children}
</UnstyledButton>
);
};
export default FooterClickable;

View File

@ -0,0 +1,38 @@
.link {
width: 100%;
height: rem(50px);
border-radius: var(--mantine-radius-md);
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
@mixin light {
color: var(--mantine-color-gray-7);
}
@mixin dark {
color: var(--mantine-color-dark-0);
}
&:hover {
@mixin light {
background-color: var(--mantine-color-gray-1);
}
@mixin dark {
background-color: var(--mantine-color-dark-5);
}
}
&[data-active] {
&,
&:hover {
@mixin light {
background-color: var(--color-light-aqua);
}
@mixin dark {
background-color: var(--mantine-color-dark-6);
}
color: var(--mantine-color-blue-light-color);
}
}
}

View File

@ -0,0 +1,46 @@
import { IconCircleDotted, IconLayoutKanban } from "@tabler/icons-react";
import { Flex } from "@mantine/core";
import PageBlock from "@/components/layout/PageBlock/PageBlock";
import { ColorSchemeToggle } from "@/components/ui/ColorSchemeToggle/ColorSchemeToggle";
import Logo from "@/components/ui/Logo/Logo";
import NavbarLinks from "./NavbarLinks";
const linksData = [
{
icon: IconLayoutKanban,
label: "Сделки",
href: "/deals",
},
{
icon: IconCircleDotted,
label: "Назад",
href: "/oiiai",
},
];
const Navbar = () => {
return (
<PageBlock
style={{
marginBlock: "var(--mantine-spacing-md)",
marginLeft: "var(--mantine-spacing-md)",
}}
fullHeight>
<Flex
direction={"column"}
h={"100%"}>
<Logo title={"Fulfillment & Delivery"} />
<Flex
mx={"xs"}
direction={"column"}
justify={"space-between"}
h={"100%"}>
<NavbarLinks linksData={linksData} />
<ColorSchemeToggle />
</Flex>
</Flex>
</PageBlock>
);
};
export default Navbar;

View File

@ -0,0 +1,30 @@
"use client";
import { ReactNode } from "react";
import { usePathname, useRouter } from "next/navigation";
import { UnstyledButton } from "@mantine/core";
import styles from "./Navbar.module.css";
type Props = {
href: string;
children: ReactNode;
active?: boolean;
};
const NavbarClickable = ({ children, href, active = false }: Props) => {
const pathname = usePathname();
const router = useRouter();
const onClick = () => router.push(href);
return (
<UnstyledButton
onClick={onClick}
className={styles.link}
data-active={active || pathname === href || undefined}>
{children}
</UnstyledButton>
);
};
export default NavbarClickable;

View File

@ -0,0 +1,36 @@
import { IconPlus } from "@tabler/icons-react";
import { Stack, Tooltip } from "@mantine/core";
import NavbarClickable from "./NavbarClickable";
type LinkData = {
icon: typeof IconPlus;
label: string;
href: string;
};
type Props = {
linksData: LinkData[];
};
const NavbarLinks = ({ linksData }: Props) => {
return (
<Stack gap={"xs"}>
{linksData.map((linkData, index) => (
<Tooltip
key={index}
display={!linkData.label ? "none" : "flex"}
label={linkData.label}
position="right"
transitionProps={{ duration: 0 }}>
<NavbarClickable
href={linkData.href}
key={linkData.label}>
<linkData.icon />
</NavbarClickable>
</Tooltip>
))}
</Stack>
);
};
export default NavbarLinks;

View File

@ -10,24 +10,29 @@
padding: var(--mantine-spacing-md);
@mixin dark {
box-shadow: var(--dark-thick-shadow);
box-shadow: var(--dark-shadow);
}
@mixin light {
box-shadow: var(--light-thick-shadow);
box-shadow: var(--light-shadow);
}
}
}
.mobile-padding-height {
height: 100vh;
.mobile-margin-height {
height: var(--page-height);
@media (min-width: 48em) {
margin: var(--mantine-spacing-md);
}
}
.container-full-height {
min-height: calc(100vh - (var(--mantine-spacing-md) * 2));
min-height: var(--page-height);
height: var(--page-height);
max-height: var(--page-height);
}
.container-full-height-fixed {
height: calc(100vh - (var(--mantine-spacing-md) * 2));
height: var(--page-height);
}
.container-no-border-radius {

View File

@ -1,9 +1,30 @@
.container {
width: 100%;
height: rem(50px);
border-radius: var(--mantine-radius-md);
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
@mixin light {
color: var(--mantine-color-gray-7);
}
@mixin dark {
background-color: var(--mantine-color-dark-7);
color: var(--mantine-color-dark-0);
}
&:hover {
@mixin light {
background-color: var(--mantine-color-gray-1);
}
@mixin dark {
background-color: var(--mantine-color-dark-6);
}
}
}
.icon {
width: rem(18px);
height: rem(18px);

View File

@ -3,7 +3,7 @@
import { IconMoon, IconSun } from "@tabler/icons-react";
import classNames from "classnames";
import {
ActionIcon,
Button,
useComputedColorScheme,
useMantineColorScheme,
} from "@mantine/core";
@ -20,12 +20,12 @@ export function ColorSchemeToggle() {
};
return (
<ActionIcon
<Button
unstyled
onClick={toggleColorScheme}
variant="default"
size="xl"
radius="lg"
aria-label="Toggle color scheme"
aria-label="Сменить тему"
className={style.container}>
<IconSun
className={classNames(style.icon, style.light)}
@ -35,6 +35,6 @@ export function ColorSchemeToggle() {
className={classNames(style.icon, style.dark)}
stroke={1.5}
/>
</ActionIcon>
</Button>
);
}

View File

@ -0,0 +1,38 @@
import { Center, Image, Stack, Text, Title } from "@mantine/core";
import { myColor } from "@/theme";
type Props = {
title?: string;
};
const Logo = ({ title }: Props) => {
return (
<Stack
align="center"
gap={0}>
<Image
src="/favicon.svg"
alt="LogiDex Logo"
w={70}
/>
<Title
ta={"center"}
order={4}
mt={"xs"}>
LogiDex
</Title>
{title && (
<Center>
<Text
fz={"xs"}
mb={"lg"}
style={{ color: myColor[6], textAlign: "center" }}>
{title}
</Text>
</Center>
)}
</Stack>
);
};
export default Logo;