Skip to content

Commit

Permalink
Vite Migration Fixes (#269)
Browse files Browse the repository at this point in the history
* fixed navbar always rendering

* fix sidebar styling and improved mobile styles

* added tailwind to vite config, styling fixed
  • Loading branch information
Winston-Hsiao authored Aug 7, 2024
1 parent d998cf4 commit 19e5672
Show file tree
Hide file tree
Showing 7 changed files with 163 additions and 143 deletions.
8 changes: 5 additions & 3 deletions frontend/src/components/footer/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const Footer = () => {
<footer className="bg-gray-50 dark:bg-gray-800 text-sm py-20">
<div className="flex flex-col gap-4 mx-12 sm:mx-36">
<div className="flex flex-row justify-between items-center">
<span className="text-2xl">K-Scale Labs</span>
<span className="text-xl sm:text-2xl">K-Scale Labs</span>
<div className="flex flex-row gap-4 rounded-full">
<SocialLink
href="https://www.linkedin.com/company/kscale"
Expand Down Expand Up @@ -57,7 +57,7 @@ const Footer = () => {
</div>
<div className="flex flex-row gap-32 sm:gap-56 md:gap-64">
<div className="flex flex-col items-start gap-2 sm:gap-3">
<h2 className="text-lg font-semibold mb-1">Company</h2>
<h2 className="text-base sm:text-lg font-semibold mb-1">Company</h2>
<a
href="https://kscale.dev/about/"
className="hover:text-gray-500"
Expand All @@ -74,7 +74,9 @@ const Footer = () => {
</a>
</div>
<div className="flex flex-col items-start gap-2 sm:gap-3">
<h2 className="text-lg font-semibold mb-1">Buy and Sell</h2>
<h2 className="text-base sm:text-lg font-semibold mb-1">
Buy and Sell
</h2>
<Link to={"/browse"} className="hover:text-gray-500">
Robots
</Link>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/listing/FileUpload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ import {
useDropzone,
} from "react-dropzone";

import { useAlertQueue } from "hooks/useAlertQueue";
import { Trash2 as RemoveIcon } from "lucide-react";
import { cn } from "utils";

import { buttonVariants } from "components/ui/Button/Button";
import { Input } from "components/ui/Input/Input";
import { useAlertQueue } from "hooks/useAlertQueue";

type DirectionOptions = "rtl" | "ltr" | undefined;

Expand Down
265 changes: 134 additions & 131 deletions frontend/src/components/nav/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,138 +87,141 @@ const Sidebar = ({ show, onClose }: Props) => {
const { isAuthenticated } = useAuthentication();

return (
<div
className={clsx(
!show && "translate-x-full",
"fixed top-0 right-0 z-40 w-64 h-screen p-4 overflow-y-auto transition-transform bg-white dark:bg-gray-800",
)}
tabIndex={-1}
>
<h5
id="drawer-navigation-label"
className="text-base font-semibold text-gray-500 uppercase dark:text-gray-300"
>
SETTINGS
</h5>
<div>
{show ? (
<div
className="fixed top-0 right-0 z-40 w-full sm:w-64 h-screen p-4 overflow-y-auto transition-transform bg-white dark:bg-gray-800"
tabIndex={-1}
>
<div className="flex justify-between items-center">
<h5
id="drawer-navigation-label"
className="text-base font-semibold text-gray-500 uppercase dark:text-gray-300"
>
SETTINGS
</h5>

<button
type="button"
onClick={onClose}
className="text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm p-1.5 absolute top-2.5 end-2.5 inline-flex items-center dark:hover:bg-gray-600 dark:hover:text-white"
>
<FaTimes />
<span className="sr-only">Close menu</span>
</button>
<div className="py-4 overflow-y-auto">
<ul className="space-y-1">
<SidebarItem
title="Home"
icon={<FaHome />}
onClick={() => {
navigate("/");
onClose();
}}
size="md"
/>
<SidebarItem
title="Browse"
icon={<FaBookOpen />}
onClick={() => {
navigate("/browse");
onClose();
}}
size="md"
/>
<SidebarItem
title="Create"
icon={<FaPen />}
onClick={() => {
navigate("/create");
onClose();
}}
size="md"
/>
<SidebarSeparator />
{isAuthenticated && (
<SidebarItem
title="Profile"
icon={<FaUserCircle />}
onClick={() => {
navigate("/profile");
onClose();
}}
size="md"
/>
)}
{isAuthenticated && (
<SidebarItem
title="API Keys"
icon={<FaKey />}
onClick={() => {
navigate("/keys");
onClose();
}}
size="md"
/>
)}
{isAuthenticated ? (
<SidebarItem
title="Logout"
icon={<FaDoorClosed />}
onClick={() => {
navigate("/logout");
onClose();
}}
size="md"
/>
) : (
<SidebarItem
title="Login / Sign Up"
icon={<FaDoorOpen />}
onClick={() => {
navigate("/login");
onClose();
}}
size="md"
/>
)}
</ul>
</div>
{/* Aligned to bottom */}
<div className="absolute bottom-4 right-4">
<ul className="space-y-1 font-medium mt-4">
<SidebarItem
title="About"
icon={<FaQuestion />}
onClick={() => {
navigate("/about");
onClose();
}}
size="sm"
align="right"
/>
<SidebarItem
title="Privacy Policy"
icon={<FaLock />}
onClick={() => {
navigate("/privacy");
onClose();
}}
size="sm"
align="right"
/>
<SidebarItem
title="Terms of Service"
icon={<FaScroll />}
onClick={() => {
navigate("/tos");
onClose();
}}
size="sm"
align="right"
/>
</ul>
</div>
<button
type="button"
onClick={onClose}
className="text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm p-1.5 inline-flex items-center dark:hover:bg-gray-600 dark:hover:text-white"
>
<FaTimes />
<span className="sr-only">Close menu</span>
</button>
</div>
<div className="py-4 overflow-y-auto">
<ul className="space-y-1">
<SidebarItem
title="Home"
icon={<FaHome />}
onClick={() => {
navigate("/");
onClose();
}}
size="md"
/>
<SidebarItem
title="Browse"
icon={<FaBookOpen />}
onClick={() => {
navigate("/browse");
onClose();
}}
size="md"
/>
<SidebarItem
title="Create"
icon={<FaPen />}
onClick={() => {
navigate("/create");
onClose();
}}
size="md"
/>
<SidebarSeparator />
{isAuthenticated && (
<SidebarItem
title="Profile"
icon={<FaUserCircle />}
onClick={() => {
navigate("/profile");
onClose();
}}
size="md"
/>
)}
{isAuthenticated && (
<SidebarItem
title="API Keys"
icon={<FaKey />}
onClick={() => {
navigate("/keys");
onClose();
}}
size="md"
/>
)}
{isAuthenticated ? (
<SidebarItem
title="Logout"
icon={<FaDoorClosed />}
onClick={() => {
navigate("/logout");
onClose();
}}
size="md"
/>
) : (
<SidebarItem
title="Login / Sign Up"
icon={<FaDoorOpen />}
onClick={() => {
navigate("/login");
onClose();
}}
size="md"
/>
)}
</ul>
</div>
{/* Aligned to bottom */}
<div className="absolute bottom-4 right-4">
<ul className="space-y-1 font-medium mt-4">
<SidebarItem
title="About"
icon={<FaQuestion />}
onClick={() => {
navigate("/about");
onClose();
}}
size="sm"
align="right"
/>
<SidebarItem
title="Privacy Policy"
icon={<FaLock />}
onClick={() => {
navigate("/privacy");
onClose();
}}
size="sm"
align="right"
/>
<SidebarItem
title="Terms of Service"
icon={<FaScroll />}
onClick={() => {
navigate("/tos");
onClose();
}}
size="sm"
align="right"
/>
</ul>
</div>
</div>
) : null}
</div>
);
};
Expand Down
12 changes: 4 additions & 8 deletions frontend/src/pages/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,14 @@ const Home = () => {
<Button
onClick={() => navigate(`/browse`)}
variant="primary"
size="lg"
>
size="lg">
Browse
<FaArrowRight className="ml-2" />
</Button>
<Button
onClick={() => navigate(`/create`)}
variant="secondary"
size="lg"
>
size="lg">
Create
</Button>
</div>
Expand All @@ -79,16 +77,14 @@ const Home = () => {
<Button
onClick={() => navigate(`/browse`)}
variant="primary"
size="lg"
>
size="lg">
Browse
<FaArrowRight className="ml-2" />
</Button>
<Button
onClick={() => navigate(`/create`)}
variant="secondary"
size="lg"
>
size="lg">
Create
</Button>
</div>
Expand Down
7 changes: 7 additions & 0 deletions frontend/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
import tailwindcss from "tailwindcss";

import react from "@vitejs/plugin-react";
import { defineConfig } from "vite";
import tsconfigPaths from "vite-tsconfig-paths";

export default defineConfig({
plugins: [react(), tsconfigPaths()],
css: {
postcss: {
plugins: [tailwindcss()],
},
},
resolve: {
alias: {
"@": "/src",
Expand Down
6 changes: 6 additions & 0 deletions node_modules/.package-lock.json

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

6 changes: 6 additions & 0 deletions package-lock.json

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

0 comments on commit 19e5672

Please sign in to comment.