Skip to content

Commit

Permalink
update shadcn components and lint + format repo
Browse files Browse the repository at this point in the history
  • Loading branch information
troypoulter committed May 10, 2024
1 parent d76b6aa commit 60c82b7
Show file tree
Hide file tree
Showing 20 changed files with 221 additions and 207 deletions.
3 changes: 2 additions & 1 deletion app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import "@/styles/globals.css"

import { Metadata } from "next"
import Script from "next/script"
import { Analytics } from "@vercel/analytics/react"
Expand Down Expand Up @@ -64,7 +65,7 @@ export const metadata: Metadata = {
description: siteConfig.description,
images: [siteConfig.ogImage],
creator: "@troypoulterr",
}
},
}

interface RootLayoutProps {
Expand Down
7 changes: 5 additions & 2 deletions app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ export default function IndexPage() {
Effortlessly encode and decode Base64 data.
</h1>
<p className="text-lg text-muted-foreground sm:text-xl">
Securely encode and decode Base64 instantly within your browser, ensuring your data stays private and never leaves your device.
Securely encode and decode Base64 instantly within your browser,
ensuring your data stays private and never leaves your device.
</p>
</div>
<Card className="container grid items-center gap-6 p-6 shadow-md">
Expand All @@ -77,7 +78,9 @@ export default function IndexPage() {
<Button variant="outline" onClick={handleShowExample}>
Show me an example!
</Button>
<p className="text-center text-sm text-muted-foreground">Note: We use <strong>UTF-8</strong> as the default charset.</p>
<p className="text-center text-sm text-muted-foreground">
Note: We use <strong>UTF-8</strong> as the default charset.
</p>
</Card>
</section>
</>
Expand Down
17 changes: 17 additions & 0 deletions components.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"$schema": "https://ui.shadcn.com/schema.json",
"style": "default",
"rsc": true,
"tsx": true,
"tailwind": {
"config": "tailwind.config.ts",
"css": "styles/globals.css",
"baseColor": "slate",
"cssVariables": true,
"prefix": ""
},
"aliases": {
"components": "@/components",
"utils": "@/lib/utils"
}
}
2 changes: 1 addition & 1 deletion components/main-nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export function MainNav({ items }: MainNavProps) {
return (
<div className="flex gap-6 md:gap-10">
<Link href="/" className="hidden items-center space-x-2 md:flex">
<Icons.logo className="h-6 w-6" />
<Icons.logo className="size-6" />
<span className="hidden font-bold md:inline-block">
{siteConfig.name}
</span>
Expand Down
6 changes: 3 additions & 3 deletions components/mobile-nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,17 @@ export function MobileNav({ items }: MobileNavProps) {
variant="ghost"
className="mr-2 px-0 text-base hover:bg-transparent focus-visible:bg-transparent focus-visible:ring-0 focus-visible:ring-offset-0 md:hidden"
>
<SidebarOpen className="h-6 w-6" />
<SidebarOpen className="size-6" />
<span className="sr-only">Toggle Menu</span>
</Button>
</SheetTrigger>
<SheetContent size="xl" position="left" className="pr-0">
<SheetContent side="left" className="pr-0">
<MobileLink
href="/"
className="flex items-center"
onOpenChange={setOpen}
>
<Icons.logo className="mr-2 h-4 w-4" />
<Icons.logo className="mr-2 size-4" />
<span className="font-bold">{siteConfig.name}</span>
</MobileLink>
<ScrollArea className="my-4 h-[calc(100vh-8rem)] pb-10 pl-6">
Expand Down
9 changes: 5 additions & 4 deletions components/plausible-script.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Script from "next/script";
import Script from "next/script"

const PlausibleScript = () => (
<>
Expand All @@ -14,6 +14,7 @@ const PlausibleScript = () => (
defer
data-domain="base64.troypoulter.com"
src="https://plausible.io/js/script.outbound-links.js"
></Script></>
);
export default PlausibleScript;
></Script>
</>
)
export default PlausibleScript
2 changes: 1 addition & 1 deletion components/site-footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export function SiteFooter() {
<footer className="border-t py-6 md:py-0">
<div className="container flex flex-col items-center justify-between gap-4 md:h-24 md:flex-row">
<div className="flex flex-col items-center gap-4 px-8 md:flex-row md:gap-2 md:px-0">
<Icons.logo className="hidden h-6 w-6 md:inline-block" />
<Icons.logo className="hidden size-6 md:inline-block" />
<p className="text-center text-sm leading-loose text-muted-foreground md:text-left">
Built by{" "}
<a
Expand Down
4 changes: 2 additions & 2 deletions components/site-header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export function SiteHeader() {
variant: "ghost",
})}
>
<Icons.gitHub className="h-5 w-5" />
<Icons.gitHub className="size-5" />
<span className="sr-only">GitHub</span>
</div>
</Link>
Expand All @@ -42,7 +42,7 @@ export function SiteHeader() {
variant: "ghost",
})}
>
<Icons.website className="h-5 w-5 fill-current" />
<Icons.website className="size-5 fill-current" />
<span className="sr-only">Website</span>
</div>
</Link>
Expand Down
2 changes: 1 addition & 1 deletion components/tailwind-indicator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export function TailwindIndicator() {
if (process.env.NODE_ENV === "production") return null

return (
<div className="fixed bottom-1 left-1 z-50 flex h-6 w-6 items-center justify-center rounded-full bg-gray-800 p-3 font-mono text-xs text-white">
<div className="fixed bottom-1 left-1 z-50 flex size-6 items-center justify-center rounded-full bg-gray-800 p-3 font-mono text-xs text-white">
<div className="block sm:hidden">xs</div>
<div className="hidden sm:block md:hidden lg:hidden xl:hidden 2xl:hidden">
sm
Expand Down
25 changes: 15 additions & 10 deletions components/ui/button.tsx
Original file line number Diff line number Diff line change
@@ -1,27 +1,29 @@
import * as React from "react"
import { VariantProps, cva } from "class-variance-authority"
import { Slot } from "@radix-ui/react-slot"
import { cva, type VariantProps } from "class-variance-authority"

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

const buttonVariants = cva(
"inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:opacity-50 disabled:pointer-events-none ring-offset-background",
"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",
{
variants: {
variant: {
default: "bg-primary text-primary-foreground hover:bg-primary/90",
destructive:
"bg-destructive text-destructive-foreground hover:bg-destructive/90",
outline:
"border border-input hover:bg-accent hover:text-accent-foreground",
"border border-input bg-background hover:bg-accent hover:text-accent-foreground",
secondary:
"bg-secondary text-secondary-foreground hover:bg-secondary/80",
ghost: "hover:bg-accent hover:text-accent-foreground",
link: "underline-offset-4 hover:underline text-primary",
link: "text-primary underline-offset-4 hover:underline",
},
size: {
default: "h-10 py-2 px-4",
sm: "h-9 px-3 rounded-md",
lg: "h-11 px-8 rounded-md",
default: "h-10 px-4 py-2",
sm: "h-9 rounded-md px-3",
lg: "h-11 rounded-md px-8",
icon: "h-10 w-10",
},
},
defaultVariants: {
Expand All @@ -33,12 +35,15 @@ const buttonVariants = cva(

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

const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
({ className, variant, size, ...props }, ref) => {
({ className, variant, size, asChild = false, ...props }, ref) => {
const Comp = asChild ? Slot : "button"
return (
<button
<Comp
className={cn(buttonVariants({ variant, size, className }))}
ref={ref}
{...props}
Expand Down
4 changes: 2 additions & 2 deletions components/ui/card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const CardTitle = React.forwardRef<
<h3
ref={ref}
className={cn(
"text-lg font-semibold leading-none tracking-tight",
"text-2xl font-semibold leading-none tracking-tight",
className
)}
{...props}
Expand Down Expand Up @@ -70,7 +70,7 @@ const CardFooter = React.forwardRef<
>(({ className, ...props }, ref) => (
<div
ref={ref}
className={cn(" flex items-center p-6 pt-0", className)}
className={cn("flex items-center p-6 pt-0", className)}
{...props}
/>
))
Expand Down
2 changes: 1 addition & 1 deletion components/ui/label.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import * as React from "react"
import * as LabelPrimitive from "@radix-ui/react-label"
import { VariantProps, cva } from "class-variance-authority"
import { cva, type VariantProps } from "class-variance-authority"

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

Expand Down
6 changes: 3 additions & 3 deletions components/ui/scroll-area.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const ScrollArea = React.forwardRef<
className={cn("relative overflow-hidden", className)}
{...props}
>
<ScrollAreaPrimitive.Viewport className="h-full w-full rounded-[inherit]">
<ScrollAreaPrimitive.Viewport className="size-full rounded-[inherit]">
{children}
</ScrollAreaPrimitive.Viewport>
<ScrollBar />
Expand All @@ -33,9 +33,9 @@ const ScrollBar = React.forwardRef<
className={cn(
"flex touch-none select-none transition-colors",
orientation === "vertical" &&
"h-full w-2.5 border-l border-l-transparent p-[1px]",
"h-full w-2.5 border-l border-l-transparent p-px",
orientation === "horizontal" &&
"h-2.5 border-t border-t-transparent p-[1px]",
"h-2.5 flex-col border-t border-t-transparent p-px",
className
)}
{...props}
Expand Down
2 changes: 1 addition & 1 deletion components/ui/separator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const Separator = React.forwardRef<
orientation={orientation}
className={cn(
"shrink-0 bg-border",
orientation === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]",
orientation === "horizontal" ? "h-px w-full" : "h-full w-px",
className
)}
{...props}
Expand Down
Loading

0 comments on commit 60c82b7

Please sign in to comment.