From 171190eaa6cf7d55760f57279f03c21c372bd041 Mon Sep 17 00:00:00 2001 From: xn1cklas Date: Sat, 7 Sep 2024 20:00:39 +0200 Subject: [PATCH] chore: minimize dependencies --- package.json | 3 - pnpm-lock.yaml | 54 ------ src/app/page.tsx | 5 - src/components/Auth/GetStartedButton.tsx | 45 ----- src/components/BrandingMenu.tsx | 117 ++---------- src/components/Pricing.tsx | 2 + src/components/TopbarNavigation.tsx | 216 +---------------------- src/components/ui/dropdown-menu.tsx | 205 --------------------- src/components/ui/popover.tsx | 33 ---- 9 files changed, 26 insertions(+), 654 deletions(-) delete mode 100644 src/components/Auth/GetStartedButton.tsx delete mode 100644 src/components/ui/dropdown-menu.tsx delete mode 100644 src/components/ui/popover.tsx diff --git a/package.json b/package.json index 6d25ad8..dc4f704 100644 --- a/package.json +++ b/package.json @@ -10,9 +10,6 @@ }, "dependencies": { "@radix-ui/react-dropdown-menu": "^2.1.1", - "@radix-ui/react-icons": "^1.3.0", - "@radix-ui/react-popover": "^1.1.1", - "@radix-ui/react-slot": "^1.1.0", "class-variance-authority": "^0.7.0", "clsx": "^2.1.1", "lucide-react": "^0.439.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2c08e03..44c9aca 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -11,15 +11,6 @@ importers: '@radix-ui/react-dropdown-menu': specifier: ^2.1.1 version: 2.1.1(@types/react-dom@18.3.0)(@types/react@18.3.5)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - '@radix-ui/react-icons': - specifier: ^1.3.0 - version: 1.3.0(react@18.3.1) - '@radix-ui/react-popover': - specifier: ^1.1.1 - version: 1.1.1(@types/react-dom@18.3.0)(@types/react@18.3.5)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - '@radix-ui/react-slot': - specifier: ^1.1.0 - version: 1.1.0(@types/react@18.3.5)(react@18.3.1) class-variance-authority: specifier: ^0.7.0 version: 0.7.0 @@ -328,11 +319,6 @@ packages: '@types/react-dom': optional: true - '@radix-ui/react-icons@1.3.0': - resolution: {integrity: sha512-jQxj/0LKgp+j9BiTXz3O3sgs26RNet2iLWmsPyRz2SIcR4q/4SbazXfnYwbAr+vLYKSfc7qxzyGQA1HLlYiuNw==} - peerDependencies: - react: ^16.x || ^17.x || ^18.x - '@radix-ui/react-id@1.1.0': resolution: {integrity: sha512-EJUrI8yYh7WOjNOqpoJaf1jlFIH2LvtgAl+YcFqNCa+4hj64ZXmPkAKOFs/ukjz3byN6bdb/AVUqHkI8/uWWMA==} peerDependencies: @@ -355,19 +341,6 @@ packages: '@types/react-dom': optional: true - '@radix-ui/react-popover@1.1.1': - resolution: {integrity: sha512-3y1A3isulwnWhvTTwmIreiB8CF4L+qRjZnK1wYLO7pplddzXKby/GnZ2M7OZY3qgnl6p9AodUIHRYGXNah8Y7g==} - peerDependencies: - '@types/react': '*' - '@types/react-dom': '*' - react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc - react-dom: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc - peerDependenciesMeta: - '@types/react': - optional: true - '@types/react-dom': - optional: true - '@radix-ui/react-popper@1.2.0': resolution: {integrity: sha512-ZnRMshKF43aBxVWPWvbj21+7TQCvhuULWJ4gNIKYpRlQt5xGRhLx66tMp8pya2UkGHTSlhpXwmjqltDYHhw7Vg==} peerDependencies: @@ -2185,10 +2158,6 @@ snapshots: '@types/react': 18.3.5 '@types/react-dom': 18.3.0 - '@radix-ui/react-icons@1.3.0(react@18.3.1)': - dependencies: - react: 18.3.1 - '@radix-ui/react-id@1.1.0(@types/react@18.3.5)(react@18.3.1)': dependencies: '@radix-ui/react-use-layout-effect': 1.1.0(@types/react@18.3.5)(react@18.3.1) @@ -2222,29 +2191,6 @@ snapshots: '@types/react': 18.3.5 '@types/react-dom': 18.3.0 - '@radix-ui/react-popover@1.1.1(@types/react-dom@18.3.0)(@types/react@18.3.5)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)': - dependencies: - '@radix-ui/primitive': 1.1.0 - '@radix-ui/react-compose-refs': 1.1.0(@types/react@18.3.5)(react@18.3.1) - '@radix-ui/react-context': 1.1.0(@types/react@18.3.5)(react@18.3.1) - '@radix-ui/react-dismissable-layer': 1.1.0(@types/react-dom@18.3.0)(@types/react@18.3.5)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - '@radix-ui/react-focus-guards': 1.1.0(@types/react@18.3.5)(react@18.3.1) - '@radix-ui/react-focus-scope': 1.1.0(@types/react-dom@18.3.0)(@types/react@18.3.5)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - '@radix-ui/react-id': 1.1.0(@types/react@18.3.5)(react@18.3.1) - '@radix-ui/react-popper': 1.2.0(@types/react-dom@18.3.0)(@types/react@18.3.5)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - '@radix-ui/react-portal': 1.1.1(@types/react-dom@18.3.0)(@types/react@18.3.5)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - '@radix-ui/react-presence': 1.1.0(@types/react-dom@18.3.0)(@types/react@18.3.5)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - '@radix-ui/react-primitive': 2.0.0(@types/react-dom@18.3.0)(@types/react@18.3.5)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - '@radix-ui/react-slot': 1.1.0(@types/react@18.3.5)(react@18.3.1) - '@radix-ui/react-use-controllable-state': 1.1.0(@types/react@18.3.5)(react@18.3.1) - aria-hidden: 1.2.4 - react: 18.3.1 - react-dom: 18.3.1(react@18.3.1) - react-remove-scroll: 2.5.7(@types/react@18.3.5)(react@18.3.1) - optionalDependencies: - '@types/react': 18.3.5 - '@types/react-dom': 18.3.0 - '@radix-ui/react-popper@1.2.0(@types/react-dom@18.3.0)(@types/react@18.3.5)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)': dependencies: '@floating-ui/react-dom': 2.1.1(react-dom@18.3.1(react@18.3.1))(react@18.3.1) diff --git a/src/app/page.tsx b/src/app/page.tsx index 5df92f6..ea52a4d 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -1,10 +1,5 @@ -"use client"; - import { Pricing } from "@/components/Pricing"; -// import GetStartedButton from "@/components/Auth/GetStartedButton"; -// import Button from "@/components/ui/atoms/button"; - export default function Page() { return (
diff --git a/src/components/Auth/GetStartedButton.tsx b/src/components/Auth/GetStartedButton.tsx deleted file mode 100644 index 5e698f6..0000000 --- a/src/components/Auth/GetStartedButton.tsx +++ /dev/null @@ -1,45 +0,0 @@ -import { CONFIG } from "@/utils/config"; -import Link from "next/link"; -import Button from "@/components/ui/atoms/button"; -import { ComponentProps } from "react"; -import { twMerge } from "tailwind-merge"; -import { ArrowRight } from "lucide-react"; - -interface GetStartedButtonProps extends ComponentProps { - text?: string; - href?: string; -} - -const GetStartedButton: React.FC = ({ - text: _text, - href: _href, - wrapperClassNames, - size = "lg", - ...props -}) => { - const text = _text || "Get started"; - - const signupPath = `${CONFIG.FRONTEND_BASE_URL}/signup?return_to/dashboard`; - const href = _href ? _href : signupPath; - - return ( - - - - ); -}; - -export default GetStartedButton; diff --git a/src/components/BrandingMenu.tsx b/src/components/BrandingMenu.tsx index 821bac2..9203ebb 100644 --- a/src/components/BrandingMenu.tsx +++ b/src/components/BrandingMenu.tsx @@ -1,24 +1,10 @@ "use client"; import LogoIcon from "@/components/Brand/LogoIcon"; -// import { -// ArrowDownwardOutlined, -// ContentPasteOutlined, -// } from "@mui/icons-material"; import Link from "next/link"; - import LogoType from "@/components/Brand/LogoType"; -import { useOutsideClick } from "@/utils/useOutsideClick"; -import { - DropdownMenu, - DropdownMenuContent, - DropdownMenuItem, - DropdownMenuLabel, - DropdownMenuTrigger, -} from "@/components/ui/dropdown-menu"; -import { MouseEventHandler, useCallback, useRef, useState } from "react"; + import { twMerge } from "tailwind-merge"; -import { ArrowDown, ClipboardPasteIcon } from "lucide-react"; export const BrandingMenu = ({ logoVariant = "icon", @@ -31,95 +17,24 @@ export const BrandingMenu = ({ className?: string; logoClassName?: string; }) => { - const brandingMenuRef = useRef(null); - - useOutsideClick([brandingMenuRef], () => setBrandingMenuOpen(false)); - - const [brandingMenuOpen, setBrandingMenuOpen] = useState(false); - - const handleTriggerClick: MouseEventHandler = useCallback( - (e) => { - e.preventDefault(); - e.stopPropagation(); - setBrandingMenuOpen(true); - }, - [] - ); - - const handleCopyLogoToClipboard = useCallback(() => { - navigator.clipboard.writeText( - logoVariant === "icon" ? PolarIconSVGString : PolarLogoSVGString - ); - setBrandingMenuOpen(false); - }, [logoVariant]); - return (
- - - - {logoVariant === "logotype" ? ( - - ) : ( - + + {logoVariant === "logotype" ? ( + - - - Platform - - - Copy Logo as SVG - - setBrandingMenuOpen(false)} - > - - - Download Branding Assets - - - - + width={size ?? 100} + /> + ) : ( + + )} +
); }; - -const PolarIconSVGString = ` - - - - - - - - -`; - -const PolarLogoSVGString = ` - - - - - - - - - -`; diff --git a/src/components/Pricing.tsx b/src/components/Pricing.tsx index 89a35da..5fc9a1a 100644 --- a/src/components/Pricing.tsx +++ b/src/components/Pricing.tsx @@ -1,3 +1,5 @@ +"use client"; + import { CheckIcon } from "lucide-react"; import { useState } from "react"; import { Button } from "./ui/button"; diff --git a/src/components/TopbarNavigation.tsx b/src/components/TopbarNavigation.tsx index b687bcb..e4e3b1b 100644 --- a/src/components/TopbarNavigation.tsx +++ b/src/components/TopbarNavigation.tsx @@ -1,222 +1,22 @@ -import useDebouncedCallback from "@/hooks/utils"; -// import { ArrowForward } from "@mui/icons-material"; import Link from "next/link"; -import { - Popover, - PopoverContent, - PopoverTrigger, -} from "@/components/ui/popover"; -import { useState } from "react"; - -const PopoverLinkItem = ({ - title, - description, - link, -}: { - title: string; - description: string; - link: string; -}) => { - return ( - - - {/* */} -

