Skip to content

Commit

Permalink
appply
Browse files Browse the repository at this point in the history
  • Loading branch information
iamtouha committed Jan 18, 2025
1 parent a97d023 commit ccad78e
Show file tree
Hide file tree
Showing 15 changed files with 160 additions and 220 deletions.
28 changes: 16 additions & 12 deletions src/app/(landing)/_components/copy-to-clipboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,36 @@
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { cn } from "@/lib/utils";
import { CopyIcon , CheckIcon} from "@radix-ui/react-icons";
import { CheckIcon, CopyIcon } from "@radix-ui/react-icons";
import { useState } from "react";
import { toast } from "sonner";

export const CopyToClipboard = ({ text }: { text: string }) => {

const [copied , setCopied] = useState(false)
const [copied, setCopied] = useState(false);
const copyToClipboard = async () => {
setCopied(true)
setCopied(true);
setTimeout(() => {
setCopied(false)
} , 2000)
setCopied(false);
}, 2000);
await navigator.clipboard.writeText(text);
toast("Copied to clipboard", {
icon: <CopyIcon className="h-4 w-4" />,
});
};
return (
<div className="flex justify-center gap-3">
<Input
readOnly
value={text}
className="bg-secondary text-muted-foreground"
/>
<Input readOnly value={text} className="bg-secondary text-muted-foreground" />
<Button size="icon" onClick={() => copyToClipboard()}>
{copied ? <CheckIcon className={cn( copied ? "opacity-100": "opacity-0" , "h-5 w-5 transition-opacity duration-500" )}/>: <CopyIcon className="h-5 w-5" />}
{copied ? (
<CheckIcon
className={cn(
copied ? "opacity-100" : "opacity-0",
"h-5 w-5 transition-opacity duration-500",
)}
/>
) : (
<CopyIcon className="h-5 w-5" />
)}
</Button>
</div>
);
Expand Down
100 changes: 38 additions & 62 deletions src/app/(landing)/_components/feature-icons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,7 @@ const NextjsLight = forwardRef<SVGSVGElement, SVGProps<SVGSVGElement>>(
d="M149.508 157.52L69.142 54H54V125.97H66.1136V69.3836L139.999 164.845C143.333 162.614 146.509 160.165 149.508 157.52Z"
fill="url(#paint0_linear_408_134)"
/>
<rect
x="115"
y="54"
width="12"
height="72"
fill="url(#paint1_linear_408_134)"
/>
<rect x="115" y="54" width="12" height="72" fill="url(#paint1_linear_408_134)" />
</g>
<defs>
<linearGradient
Expand Down Expand Up @@ -86,25 +80,12 @@ const NextjsDark = forwardRef<SVGSVGElement, SVGProps<SVGSVGElement>>(
<circle cx="90" cy="90" r="90" fill="black" />
</mask>
<g mask="url(#mask0_408_139)">
<circle
cx="90"
cy="90"
r="87"
fill="black"
stroke="white"
strokeWidth="6"
/>
<circle cx="90" cy="90" r="87" fill="black" stroke="white" strokeWidth="6" />
<path
d="M149.508 157.52L69.142 54H54V125.97H66.1136V69.3836L139.999 164.845C143.333 162.614 146.509 160.165 149.508 157.52Z"
fill="url(#paint0_linear_408_139)"
/>
<rect
x="115"
y="54"
width="12"
height="72"
fill="url(#paint1_linear_408_139)"
/>
<rect x="115" y="54" width="12" height="72" fill="url(#paint1_linear_408_139)" />
</g>
<defs>
<linearGradient
Expand Down Expand Up @@ -226,40 +207,38 @@ const Drizzle = forwardRef<SVGSVGElement, SVGProps<SVGSVGElement>>(
);
Drizzle.displayName = "Drizzle";

const TRPC = forwardRef<SVGSVGElement, SVGProps<SVGSVGElement>>(
({ className, ...props }, ref) => (
<svg
ref={ref}
{...props}
viewBox="0 0 512 512"
xmlns="http://www.w3.org/2000/svg"
fill="currentColor"
className={cn(className)}
>
<g>
<polygon points="246.2,162.3 202.9,137.3 202.9,187.4 246.2,212.4" />
<polygon points="96.5,357.9 139.9,382.9 139.9,332.9 96.5,307.8" />
<polygon points="149.1,266.8 105.7,291.9 149.1,316.9 192.4,291.9" />
<polygon points="264.7,212.4 308,187.4 308,137.3 264.7,162.3" />
<polygon points="298.8,121.3 255.4,96.3 212.2,121.3 255.4,146.4" />
<polygon points="201.7,307.8 158.3,332.9 158.3,382.9 201.7,357.9" />
<path
d="M362,0H150C67.2,0,0,67.2,0,150v212c0,82.8,67.2,150,150,150h212c82.8,0,150-67.2,150-150V150
const TRPC = forwardRef<SVGSVGElement, SVGProps<SVGSVGElement>>(({ className, ...props }, ref) => (
<svg
ref={ref}
{...props}
viewBox="0 0 512 512"
xmlns="http://www.w3.org/2000/svg"
fill="currentColor"
className={cn(className)}
>
<g>
<polygon points="246.2,162.3 202.9,137.3 202.9,187.4 246.2,212.4" />
<polygon points="96.5,357.9 139.9,382.9 139.9,332.9 96.5,307.8" />
<polygon points="149.1,266.8 105.7,291.9 149.1,316.9 192.4,291.9" />
<polygon points="264.7,212.4 308,187.4 308,137.3 264.7,162.3" />
<polygon points="298.8,121.3 255.4,96.3 212.2,121.3 255.4,146.4" />
<polygon points="201.7,307.8 158.3,332.9 158.3,382.9 201.7,357.9" />
<path
d="M362,0H150C67.2,0,0,67.2,0,150v212c0,82.8,67.2,150,150,150h212c82.8,0,150-67.2,150-150V150
C512,67.2,444.8,0,362,0z M435.6,368.6l-71,41l-31.5-18.2l-76.7,44.3l-76.2-44l-31.1,18l-71-41.1v-82l22.2-12.8v-85.5l84.2-48.6
l0,0V116l71-41l71.1,41v22.5l86,49.7v85l23.1,13.3V368.6z"
/>
<polygon points="373.8,383 417.2,357.9 417.2,307.8 373.8,332.9" />
<polygon points="364.6,266.9 321.3,291.9 364.6,317 407.9,291.9" />
<polygon
points="293.6,286.5 364.6,245.5 394.1,262.6 394.1,198.9 326.5,159.9 326.5,198 255.5,239 184.5,198
/>
<polygon points="373.8,383 417.2,357.9 417.2,307.8 373.8,332.9" />
<polygon points="364.6,266.9 321.3,291.9 364.6,317 407.9,291.9" />
<polygon
points="293.6,286.5 364.6,245.5 394.1,262.6 394.1,198.9 326.5,159.9 326.5,198 255.5,239 184.5,198
184.5,160.9 184.4,160.9 118.7,198.9 118.7,263.1 149.1,245.5 220.1,286.5 220.1,368.5 198.6,381 256.4,414.3 314.6,380.7
293.6,368.5"
/>
<polygon points="312,358 355.4,383 355.4,332.9 312,307.9" />
</g>
</svg>
),
);
/>
<polygon points="312,358 355.4,383 355.4,332.9 312,307.9" />
</g>
</svg>
));
TRPC.displayName = "TRPC";

const ShadcnUi = forwardRef<SVGSVGElement, SVGProps<SVGSVGElement>>(
Expand Down Expand Up @@ -355,10 +334,7 @@ const ReactEmail = forwardRef<SVGSVGElement, SVGProps<SVGSVGElement>>(
d="M112.616 22.176V13.744H114.584V22.176H112.616ZM113.576 11.952C113.181 11.952 112.872 11.856 112.648 11.664C112.435 11.4613 112.328 11.1787 112.328 10.816C112.328 10.4747 112.44 10.1973 112.664 9.984C112.888 9.77067 113.192 9.664 113.576 9.664C113.981 9.664 114.291 9.76534 114.504 9.968C114.728 10.16 114.84 10.4427 114.84 10.816C114.84 11.1467 114.728 11.4187 114.504 11.632C114.28 11.8453 113.971 11.952 113.576 11.952Z"
fill="currentColor"
></path>
<path
d="M116.675 22.176V10.336H118.659V22.176H116.675Z"
fill="currentColor"
></path>
<path d="M116.675 22.176V10.336H118.659V22.176H116.675Z" fill="currentColor"></path>
<defs>
<clipPath id="clip0_27_291">
<rect width="32" height="32" rx="8" fill="currentColor"></rect>
Expand Down Expand Up @@ -386,14 +362,14 @@ const StripeLogo = forwardRef<SVGSVGElement, SVGProps<SVGSVGElement>>(
StripeLogo.displayName = "StripeLogo";

export {
NextjsLight,
Drizzle,
LuciaAuth,
NextjsDark,
NextjsLight,
ReactEmail,
ReactJs,
TailwindCss,
LuciaAuth,
Drizzle,
TRPC,
ShadcnUi,
ReactEmail,
StripeLogo,
TailwindCss,
TRPC,
};
2 changes: 1 addition & 1 deletion src/app/(landing)/_components/footer.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { CodeIcon } from "@radix-ui/react-icons";
import { ThemeToggle } from "@/components/theme-toggle";
import { CodeIcon } from "@radix-ui/react-icons";

const githubUrl = "https://github.com/iamtouha/next-lucia-auth";
const twitterUrl = "https://twitter.com/iamtouha";
Expand Down
133 changes: 63 additions & 70 deletions src/app/(landing)/_components/hover-card.tsx
Original file line number Diff line number Diff line change
@@ -1,77 +1,70 @@
'use client';
import { Card, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
import React, { useRef, useState } from 'react';


"use client";
import { Card, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
import React, { useRef, useState } from "react";

type FeaturesProps = {
name: string;
description: string;
logo: React.ReactNode;
}
name: string;
description: string;
logo: React.ReactNode;
};

const CardSpotlight = (props: FeaturesProps) => {
const divRef = useRef<HTMLDivElement>(null);
const [isFocused, setIsFocused] = useState(false);
const [position, setPosition] = useState({ x: 0, y: 0 });
const [opacity, setOpacity] = useState(0);

const handleMouseMove = (e: React.MouseEvent<HTMLDivElement>) => {
if (!divRef.current || isFocused) return;

const div = divRef.current;
const rect = div.getBoundingClientRect();

setPosition({ x: e.clientX - rect.left, y: e.clientY - rect.top });
};

const handleFocus = () => {
setIsFocused(true);
setOpacity(1);
};

const handleBlur = () => {
setIsFocused(false);
setOpacity(0);
};

const handleMouseEnter = () => {
setOpacity(1);
};

const handleMouseLeave = () => {
setOpacity(0);
};

return (
<Card
ref={divRef}
onMouseMove={handleMouseMove}
onFocus={handleFocus}
onBlur={handleBlur}
onMouseEnter={handleMouseEnter}
onMouseLeave={handleMouseLeave}
className='relative overflow-hidden rounded-xl border dark:border-gray-800 bg-white dark:bg-gradient-to-r dark:from-black dark:to-neutral-950 dark:shadow-2xl'
>

<div
className='pointer-events-none absolute -inset-px opacity-0 transition duration-300'
style={{
opacity,
background: `radial-gradient(600px circle at ${position.x}px ${position.y}px, rgba(255,182,255,.1), transparent 40%)`,
}}
/>
<div className="pl-6 pt-6">

{props.logo}
</div>
<CardHeader className="pb-6">
<CardTitle className="text-xl">{props.name}</CardTitle>
<CardDescription>{props.description}</CardDescription>
</CardHeader>

</Card>
);
const divRef = useRef<HTMLDivElement>(null);
const [isFocused, setIsFocused] = useState(false);
const [position, setPosition] = useState({ x: 0, y: 0 });
const [opacity, setOpacity] = useState(0);

const handleMouseMove = (e: React.MouseEvent<HTMLDivElement>) => {
if (!divRef.current || isFocused) return;

const div = divRef.current;
const rect = div.getBoundingClientRect();

setPosition({ x: e.clientX - rect.left, y: e.clientY - rect.top });
};

const handleFocus = () => {
setIsFocused(true);
setOpacity(1);
};

const handleBlur = () => {
setIsFocused(false);
setOpacity(0);
};

const handleMouseEnter = () => {
setOpacity(1);
};

const handleMouseLeave = () => {
setOpacity(0);
};

return (
<Card
ref={divRef}
onMouseMove={handleMouseMove}
onFocus={handleFocus}
onBlur={handleBlur}
onMouseEnter={handleMouseEnter}
onMouseLeave={handleMouseLeave}
className="relative overflow-hidden rounded-xl border bg-white dark:border-gray-800 dark:bg-gradient-to-r dark:from-black dark:to-neutral-950 dark:shadow-2xl"
>
<div
className="pointer-events-none absolute -inset-px opacity-0 transition duration-300"
style={{
opacity,
background: `radial-gradient(600px circle at ${position.x}px ${position.y}px, rgba(255,182,255,.1), transparent 40%)`,
}}
/>
<div className="pl-6 pt-6">{props.logo}</div>
<CardHeader className="pb-6">
<CardTitle className="text-xl">{props.name}</CardTitle>
<CardDescription>{props.description}</CardDescription>
</CardHeader>
</Card>
);
};

export default CardSpotlight;
4 changes: 2 additions & 2 deletions src/app/(landing)/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { APP_TITLE } from "@/lib/constants";
import { type ReactNode } from "react";
import { type Metadata } from "next";
import { Header } from "./_components/header";
import { type ReactNode } from "react";
import { Footer } from "./_components/footer";
import { Header } from "./_components/header";

export const metadata: Metadata = {
title: APP_TITLE,
Expand Down
14 changes: 7 additions & 7 deletions src/app/(landing)/page.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import Link from "next/link";
import { type Metadata } from "next";
import { PlusIcon } from "@/components/icons";
import { Button } from "@/components/ui/button";
import { GitHubLogoIcon } from "@radix-ui/react-icons";
import { type Metadata } from "next";
import Link from "next/link";
import { CopyToClipboard } from "./_components/copy-to-clipboard";
import {
Drizzle,
LuciaAuth,
NextjsLight,
NextjsDark,
NextjsLight,
ReactEmail,
ReactJs,
ShadcnUi,
StripeLogo,
TRPC,
TailwindCss,
StripeLogo,
ReactEmail,
} from "./_components/feature-icons";
import CardSpotlight from "./_components/hover-card";

Expand Down Expand Up @@ -87,7 +87,7 @@ const HomePage = () => {
<h1 className="text-balance bg-gradient-to-tr from-black/70 via-black to-black/60 bg-clip-text text-center text-3xl font-bold text-transparent dark:from-zinc-400/10 dark:via-white/90 dark:to-white/20 sm:text-5xl md:text-6xl lg:text-7xl">
Next.js Lucia Auth Starter Template
</h1>
<p className="text-balance mb-10 mt-4 text-center text-muted-foreground md:text-lg lg:text-xl">
<p className="mb-10 mt-4 text-balance text-center text-muted-foreground md:text-lg lg:text-xl">
A Next.js Authentication starter template (password reset, email validation and oAuth).
Includes Lucia, Drizzle, tRPC, Stripe, tailwindcss, shadcn-ui and react-email.
</p>
Expand All @@ -114,7 +114,7 @@ const HomePage = () => {
<h1 className="mb-4 text-center text-3xl font-bold md:text-4xl lg:text-5xl">
<a id="features"></a> Features
</h1>
<p className="text-balance mb-10 text-center text-muted-foreground md:text-lg lg:text-xl">
<p className="mb-10 text-balance text-center text-muted-foreground md:text-lg lg:text-xl">
This starter template is a guide to help you get started with Next.js for large scale
applications. Feel free to add or remove features to suit your needs.
</p>
Expand Down
Loading

0 comments on commit ccad78e

Please sign in to comment.