Skip to content

Commit

Permalink
Merge pull request #30 from chingu-x/suggestions-sidebar
Browse files Browse the repository at this point in the history
suggestions: JSX typescript deprecation error + MainPages as name type?
  • Loading branch information
Dan-Y-Ko authored Sep 23, 2023
2 parents c3bb4d1 + d3aa69e commit ddc6943
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 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
27 changes: 14 additions & 13 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 @@ -12,18 +13,6 @@ import PageButton from "./PageButton";
import VoyagePageButton from "./VoyagePageButton";
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 @@ -40,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 @@ -109,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 Down

0 comments on commit ddc6943

Please sign in to comment.