Skip to content

Commit

Permalink
more fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
codekansas committed Aug 2, 2024
1 parent 259f363 commit 78d70df
Showing 1 changed file with 40 additions and 13 deletions.
53 changes: 40 additions & 13 deletions frontend/src/components/nav/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,48 @@ interface SidebarItemProps {
icon?: JSX.Element;
onClick?: () => void;
size?: "sm" | "md" | "lg";
align?: "left" | "right";
}

const SidebarItem = ({ icon, title, onClick, size }: SidebarItemProps) => {
const SidebarItem = ({
icon,
title,
onClick,
size,
align,
}: SidebarItemProps) => {
return (
<li>
<button onClick={onClick} className="w-full focus:outline-none">
<span className="flex items-center py-2 px-4 text-gray-900 rounded-lg dark:text-white hover:bg-gray-100 dark:hover:bg-gray-700 group">
{icon}
{/* <span className={icon && "ms-5"}>{title}</span> */}
<span
className={clsx(
icon && "ms-5",
size === "sm" && "text-sm",
size === "lg" && "text-lg",
)}
>
{title}
</span>
{align === "right" ? (
<>
<span className="flex-grow" />
<span
className={clsx(
icon && "mr-4",
size === "sm" && "text-sm",
size === "lg" && "text-lg",
)}
>
{title}
</span>
{icon}
</>
) : (
<>
{icon}
<span
className={clsx(
icon && "ml-4",
size === "sm" && "text-sm",
size === "lg" && "text-lg",
)}
>
{title}
</span>
</>
)}
</span>
</button>
</li>
Expand Down Expand Up @@ -160,7 +184,7 @@ const Sidebar = ({ show, onClose }: Props) => {
</ul>
</div>
{/* Aligned to bottom */}
<div className="absolute bottom-4 w-full">
<div className="absolute bottom-4 right-4">
<ul className="space-y-1 font-medium mt-4">
<SidebarItem
title="About"
Expand All @@ -170,6 +194,7 @@ const Sidebar = ({ show, onClose }: Props) => {
onClose();
}}
size="sm"
align="right"
/>
<SidebarItem
title="Privacy Policy"
Expand All @@ -179,6 +204,7 @@ const Sidebar = ({ show, onClose }: Props) => {
onClose();
}}
size="sm"
align="right"
/>
<SidebarItem
title="Terms of Service"
Expand All @@ -188,6 +214,7 @@ const Sidebar = ({ show, onClose }: Props) => {
onClose();
}}
size="sm"
align="right"
/>
</ul>
</div>
Expand Down

0 comments on commit 78d70df

Please sign in to comment.