Skip to content

Commit

Permalink
Updated sidebar with logo
Browse files Browse the repository at this point in the history
  • Loading branch information
atrincas committed Dec 23, 2024
1 parent 4cefeae commit 3117700
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 8 deletions.
1 change: 1 addition & 0 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
"rooks": "7.14.1",
"tailwind-merge": "2.5.3",
"tailwindcss-animate": "1.0.7",
"usehooks-ts": "^3.1.0",
"zod": "catalog:"
},
"devDependencies": {
Expand Down
Binary file added client/public/logo-full.avif
Binary file not shown.
Binary file added client/public/logo-small.avif
Binary file not shown.
23 changes: 21 additions & 2 deletions client/src/containers/nav/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import { useMemo } from "react";

import Image from "next/image";
import Link from "next/link";
import { usePathname } from "next/navigation";

Expand All @@ -15,8 +16,9 @@ import {
UserIcon,
} from "lucide-react";
import { useSession } from "next-auth/react";
import { useMediaQuery } from "usehooks-ts";

import { cn } from "@/lib/utils";
import { cn, getThemeSize } from "@/lib/utils";

import { useFeatureFlags } from "@/hooks/use-feature-flags";

Expand Down Expand Up @@ -94,11 +96,28 @@ export default function MainNav() {
const footerNavItems = useMemo(() => {
return navItems.footer.filter(() => methodologyPage);
}, [methodologyPage]);
const isMobile = useMediaQuery(`(max-width: ${getThemeSize("md")})`);

return (
<Sidebar collapsible="icon" className="py-6">
<SidebarHeader>
<span>{open ? "Blue Carbon Cost Tool" : "BCCT"}</span>
<span>
{open || (!open && isMobile) ? (
<Image
src="/logo-full.avif"
alt="Blue Carbon Cost Tool"
width={166}
height={56}
/>
) : (
<Image
src="/logo-small.avif"
alt="Blue Carbon Cost Tool"
width={60}
height={56}
/>
)}
</span>
</SidebarHeader>
<SidebarContent>
<SidebarGroup>
Expand Down
15 changes: 15 additions & 0 deletions client/src/lib/utils.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,25 @@
import { clsx, type ClassValue } from "clsx";
import { twMerge } from "tailwind-merge";
import resolveConfig from "tailwindcss/resolveConfig";

import { formatCurrency } from "@/lib/format";

import { CostItem } from "@/containers/projects/custom-project/cost-details/table";

import tailwindConfig from "@/../tailwind.config";

const { theme } = resolveConfig(tailwindConfig);

export const getThemeSize = (size: keyof typeof theme.screens) => {
if (theme?.screens && size in theme?.screens) {
return theme?.screens?.[size];
}

console.error(`Theme size ${size} not found`);

return "";
};

export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs));
}
Expand Down
26 changes: 20 additions & 6 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 3117700

Please sign in to comment.