Managed to style dynamically
This commit is contained in:
parent
e8f6324f84
commit
1b8b238d09
@ -1,15 +1,23 @@
|
|||||||
// PageLinks.tsx
|
|
||||||
|
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { ISidebarLink } from "@/app/features/dashboard/sidebar/SidebarLink.interfaces";
|
import { ISidebarLink } from "@/app/features/dashboard/sidebar/SidebarLink.interfaces";
|
||||||
|
import clsx from "clsx"; // Utility to merge class names
|
||||||
import "./PageLinks.scss";
|
import "./PageLinks.scss";
|
||||||
|
|
||||||
export default function PageLinks({ title, path, icon: Icon }: ISidebarLink) {
|
interface PageLinksProps extends ISidebarLink {
|
||||||
|
className?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function PageLinks({
|
||||||
|
title,
|
||||||
|
path,
|
||||||
|
icon: Icon,
|
||||||
|
className,
|
||||||
|
}: PageLinksProps) {
|
||||||
return (
|
return (
|
||||||
<Link href={path} passHref legacyBehavior>
|
<Link href={path} passHref legacyBehavior>
|
||||||
<a className="link-container">
|
<a className={clsx("link-container", className)}>
|
||||||
{Icon && <Icon />}
|
{Icon && <Icon />}
|
||||||
<span className="link-text">{title}</span>
|
<span className="link-text">{title}</span>
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
@ -0,0 +1,8 @@
|
|||||||
|
/* DropDown.scss */
|
||||||
|
|
||||||
|
.link-container-text {
|
||||||
|
color: var(--text-primary);
|
||||||
|
span {
|
||||||
|
color: var(--text-primary);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,9 +0,0 @@
|
|||||||
import { styled } from "@mui/system";
|
|
||||||
|
|
||||||
export const Em = styled("em")(() => ({
|
|
||||||
display: "flex",
|
|
||||||
alignItems: "center",
|
|
||||||
opacity: 0.7,
|
|
||||||
fontStyle: "normal",
|
|
||||||
color: "white",
|
|
||||||
}));
|
|
||||||
@ -9,8 +9,9 @@ import {
|
|||||||
import ChevronRightIcon from "@mui/icons-material/ChevronRight";
|
import ChevronRightIcon from "@mui/icons-material/ChevronRight";
|
||||||
import { SIDEBAR_LINKS } from "@/app/features/dashboard/sidebar/SidebarLink.constants";
|
import { SIDEBAR_LINKS } from "@/app/features/dashboard/sidebar/SidebarLink.constants";
|
||||||
import { ISidebarLink } from "@/app/features/dashboard/sidebar/SidebarLink.interfaces";
|
import { ISidebarLink } from "@/app/features/dashboard/sidebar/SidebarLink.interfaces";
|
||||||
import { Em } from "./DropDown.styled";
|
import { Em } from "./Em"; // If you still want to create a component for the <em> tag
|
||||||
import PageLinks from "../../../../components/PageLinks/PageLinks";
|
import PageLinks from "../../../../components/PageLinks/PageLinks";
|
||||||
|
import "./DropDown.scss"; // Import the SCSS file
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
onChange?: (event: SelectChangeEvent<string>) => void;
|
onChange?: (event: SelectChangeEvent<string>) => void;
|
||||||
@ -41,10 +42,10 @@ export default function SidebarDropdown({ onChange }: Props) {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<MenuItem value="" disabled>
|
<MenuItem value="" disabled>
|
||||||
<Em>
|
{/* <Em className="em">
|
||||||
Select a page
|
Select a page
|
||||||
<ChevronRightIcon fontSize="small" sx={{ ml: 1 }} />
|
<ChevronRightIcon fontSize="small" sx={{ ml: 1 }} />
|
||||||
</Em>
|
</Em> */}
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
{SIDEBAR_LINKS.map((link: ISidebarLink) => (
|
{SIDEBAR_LINKS.map((link: ISidebarLink) => (
|
||||||
<PageLinks
|
<PageLinks
|
||||||
@ -52,6 +53,7 @@ export default function SidebarDropdown({ onChange }: Props) {
|
|||||||
title={link.title}
|
title={link.title}
|
||||||
path={link.path}
|
path={link.path}
|
||||||
icon={link.icon}
|
icon={link.icon}
|
||||||
|
className="link-container-text"
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</Select>
|
</Select>
|
||||||
|
|||||||
@ -15,6 +15,7 @@
|
|||||||
"@mui/material": "^7.1.2",
|
"@mui/material": "^7.1.2",
|
||||||
"@mui/x-data-grid": "^8.5.2",
|
"@mui/x-data-grid": "^8.5.2",
|
||||||
"@mui/x-date-pickers": "^8.5.3",
|
"@mui/x-date-pickers": "^8.5.3",
|
||||||
|
"clsx": "^2.1.1",
|
||||||
"date-fns": "^4.1.0",
|
"date-fns": "^4.1.0",
|
||||||
"dayjs": "^1.11.13",
|
"dayjs": "^1.11.13",
|
||||||
"file-saver": "^2.0.5",
|
"file-saver": "^2.0.5",
|
||||||
|
|||||||
@ -3,6 +3,14 @@
|
|||||||
:root {
|
:root {
|
||||||
--background: #0a0a0a;
|
--background: #0a0a0a;
|
||||||
--foreground: #ededed;
|
--foreground: #ededed;
|
||||||
|
--primary-color: #{$primary-color};
|
||||||
|
--secondary-color: #{$secondary-color};
|
||||||
|
--background-primary: #{$background-primary};
|
||||||
|
--text-primary: #{$text-primary};
|
||||||
|
--text-secondary: #{$text-secondary};
|
||||||
|
--text-tertiary: #{$text-tertiary};
|
||||||
|
--hover-color: #{$hover-color};
|
||||||
|
--font-family-base: #{$font-family-base};
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (prefers-color-scheme: dark) {
|
@media (prefers-color-scheme: dark) {
|
||||||
|
|||||||
@ -8,14 +8,3 @@ $text-tertiary: #ffffff;
|
|||||||
$hover-color: rgba(0, 0, 0, 0.08);
|
$hover-color: rgba(0, 0, 0, 0.08);
|
||||||
|
|
||||||
$font-family-base: "Roboto", "Helvetica", "Arial", sans-serif;
|
$font-family-base: "Roboto", "Helvetica", "Arial", sans-serif;
|
||||||
|
|
||||||
:root {
|
|
||||||
--primary-color: #{$primary-color};
|
|
||||||
--secondary-color: #{$secondary-color};
|
|
||||||
--background-primary: #{$background-primary};
|
|
||||||
--text-primary: #{$text-primary};
|
|
||||||
--text-secondary: #{$text-secondary};
|
|
||||||
--text-tertiary: #{$text-tertiary};
|
|
||||||
--hover-color: #{$hover-color};
|
|
||||||
--font-family-base: #{$font-family-base};
|
|
||||||
}
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user