Skip to content

Commit 7d39c5a

Browse files
committed
Added navbar for Welcome page (index), imported badge, card and separator. Old index added in Testing folder
1 parent 8d0bc50 commit 7d39c5a

7 files changed

Lines changed: 366 additions & 34 deletions

File tree

client/package-lock.json

Lines changed: 85 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
},
1717
"dependencies": {
1818
"@radix-ui/react-navigation-menu": "^1.2.14",
19-
"@radix-ui/react-slot": "^1.2.3",
19+
"@radix-ui/react-separator": "^1.1.8",
20+
"@radix-ui/react-slot": "^1.2.4",
2021
"@tanstack/react-query": "^5.80.7",
2122
"@tanstack/react-query-devtools": "^5.80.7",
2223
"autoprefixer": "^10.4.21",

client/src/components/ui/badge.tsx

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import { cva, type VariantProps } from "class-variance-authority";
2+
import * as React from "react";
3+
4+
import { cn } from "@/lib/utils";
5+
6+
const badgeVariants = cva(
7+
"inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
8+
{
9+
variants: {
10+
variant: {
11+
default:
12+
"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",
13+
secondary:
14+
"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",
15+
destructive:
16+
"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",
17+
outline: "text-foreground",
18+
},
19+
},
20+
defaultVariants: {
21+
variant: "default",
22+
},
23+
},
24+
);
25+
26+
export interface BadgeProps
27+
extends React.HTMLAttributes<HTMLDivElement>,
28+
VariantProps<typeof badgeVariants> {}
29+
30+
function Badge({ className, variant, ...props }: BadgeProps) {
31+
return (
32+
<div className={cn(badgeVariants({ variant }), className)} {...props} />
33+
);
34+
}
35+
36+
export { Badge, badgeVariants };

client/src/components/ui/card.tsx

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
import * as React from "react";
2+
3+
import { cn } from "@/lib/utils";
4+
5+
const Card = React.forwardRef<
6+
HTMLDivElement,
7+
React.HTMLAttributes<HTMLDivElement>
8+
>(({ className, ...props }, ref) => (
9+
<div
10+
ref={ref}
11+
className={cn(
12+
"rounded-lg border bg-card text-card-foreground shadow-sm",
13+
className,
14+
)}
15+
{...props}
16+
/>
17+
));
18+
Card.displayName = "Card";
19+
20+
const CardHeader = React.forwardRef<
21+
HTMLDivElement,
22+
React.HTMLAttributes<HTMLDivElement>
23+
>(({ className, ...props }, ref) => (
24+
<div
25+
ref={ref}
26+
className={cn("flex flex-col space-y-1.5 p-6", className)}
27+
{...props}
28+
/>
29+
));
30+
CardHeader.displayName = "CardHeader";
31+
32+
const CardTitle = React.forwardRef<
33+
HTMLDivElement,
34+
React.HTMLAttributes<HTMLDivElement>
35+
>(({ className, ...props }, ref) => (
36+
<div
37+
ref={ref}
38+
className={cn(
39+
"text-2xl font-semibold leading-none tracking-tight",
40+
className,
41+
)}
42+
{...props}
43+
/>
44+
));
45+
CardTitle.displayName = "CardTitle";
46+
47+
const CardDescription = React.forwardRef<
48+
HTMLDivElement,
49+
React.HTMLAttributes<HTMLDivElement>
50+
>(({ className, ...props }, ref) => (
51+
<div
52+
ref={ref}
53+
className={cn("text-sm text-muted-foreground", className)}
54+
{...props}
55+
/>
56+
));
57+
CardDescription.displayName = "CardDescription";
58+
59+
const CardContent = React.forwardRef<
60+
HTMLDivElement,
61+
React.HTMLAttributes<HTMLDivElement>
62+
>(({ className, ...props }, ref) => (
63+
<div ref={ref} className={cn("p-6 pt-0", className)} {...props} />
64+
));
65+
CardContent.displayName = "CardContent";
66+
67+
const CardFooter = React.forwardRef<
68+
HTMLDivElement,
69+
React.HTMLAttributes<HTMLDivElement>
70+
>(({ className, ...props }, ref) => (
71+
<div
72+
ref={ref}
73+
className={cn("flex items-center p-6 pt-0", className)}
74+
{...props}
75+
/>
76+
));
77+
CardFooter.displayName = "CardFooter";
78+
79+
export {
80+
Card,
81+
CardContent,
82+
CardDescription,
83+
CardFooter,
84+
CardHeader,
85+
CardTitle,
86+
};
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import * as SeparatorPrimitive from "@radix-ui/react-separator";
2+
import * as React from "react";
3+
4+
import { cn } from "@/lib/utils";
5+
6+
const Separator = React.forwardRef<
7+
React.ElementRef<typeof SeparatorPrimitive.Root>,
8+
React.ComponentPropsWithoutRef<typeof SeparatorPrimitive.Root>
9+
>(
10+
(
11+
{ className, orientation = "horizontal", decorative = true, ...props },
12+
ref,
13+
) => (
14+
<SeparatorPrimitive.Root
15+
ref={ref}
16+
decorative={decorative}
17+
orientation={orientation}
18+
className={cn(
19+
"shrink-0 bg-border",
20+
orientation === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]",
21+
className,
22+
)}
23+
{...props}
24+
/>
25+
),
26+
);
27+
Separator.displayName = SeparatorPrimitive.Root.displayName;
28+
29+
export { Separator };
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// import { Inter as FontSans } from "next/font/google";
2+
// import { useState } from "react";
3+
4+
// import { usePings } from "@/hooks/pings";
5+
// import { cn } from "@/lib/utils";
6+
7+
// import { Button } from "../components/ui/button";
8+
// import Layout from "./layout";
9+
10+
// const fontSans = FontSans({
11+
// subsets: ["latin"],
12+
// variable: "--font-sans",
13+
// });
14+
15+
// export default function Home() {
16+
// const [clicked, setClicked] = useState(false);
17+
// const { data, isLoading } = usePings({
18+
// enabled: clicked,
19+
// });
20+
21+
// return (
22+
// <Layout>
23+
// <main
24+
// className={cn(
25+
// "flex min-h-screen flex-col items-center gap-4 p-24 font-sans",
26+
// fontSans.variable,
27+
// )}
28+
// >
29+
// <h1 className="text-3xl text-primary">Welcome Page</h1>
30+
// <Button onClick={() => setClicked(true)}>
31+
// {isLoading ? "Loading" : "Ping"}
32+
// </Button>
33+
// <p>
34+
// Response from server: <span>{data as string}</span>
35+
// </p>
36+
// </main>
37+
// </Layout>
38+
// );
39+
// }

0 commit comments

Comments
 (0)