Skip to content

Commit

Permalink
125 move shadcn components to seperate folder with name shadcn config…
Browse files Browse the repository at this point in the history
…ure componentsjson (#286)

* refactor(frontend): ♻️ move shadcn components to shadcn directory

* fix build errors
  • Loading branch information
Magnus Alexander Strømseng authored and GitHub committed Apr 13, 2024
1 parent cc56f8f commit 23b69dd
Show file tree
Hide file tree
Showing 30 changed files with 41 additions and 20 deletions.
3 changes: 2 additions & 1 deletion frontend/components.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
},
"aliases": {
"components": "@/components",
"utils": "@/lib/utils"
"utils": "@/lib/utils",
"ui": "@/components/shadcn"
}
}
2 changes: 1 addition & 1 deletion frontend/src/app/blog/[articleSlug]/loading.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Skeleton } from "@/components/ui/skeleton";
import { Skeleton } from "@shadcn/skeleton";
import React from "react";

export default function Loading() {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/app/blog/[articleSlug]/page.tsx
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/app/blog/loading.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Skeleton } from "@/components/ui/skeleton";
import { Skeleton } from "@shadcn/skeleton";
import React from "react";

export default function Loading() {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/app/loading.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
SkeletonHero,
SkeletonSection,
EmptySection,
} from "@/components/ui/skeleton";
} from "@shadcn/skeleton";
import React from "react";

export default function Loading() {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/app/projects/[projectSlug]/loading.tsx
Original file line number Diff line number Diff line change
@@ -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 (
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/app/projects/loading.tsx
Original file line number Diff line number Diff line change
@@ -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
Expand Down
7 changes: 6 additions & 1 deletion frontend/src/app/projects/page.tsx
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/app/satellites/loading.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Skeleton } from "@/components/ui/skeleton";
import { Skeleton } from "@shadcn/skeleton";
import React from "react";

export default function Loading() {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/BlogPaginator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
PaginationLink,
PaginationNext,
PaginationPrevious,
} from "./ui/pagination";
} from "./shadcn/pagination";
import { useRouter, useSearchParams } from "next/navigation";

export default function BlogPaginator({
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/BlogpageButtons.tsx
Original file line number Diff line number Diff line change
@@ -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";

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/HeroWrapper.tsx
Original file line number Diff line number Diff line change
@@ -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;

Expand Down
8 changes: 6 additions & 2 deletions frontend/src/components/Navbar.tsx
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
7 changes: 6 additions & 1 deletion frontend/src/components/RelatedProjectsAndSatellites.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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<typeof CommandPrimitive>,
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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">) => (
<nav
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
7 changes: 6 additions & 1 deletion frontend/src/components/ui/satelliteCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@
import React from "react";
import Link from "next/link";
import Image from "next/image";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import {
Card,
CardContent,
CardHeader,
CardTitle,
} from "@/components/shadcn/card";
import SatelliteStatsTable from "@/components/satelliteData/SatelliteStatsTable";
// Import OuiImage or your placeholder image component here
import { OuiImage } from "@/components/fullBlogCard";
Expand Down
1 change: 1 addition & 0 deletions frontend/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"@/*": ["./src/*"],
"@components/*": ["./src/components/*"],
"@customTypes/*": ["./src/types/*"],
"@shadcn/*": ["./src/components/shadcn/*"],
},
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
Expand Down

0 comments on commit 23b69dd

Please sign in to comment.