Skip to content

Commit

Permalink
Merge pull request #3 from remcostoeten/2-add-libs-and-basic-core-setup
Browse files Browse the repository at this point in the history
2 add libs and basic core setup
  • Loading branch information
remcostoeten committed Apr 24, 2024
2 parents 2b440f0 + a7801b5 commit 2188fa8
Show file tree
Hide file tree
Showing 25 changed files with 462 additions and 37 deletions.
Binary file modified bun.lockb
Binary file not shown.
2 changes: 1 addition & 1 deletion components.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
},
"aliases": {
"components": "@/components",
"utils": "@/lib/utils"
"utils": "@/core/lib/utils"
}
}
31 changes: 26 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,47 @@
{
"name": "next-entree",
"name": "url-extractor",
"version": "0.1.0",
"private": true,
"author": "remco stoeten",
"description": "Extracts urls from text and some other magic.",
"keywords": [
"Next.js",
"React",
"Tailwind CSS",
"Radix UI",
"shadcn/ui"
],
"homepage": "https://extract.remcostoeten.com",
"repository": {
"type": "git",
"url": "https://github.com/remcostoeten/url-extracter.git"
},
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint",
"format": "pnpm prettier ./src --write",
"format:check": "pnpm prettier ./src --check"
"lint:fix": "next lint --fix",
"typecheck": "tsc --noEmit",
"format:write": "prettier --write \"**/*.{ts,tsx,mdx,css}\" --cache",
"format:check": "prettier --check \"**/*.{ts,tsx,mdx}\" --cache"
},
"dependencies": {
"@radix-ui/react-checkbox": "^1.0.4",
"@radix-ui/react-dropdown-menu": "^2.0.6",
"@radix-ui/react-label": "^2.0.2",
"@radix-ui/react-slot": "^1.0.2",
"@t3-oss/env-nextjs": "^0.9.2",
"@tabler/icons-react": "^3.2.0",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.0",
"framer-motion": "^11.1.7",
"lucide-react": "^0.330.0",
"next": "14.1.0",
"next-themes": "^0.2.1",
"next-themes": "^0.3.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"sonner": "^1.4.41",
"tailwind-merge": "^2.2.1",
"tailwindcss-animate": "^1.0.7",
"zod": "^3.22.4"
Expand All @@ -39,4 +60,4 @@
"tailwindcss": "^3.4.1",
"typescript": "^5.3.3"
}
}
}
38 changes: 38 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ import type { Metadata, Viewport } from "next"
import { Inter } from "next/font/google"

import { siteConfig } from "@/config/site"
import { cn } from "@/lib/utils"
import { cn } from "@/core/lib/utils"
import { ThemeProvider } from "@/components/theme-provider"
import Navbar from "@/components/theme/navbar"
import BackgroundWrapper from "@/components/theme/BackgroundWrapper"

const inter = Inter({ subsets: ["latin"] })