{title}

-
- - {description} - - - ); -}; - -const PlatformPopover = () => { - const [isOpen, setIsOpen] = useState(false); - - const togglePopover = useDebouncedCallback((toggle: boolean) => { - setIsOpen(toggle); - }, 100); - - return ( - - { - togglePopover(true); - }} - onMouseLeave={() => { - togglePopover(false); - }} - > - Platform - -
-

Features

-
- - - - -
-
-
-

Offer Built-in Benefits

-
- - - - - - - -
-
-
-
-
- ); -}; - -const DocumentationPopover = () => { - const [isOpen, setIsOpen] = useState(false); - - const togglePopover = useDebouncedCallback((toggle: boolean) => { - setIsOpen(toggle); - }, 100); - - return ( - - { - togglePopover(true); - }} - onMouseLeave={() => { - togglePopover(false); - }} - > - Docs - -
-

Documentation

-
- - - -
-
-
-

API

-
- - - - - -
-
-
-
-
- ); -}; export const TopbarNavigation = () => { return (
- - Pricing + + Docs +
); }; diff --git a/src/components/ui/dropdown-menu.tsx b/src/components/ui/dropdown-menu.tsx deleted file mode 100644 index 242b07a..0000000 --- a/src/components/ui/dropdown-menu.tsx +++ /dev/null @@ -1,205 +0,0 @@ -"use client" - -import * as React from "react" -import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu" -import { - CheckIcon, - ChevronRightIcon, - DotFilledIcon, -} from "@radix-ui/react-icons" - -import { cn } from "@/lib/utils" - -const DropdownMenu = DropdownMenuPrimitive.Root - -const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger - -const DropdownMenuGroup = DropdownMenuPrimitive.Group - -const DropdownMenuPortal = DropdownMenuPrimitive.Portal - -const DropdownMenuSub = DropdownMenuPrimitive.Sub - -const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup - -const DropdownMenuSubTrigger = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef & { - inset?: boolean - } ->(({ className, inset, children, ...props }, ref) => ( - - {children} - - -)) -DropdownMenuSubTrigger.displayName = - DropdownMenuPrimitive.SubTrigger.displayName - -const DropdownMenuSubContent = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - -)) -DropdownMenuSubContent.displayName = - DropdownMenuPrimitive.SubContent.displayName - -const DropdownMenuContent = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, sideOffset = 4, ...props }, ref) => ( - - - -)) -DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName - -const DropdownMenuItem = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef & { - inset?: boolean - } ->(({ className, inset, ...props }, ref) => ( - -)) -DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName - -const DropdownMenuCheckboxItem = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, children, checked, ...props }, ref) => ( - - - - - - - {children} - -)) -DropdownMenuCheckboxItem.displayName = - DropdownMenuPrimitive.CheckboxItem.displayName - -const DropdownMenuRadioItem = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, children, ...props }, ref) => ( - - - - - - - {children} - -)) -DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName - -const DropdownMenuLabel = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef & { - inset?: boolean - } ->(({ className, inset, ...props }, ref) => ( - -)) -DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName - -const DropdownMenuSeparator = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - -)) -DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName - -const DropdownMenuShortcut = ({ - className, - ...props -}: React.HTMLAttributes) => { - return ( - - ) -} -DropdownMenuShortcut.displayName = "DropdownMenuShortcut" - -export { - DropdownMenu, - DropdownMenuTrigger, - DropdownMenuContent, - DropdownMenuItem, - DropdownMenuCheckboxItem, - DropdownMenuRadioItem, - DropdownMenuLabel, - DropdownMenuSeparator, - DropdownMenuShortcut, - DropdownMenuGroup, - DropdownMenuPortal, - DropdownMenuSub, - DropdownMenuSubContent, - DropdownMenuSubTrigger, - DropdownMenuRadioGroup, -} diff --git a/src/components/ui/popover.tsx b/src/components/ui/popover.tsx deleted file mode 100644 index 29c7bd2..0000000 --- a/src/components/ui/popover.tsx +++ /dev/null @@ -1,33 +0,0 @@ -"use client" - -import * as React from "react" -import * as PopoverPrimitive from "@radix-ui/react-popover" - -import { cn } from "@/lib/utils" - -const Popover = PopoverPrimitive.Root - -const PopoverTrigger = PopoverPrimitive.Trigger - -const PopoverAnchor = PopoverPrimitive.Anchor - -const PopoverContent = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, align = "center", sideOffset = 4, ...props }, ref) => ( - - - -)) -PopoverContent.displayName = PopoverPrimitive.Content.displayName - -export { Popover, PopoverTrigger, PopoverContent, PopoverAnchor }