Skip to content

Commit

Permalink
Merge branch 'dev' into fix/alignment-of-page-content
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan-Y-Ko authored Sep 24, 2023
2 parents 0c2f9b3 + fe03103 commit b69cfcd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 30 deletions.
3 changes: 1 addition & 2 deletions src/components/sidebar/PageButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export default function PageButton({
setHoveredButton,
}: PageButtonProps) {
const currentPath = usePathname();

const buttonStyles = `${
isOpen ? "w-[14.375rem] flex justify-start pl-6" : "w-[3.125rem]"
} h-[3.125rem] text-base-300 capitalize border-none hover:bg-base-100`;
Expand All @@ -37,7 +36,7 @@ export default function PageButton({

return (
<li>
<Link href={element.name !== String(MainPages.myVoyage) ? link : ""}>
<Link href={element.name !== MainPages.myVoyage ? link : ""}>
<Button
title={element.name}
customClassName={`${buttonStyles} ${getButtonBackgroundStyle(
Expand Down
43 changes: 15 additions & 28 deletions src/components/sidebar/Sidebar.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"use client";

import { useState } from "react";
import type React from "react";
import { usePathname } from "next/navigation";
import {
RectangleGroupIcon,
Expand All @@ -10,21 +11,8 @@ import {
} from "@heroicons/react/24/solid";
import PageButton from "./PageButton";
import VoyagePageButton from "./VoyagePageButton";
import VoyageStatus from "./VoyageStatus";
import ExpandButton from "./ExpandButton";

export type PageProperty = {
name: string;
marginBottom: string;
icon: JSX.Element;
link: string;
};

export type VoyagePageProperty = {
name: string;
link: string;
};

export enum MainPages {
dashboard = "Dashboard",
assessment = "Assessment",
Expand All @@ -41,6 +29,18 @@ export enum VoyagePages {
resources = "Resources",
}

export type VoyagePageProperty = {
name: string;
link: string;
};

export type PageProperty = {
name: MainPages;
marginBottom: string;
icon: React.JSX.Element;
link: string;
};

export const voyagePages: VoyagePageProperty[] = [
{
name: VoyagePages.directory,
Expand Down Expand Up @@ -97,11 +97,6 @@ const pagesProperties: PageProperty[] = [

//-- Mocked fake data just for testing purpose --//
const isVoyageStarted: boolean = true;
const voyageData = {
tier: "Tier 3",
team: "Team",
voyage: "V29",
};
//-- --//

export default function Sidebar() {
Expand All @@ -115,7 +110,7 @@ export default function Sidebar() {
if (typeof element === "string") {
setSelectedButton(element);
setIsOpenSidebar(false);
} else if ((element.name as MainPages) === MainPages.myVoyage) {
} else if (element.name === MainPages.myVoyage) {
setIsOpenSidebar(true);
} else {
setSelectedButton(element.link);
Expand All @@ -127,7 +122,7 @@ export default function Sidebar() {
<aside
className={`overflow-y-auto ${
isOpenSidebar ? "w-[18.438rem]" : "w-[5.813rem]"
} text-center bg-base-200 flex flex-col justify-between`}
} text-center bg-base-200 flex flex-col justify-between border-r border-neutral-content`}
>
<ul
className={`flex flex-col ${
Expand Down Expand Up @@ -161,14 +156,6 @@ export default function Sidebar() {
</ul>
)}
</ul>
<div className="flex-grow flex flex-col justify-end">
{isOpenSidebar && (
<VoyageStatus
isVoyageStarted={isVoyageStarted}
voyageData={voyageData}
/>
)}
</div>
<div className="flex flex-col items-end justify-start border-t border-neutral-content">
<ExpandButton isOpen={isOpenSidebar} onClick={setIsOpenSidebar} />
</div>
Expand Down

0 comments on commit b69cfcd

Please sign in to comment.