From 23b69dd928f17dbdfb40e8d745ad69dfcd1adf9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20Alexander=20Str=C3=B8mseng?= Date: Sat, 13 Apr 2024 23:06:33 +0200 Subject: [PATCH] 125 move shadcn components to seperate folder with name shadcn configure componentsjson (#286) * refactor(frontend): :recycle: move shadcn components to shadcn directory * fix build errors --- frontend/components.json | 3 ++- frontend/src/app/blog/[articleSlug]/loading.tsx | 2 +- frontend/src/app/blog/[articleSlug]/page.tsx | 2 +- frontend/src/app/blog/loading.tsx | 2 +- frontend/src/app/loading.tsx | 2 +- frontend/src/app/page.tsx | 2 +- frontend/src/app/projects/[projectSlug]/loading.tsx | 2 +- frontend/src/app/projects/loading.tsx | 2 +- frontend/src/app/projects/page.tsx | 7 ++++++- frontend/src/app/satellites/loading.tsx | 2 +- frontend/src/components/BlogPaginator.tsx | 2 +- frontend/src/components/BlogpageButtons.tsx | 2 +- frontend/src/components/HeroWrapper.tsx | 2 +- frontend/src/components/Navbar.tsx | 8 ++++++-- frontend/src/components/RelatedProjectsAndSatellites.tsx | 7 ++++++- .../src/components/satelliteData/SatelliteStatsTable.tsx | 2 +- frontend/src/components/{ui => shadcn}/avatar.tsx | 0 frontend/src/components/{ui => shadcn}/button.tsx | 0 frontend/src/components/{ui => shadcn}/card.tsx | 0 frontend/src/components/{ui => shadcn}/command.tsx | 2 +- frontend/src/components/{ui => shadcn}/dialog.tsx | 0 frontend/src/components/{ui => shadcn}/drawer.tsx | 0 frontend/src/components/{ui => shadcn}/dropdown-menu.tsx | 0 frontend/src/components/{ui => shadcn}/label.tsx | 0 frontend/src/components/{ui => shadcn}/pagination.tsx | 2 +- frontend/src/components/{ui => shadcn}/popover.tsx | 0 frontend/src/components/{ui => shadcn}/skeleton.tsx | 0 frontend/src/components/{ui => shadcn}/table.tsx | 0 frontend/src/components/ui/satelliteCard.tsx | 7 ++++++- frontend/tsconfig.json | 1 + 30 files changed, 41 insertions(+), 20 deletions(-) rename frontend/src/components/{ui => shadcn}/avatar.tsx (100%) rename frontend/src/components/{ui => shadcn}/button.tsx (100%) rename frontend/src/components/{ui => shadcn}/card.tsx (100%) rename frontend/src/components/{ui => shadcn}/command.tsx (98%) rename frontend/src/components/{ui => shadcn}/dialog.tsx (100%) rename frontend/src/components/{ui => shadcn}/drawer.tsx (100%) rename frontend/src/components/{ui => shadcn}/dropdown-menu.tsx (100%) rename frontend/src/components/{ui => shadcn}/label.tsx (100%) rename frontend/src/components/{ui => shadcn}/pagination.tsx (97%) rename frontend/src/components/{ui => shadcn}/popover.tsx (100%) rename frontend/src/components/{ui => shadcn}/skeleton.tsx (100%) rename frontend/src/components/{ui => shadcn}/table.tsx (100%) diff --git a/frontend/components.json b/frontend/components.json index 393d2cf..392fa1d 100644 --- a/frontend/components.json +++ b/frontend/components.json @@ -12,6 +12,7 @@ }, "aliases": { "components": "@/components", - "utils": "@/lib/utils" + "utils": "@/lib/utils", + "ui": "@/components/shadcn" } } diff --git a/frontend/src/app/blog/[articleSlug]/loading.tsx b/frontend/src/app/blog/[articleSlug]/loading.tsx index a7ed856..0ccf7c1 100644 --- a/frontend/src/app/blog/[articleSlug]/loading.tsx +++ b/frontend/src/app/blog/[articleSlug]/loading.tsx @@ -1,4 +1,4 @@ -import { Skeleton } from "@/components/ui/skeleton"; +import { Skeleton } from "@shadcn/skeleton"; import React from "react"; export default function Loading() { diff --git a/frontend/src/app/blog/[articleSlug]/page.tsx b/frontend/src/app/blog/[articleSlug]/page.tsx index d450d7c..5558f72 100644 --- a/frontend/src/app/blog/[articleSlug]/page.tsx +++ b/frontend/src/app/blog/[articleSlug]/page.tsx @@ -1,4 +1,4 @@ -import { Avatar, AvatarFallback } from "@/components/ui/avatar"; +import { Avatar, AvatarFallback } from "@shadcn/avatar"; import { BlocksContent } from "@strapi/blocks-react-renderer"; import BlockRendererClient from "@/components/BlockRendererClient"; diff --git a/frontend/src/app/blog/loading.tsx b/frontend/src/app/blog/loading.tsx index 0b9e862..0ecdef9 100644 --- a/frontend/src/app/blog/loading.tsx +++ b/frontend/src/app/blog/loading.tsx @@ -1,4 +1,4 @@ -import { Skeleton } from "@/components/ui/skeleton"; +import { Skeleton } from "@shadcn/skeleton"; import React from "react"; export default function Loading() { diff --git a/frontend/src/app/loading.tsx b/frontend/src/app/loading.tsx index a60b963..ee0128c 100644 --- a/frontend/src/app/loading.tsx +++ b/frontend/src/app/loading.tsx @@ -3,7 +3,7 @@ import { SkeletonHero, SkeletonSection, EmptySection, -} from "@/components/ui/skeleton"; +} from "@shadcn/skeleton"; import React from "react"; export default function Loading() { diff --git a/frontend/src/app/page.tsx b/frontend/src/app/page.tsx index 0cda91a..249fc29 100644 --- a/frontend/src/app/page.tsx +++ b/frontend/src/app/page.tsx @@ -1,4 +1,4 @@ -import { Button } from "@/components/ui/button"; +import { Button } from "@shadcn/button"; import ColoredSection from "@/components/ui/coloredSection"; import Image from "next/image"; diff --git a/frontend/src/app/projects/[projectSlug]/loading.tsx b/frontend/src/app/projects/[projectSlug]/loading.tsx index 6696311..88f1dfd 100644 --- a/frontend/src/app/projects/[projectSlug]/loading.tsx +++ b/frontend/src/app/projects/[projectSlug]/loading.tsx @@ -1,7 +1,7 @@ import React from "react"; // Assuming the correct import path for the Skeleton component -import { Skeleton } from "@/components/ui/skeleton"; +import { Skeleton } from "@shadcn/skeleton"; export default function Loading() { return ( diff --git a/frontend/src/app/projects/loading.tsx b/frontend/src/app/projects/loading.tsx index 727ecc0..f003a83 100644 --- a/frontend/src/app/projects/loading.tsx +++ b/frontend/src/app/projects/loading.tsx @@ -1,7 +1,7 @@ import React from "react"; // Assuming the correct import path for the Skeleton component -import { Skeleton } from "@/components/ui/skeleton"; +import { Skeleton } from "@shadcn/skeleton"; export default function Loading() { // Create an array with the specified number of satellites diff --git a/frontend/src/app/projects/page.tsx b/frontend/src/app/projects/page.tsx index 9c5270c..a1fbf22 100644 --- a/frontend/src/app/projects/page.tsx +++ b/frontend/src/app/projects/page.tsx @@ -1,5 +1,10 @@ import { gql } from "@/__generated__/gql"; -import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; +import { + Card, + CardContent, + CardHeader, + CardTitle, +} from "@/components/shadcn/card"; import { getClient } from "@/lib/ApolloClient"; import Link from "next/link"; import Image from "next/image"; diff --git a/frontend/src/app/satellites/loading.tsx b/frontend/src/app/satellites/loading.tsx index c0fe957..3ed65d0 100644 --- a/frontend/src/app/satellites/loading.tsx +++ b/frontend/src/app/satellites/loading.tsx @@ -1,4 +1,4 @@ -import { Skeleton } from "@/components/ui/skeleton"; +import { Skeleton } from "@shadcn/skeleton"; import React from "react"; export default function Loading() { diff --git a/frontend/src/components/BlogPaginator.tsx b/frontend/src/components/BlogPaginator.tsx index 87c317b..6797dcd 100644 --- a/frontend/src/components/BlogPaginator.tsx +++ b/frontend/src/components/BlogPaginator.tsx @@ -7,7 +7,7 @@ import { PaginationLink, PaginationNext, PaginationPrevious, -} from "./ui/pagination"; +} from "./shadcn/pagination"; import { useRouter, useSearchParams } from "next/navigation"; export default function BlogPaginator({ diff --git a/frontend/src/components/BlogpageButtons.tsx b/frontend/src/components/BlogpageButtons.tsx index ca5010d..499065d 100644 --- a/frontend/src/components/BlogpageButtons.tsx +++ b/frontend/src/components/BlogpageButtons.tsx @@ -1,6 +1,6 @@ "use client"; import { useState } from "react"; -import { Button } from "./ui/button"; +import { Button } from "./shadcn/button"; import { useRouter, useSearchParams } from "next/navigation"; import { cn } from "@/lib/utils"; diff --git a/frontend/src/components/HeroWrapper.tsx b/frontend/src/components/HeroWrapper.tsx index 88e983d..198070f 100644 --- a/frontend/src/components/HeroWrapper.tsx +++ b/frontend/src/components/HeroWrapper.tsx @@ -1,6 +1,6 @@ import { gql } from "@/__generated__/gql"; import { getClient } from "@/lib/ApolloClient"; -import Hero from "@/components/ui/hero"; +import Hero from "@components/ui/hero"; const STRAPI_URL = process.env.STRAPI_URL; diff --git a/frontend/src/components/Navbar.tsx b/frontend/src/components/Navbar.tsx index 01a2b09..444d5ed 100644 --- a/frontend/src/components/Navbar.tsx +++ b/frontend/src/components/Navbar.tsx @@ -1,8 +1,12 @@ "use client"; import Link from "next/link"; import { usePathname } from "next/navigation"; -import { Button } from "@/components/ui/button"; -import { Drawer, DrawerContent, DrawerTrigger } from "@/components/ui/drawer"; +import { Button } from "@shadcn/button"; +import { + Drawer, + DrawerContent, + DrawerTrigger, +} from "@/components/shadcn/drawer"; import Image from "next/image"; import type { SVGProps } from "react"; diff --git a/frontend/src/components/RelatedProjectsAndSatellites.tsx b/frontend/src/components/RelatedProjectsAndSatellites.tsx index 60c54a4..bac3855 100644 --- a/frontend/src/components/RelatedProjectsAndSatellites.tsx +++ b/frontend/src/components/RelatedProjectsAndSatellites.tsx @@ -2,7 +2,12 @@ import { ProjectOrSatellite } from "@/app/satellites/[satelliteSlug]/page"; import Link from "next/link"; import Image from "next/image"; const STRAPI_URL = process.env.STRAPI_URL; -import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; +import { + Card, + CardContent, + CardHeader, + CardTitle, +} from "@/components/shadcn/card"; export default function RelatedProjectsAndSatellites({ project, diff --git a/frontend/src/components/satelliteData/SatelliteStatsTable.tsx b/frontend/src/components/satelliteData/SatelliteStatsTable.tsx index 894b63b..f0ac0a5 100644 --- a/frontend/src/components/satelliteData/SatelliteStatsTable.tsx +++ b/frontend/src/components/satelliteData/SatelliteStatsTable.tsx @@ -2,7 +2,7 @@ import { useState, useEffect } from "react"; import { convertSatrec, SatelliteInfo } from "@/lib/convertSatrec"; import { useSatelliteStore } from "@/lib/store"; -import { Table, TableBody, TableCell, TableRow } from "@/components/ui/table"; +import { Table, TableBody, TableCell, TableRow } from "@shadcn/table"; const updateInterval = 50; diff --git a/frontend/src/components/ui/avatar.tsx b/frontend/src/components/shadcn/avatar.tsx similarity index 100% rename from frontend/src/components/ui/avatar.tsx rename to frontend/src/components/shadcn/avatar.tsx diff --git a/frontend/src/components/ui/button.tsx b/frontend/src/components/shadcn/button.tsx similarity index 100% rename from frontend/src/components/ui/button.tsx rename to frontend/src/components/shadcn/button.tsx diff --git a/frontend/src/components/ui/card.tsx b/frontend/src/components/shadcn/card.tsx similarity index 100% rename from frontend/src/components/ui/card.tsx rename to frontend/src/components/shadcn/card.tsx diff --git a/frontend/src/components/ui/command.tsx b/frontend/src/components/shadcn/command.tsx similarity index 98% rename from frontend/src/components/ui/command.tsx rename to frontend/src/components/shadcn/command.tsx index 01543eb..2485f60 100644 --- a/frontend/src/components/ui/command.tsx +++ b/frontend/src/components/shadcn/command.tsx @@ -6,7 +6,7 @@ import { Command as CommandPrimitive } from "cmdk"; import { Search } from "lucide-react"; import { cn } from "@/lib/utils"; -import { Dialog, DialogContent } from "@/components/ui/dialog"; +import { Dialog, DialogContent } from "@/components/shadcn/dialog"; const Command = React.forwardRef< React.ElementRef, diff --git a/frontend/src/components/ui/dialog.tsx b/frontend/src/components/shadcn/dialog.tsx similarity index 100% rename from frontend/src/components/ui/dialog.tsx rename to frontend/src/components/shadcn/dialog.tsx diff --git a/frontend/src/components/ui/drawer.tsx b/frontend/src/components/shadcn/drawer.tsx similarity index 100% rename from frontend/src/components/ui/drawer.tsx rename to frontend/src/components/shadcn/drawer.tsx diff --git a/frontend/src/components/ui/dropdown-menu.tsx b/frontend/src/components/shadcn/dropdown-menu.tsx similarity index 100% rename from frontend/src/components/ui/dropdown-menu.tsx rename to frontend/src/components/shadcn/dropdown-menu.tsx diff --git a/frontend/src/components/ui/label.tsx b/frontend/src/components/shadcn/label.tsx similarity index 100% rename from frontend/src/components/ui/label.tsx rename to frontend/src/components/shadcn/label.tsx diff --git a/frontend/src/components/ui/pagination.tsx b/frontend/src/components/shadcn/pagination.tsx similarity index 97% rename from frontend/src/components/ui/pagination.tsx rename to frontend/src/components/shadcn/pagination.tsx index 02ec9f4..1cd59a9 100644 --- a/frontend/src/components/ui/pagination.tsx +++ b/frontend/src/components/shadcn/pagination.tsx @@ -2,7 +2,7 @@ import * as React from "react"; import { ChevronLeft, ChevronRight, MoreHorizontal } from "lucide-react"; import { cn } from "@/lib/utils"; -import { ButtonProps, buttonVariants } from "@/components/ui/button"; +import { ButtonProps, buttonVariants } from "@/components/shadcn/button"; const Pagination = ({ className, ...props }: React.ComponentProps<"nav">) => (