Expand Down Expand Up @@ -79,7 +81,10 @@ export default function RootLayout({ children }: RootLayoutProps) {
enableSystem
disableTransitionOnChange
>
{children}
<BackgroundWrapper>
<Navbar />
{children}
</BackgroundWrapper>
</ThemeProvider>
</body>
</html>
Expand Down
2 changes: 1 addition & 1 deletion src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Link from "next/link"

import { siteConfig } from "@/config/site"
import { cn } from "@/lib/utils"
import { cn } from "@/core/lib/utils"
import { buttonVariants } from "@/components/ui/button"
import { Icons } from "@/components/icons"
import { ModeToggle } from "@/components/mode-toggle"
Expand Down
70 changes: 70 additions & 0 deletions src/components/effects/aurora-background.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
"use client";
import { cn } from "@/core";
import React, { ReactNode } from "react";

interface AuroraBackgroundProps extends React.HTMLProps<HTMLDivElement> {
children: ReactNode;
showRadialGradient?: boolean;
colorVariant?: 'dark' | 'light' | 'custom' | 'darkMode';
}

export const AuroraBackground = ({
className,
children,
showRadialGradient = true,
colorVariant = 'dark',
...props
}: AuroraBackgroundProps) => {
const colorSchemes = {
dark: `
[--gradient:repeating-linear-gradient(100deg,var(--black)_0%,var(--black)_7%,var(--transparent)_10%,var(--transparent)_12%,var(--black)_16%)]
[--aurora:repeating-linear-gradient(100deg,var(--blue-500)_10%,var(--indigo-300)_15%,var(--blue-300)_20%,var(--violet-200)_25%,var(--blue-400)_30%)]
`,
light: `
[--gradient:repeating-linear-gradient(100deg,var(--white)_0%,var(--white)_7%,var(--transparent)_10%,var(--transparent)_12%,var(--white)_16%)]
[--aurora:repeating-linear-gradient(100deg,var(--blue-500)_10%,var(--indigo-300)_15%,var(--blue-300)_20%,var(--violet-200)_25%,var(--blue-400)_30%)]
`,
custom: `
[--gradient:repeating-linear-gradient(100deg,var(--red-500)_0%,var(--red-500)_7%,var(--transparent)_10%,var(--transparent)_12%,var(--red-500)_16%)]
[--aurora:repeating-linear-gradient(100deg,var(--green-500)_10%,var(--yellow-300)_15%,var(--green-300)_20%,var(--orange-200)_25%,var(--green-400)_30%)]
`,
darkMode: `
[--gradient:repeating-linear-gradient(100deg,var(--gray-800)_0%,var(--gray-800)_7%,var(--transparent)_10%,var(--transparent)_12%,var(--gray-800)_16%)]
[--aurora:repeating-linear-gradient(100deg,var(--purple-500)_10%,var(--purple-300)_15%,var(--purple-300)_20%,var(--purple-200)_25%,var(--purple-400)_30%)]
`,
};

return (
<main>
<div
className={cn(
"relative flex flex-col h-[100vh] items-center justify-center bg-zinc-700 dark:bg-zinc-900 text-slate-950 transition-bg",
className
)}
{...props}
>
<div className="absolute inset-0 overflow-hidden">
<div
className={cn(
`
[background-image:var(--gradient),var(--aurora)]
[background-size:300%,_200%]
[background-position:50%_50%,50%_50%]
filter blur-[10px] invert dark:invert-0
after:content-[""] after:absolute after:inset-0 after:[background-image:var(--gradient),var(--aurora)]
after:[background-size:200%,_100%]
after:animate-aurora after:[background-attachment:fixed] after:mix-blend-difference
pointer-events-none
absolute -inset-[10px] opacity-50 will-change-transform`,

showRadialGradient &&
`[mask-image:radial-gradient(ellipse_at_100%_0%,black_10%,var(--transparent)_70%)]`,
colorSchemes[colorVariant]
)}
></div>
</div>
{children}
</div>
</main>
);
};
4 changes: 2 additions & 2 deletions src/components/mode-toggle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ export function ModeToggle() {
return (
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button variant="outline" size="icon">
<Button className="rounded-full" variant="outline" size="icon">
<Icons.sun className="h-[1.2rem] w-[1.2rem] rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0" />
<Icons.moon className="absolute h-[1.2rem] w-[1.2rem] rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100" />
<Icons.moon className="absolute h-[1.2rem] w-[1.2rem] rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100 dark:text-white" />
<span className="sr-only">Toggle theme</span>
</Button>
</DropdownMenuTrigger>
Expand Down
26 changes: 26 additions & 0 deletions src/components/theme/BackgroundWrapper.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
"use client";

import { motion } from "framer-motion";
import React from "react";
import { AuroraBackground } from "@c/effects/aurora-background";

export default function BackgroundWrapper({ children }: { children: React.ReactNode; }) {
return (
<AuroraBackground>
<motion.div
initial={{ opacity: 0.0, y: 40 }}
whileInView={{ opacity: 1, y: 0 }}
transition={{
delay: 0.3,
duration: 0.8,
ease: "easeInOut",
}}
className="relative flex flex-col gap-4 items-center justify-center px-4"
>
{children}

</motion.div>
</AuroraBackground>
);
}

66 changes: 66 additions & 0 deletions src/components/theme/NavLogic.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import React from "react";
import {
motion,
AnimatePresence,
} from "framer-motion";
import { cn } from "@core/index";
import Link from "next/link";
import { siteConfig } from "@/config/site";
import { ModeToggle } from "../mode-toggle";
import ShinyButton from "../ui/shiny-button";

export const FloatingNav = ({
navItems,
className,
}: {
navItems: {
name: string;
link: string;
icon?: JSX.Element;
component?: JSX.Element;
}[];
className?: string;
}) => {
const visible = true;

return (
<AnimatePresence mode="wait">
<motion.div
initial={{
opacity: 0,
y: -100,
scale: .3,
}}
animate={{
scale: 1,
y: visible ? 0 : -50,
opacity: visible ? 1 : 0,
}}
transition={{
duration: 0.6,
ease: [0.16, 1, 0.3, 1],
}}
className={cn(
"flex !opacity-75 max-w-fit fixed top-5 inset-x-0 mx-auto border border-transparent dark:border-white/[0.2] rounded-full dark:bg-black bg-white shadow-[0px_2px_3px_-1px_rgba(0,0,0,0.1),0px_1px_0px_0px_rgba(25,28,33,0.02),0px_0px_0px_1px_rgba(25,28,33,0.08)] z-[5000] pr-2 pl-8 py-2 items-center justify-center space-x-4",
className
)}
>
{navItems.map((navItem: any, idx: number) => (
<Link
key={`link=${idx}`}
href={navItem.link}
className={cn(
"relative dark:text-neutral-50 items-center flex space-x-1 text-neutral-600 dark:hover:text-neutral-300 hover:text-neutral-500"
)}
>
<span className="block sm:hidden">{navItem.icon}</span>
<span className="hidden sm:block text-sm">{navItem.name}</span>
</Link>
))}
<ShinyButton link={siteConfig.links.github} external>Github</ShinyButton>
<ModeToggle />

</motion.div>
</AnimatePresence>
);
};
16 changes: 16 additions & 0 deletions src/components/theme/navbar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"use client";
import React from "react";
import { FloatingNav } from "./NavLogic";
import { IconHome, IconMessage, IconUser } from "@tabler/icons-react";
export default function Navbar() {
const navItems = [
{
name: "Home",
link: "/",
icon: <IconHome className="h-4 w-4 text-neutral-500 dark:text-white" />,
},
];
return (
<FloatingNav navItems={navItems} />
);
}
4 changes: 2 additions & 2 deletions src/components/ui/button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from "react"
import { Slot } from "@radix-ui/react-slot"
import { cva, type VariantProps } from "class-variance-authority"

import { cn } from "@/lib/utils"
import { cn } from "@/core/lib/utils"

const buttonVariants = cva(
"inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
Expand Down Expand Up @@ -35,7 +35,7 @@ const buttonVariants = cva(

export interface ButtonProps
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
VariantProps<typeof buttonVariants> {
VariantProps<typeof buttonVariants> {
asChild?: boolean
}

Expand Down
Loading

0 comments on commit 2188fa8

Please sign in to comment.