diff --git a/examples/demo-section-blog/src/pages/_app.mdx b/examples/demo-section-blog/src/pages/_app.mdx index f7b0884..f6af108 100644 --- a/examples/demo-section-blog/src/pages/_app.mdx +++ b/examples/demo-section-blog/src/pages/_app.mdx @@ -1,5 +1,5 @@ -import "@/styles/globals.css"; -import "section-blog-theme/styles.css"; +import "section-blog-theme/styles.css" +import '@/styles/globals.css' export default function App({ Component, pageProps }) { return ; } diff --git a/examples/demo-section-blog/src/pages/index.mdx b/examples/demo-section-blog/src/pages/index.mdx index 3951365..82ce123 100644 --- a/examples/demo-section-blog/src/pages/index.mdx +++ b/examples/demo-section-blog/src/pages/index.mdx @@ -38,8 +38,12 @@ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam iaculis eros vit Aenean gravida, lacus non gravida fermentum, ante enim `console.log` facilisis dolor, quis lacinia purus enim sed mauris. Nam viverra justo lectus, sit amet ultrices odio sodales eu. + + + ## Icons +
@@ -54,6 +58,7 @@ Aenean gravida, lacus non gravida fermentum, ante enim `console.log` facilisis d
+ ## Alert @@ -65,9 +70,11 @@ Aenean gravida, lacus non gravida fermentum, ante enim `console.log` facilisis d + ## Tabs + NPM Yarn @@ -91,6 +98,8 @@ Aenean gravida, lacus non gravida fermentum, ante enim `console.log` facilisis d + + ## Code Block ```js filename="example.js" @@ -98,7 +107,6 @@ function MyButton() { return ; } ``` - ## Space @@ -107,6 +115,8 @@ function MyButton() { + + ## Follow me
diff --git a/examples/demo-section-blog/src/pages/posts/makdown.mdx b/examples/demo-section-blog/src/pages/posts/makdown.mdx index b56f257..c90f298 100644 --- a/examples/demo-section-blog/src/pages/posts/makdown.mdx +++ b/examples/demo-section-blog/src/pages/posts/makdown.mdx @@ -77,37 +77,45 @@ Superscript: X2Subscript: O2 2. Item B 3. Item C -### Tables +## Tables First table + +First Header | Second Header +------------- | ------------- +Content Cell | Content Cell +Content Cell | Content Cell -| First Header | Second Header | -| ------------ | ------------- | -| Content Cell | Content Cell | -| Content Cell | Content Cell | -Second table +### Second table -| Function name | Description | -| ------------- | -------------------------- | -| `help()` | Display the help window. | -| `destroy()` | **Destroy your computer!** | -Third table +| Function name | Description | +| ------------- | ------------------------------ | +| `help()` | Display the help window. | +| `destroy()` | **Destroy your computer!** | + + +### Third table + + +| Item | Value | +| --------- | -----:| +| Computer | $1600 | +| Phone | $12 | +| Pipe | $1 | -| Item | Value | -| -------- | ----: | -| Computer | $1600 | -| Phone | $12 | -| Pipe | $1 | Four table + | Left-Aligned | Center Aligned | Right Aligned | -| :------------ | :-------------: | ------------: | -| col 3 is | some wordy text | $1600 | -| col 2 is | centered | $12 | -| zebra stripes | are neat | $1 | +| :------------ |:---------------:| -----:| +| col 3 is | some wordy text | $1600 | +| col 2 is | centered | $12 | +| zebra stripes | are neat | $1 | + + ### GFM task list diff --git a/packages/section-blog-theme/components/ui/alert.tsx b/packages/section-blog-theme/components/ui/alert.tsx index 177d685..cc2cd8e 100644 --- a/packages/section-blog-theme/components/ui/alert.tsx +++ b/packages/section-blog-theme/components/ui/alert.tsx @@ -1,23 +1,23 @@ -import * as React from "react"; -import { cva, type VariantProps } from "class-variance-authority"; +import * as React from "react" +import { cva, type VariantProps } from "class-variance-authority" -import { cn } from "@/utility/utils"; +import { cn } from "@/utility/utils" const alertVariants = cva( - "relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7", + "nx-relative nx-w-full nx-rounded-lg nx-border nx-px-4 nx-py-3 nx-text-sm [&>svg+div]:nx-translate-y-[-3px] [&>svg]:nx-absolute [&>svg]:nx-left-4 [&>svg]:nx-top-4 [&>svg]:nx-text-foreground [&>svg~*]:nx-pl-7", { variants: { variant: { - default: "bg-background text-foreground", + default: "nx-bg-background nx-text-foreground", destructive: - "border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive", + "nx-border-destructive/50 nx-text-destructive dark:nx-border-destructive [&>svg]:nx-text-destructive", }, }, defaultVariants: { variant: "default", }, - }, -); + } +) const Alert = React.forwardRef< HTMLDivElement, @@ -29,8 +29,8 @@ const Alert = React.forwardRef< className={cn(alertVariants({ variant }), className)} {...props} /> -)); -Alert.displayName = "Alert"; +)) +Alert.displayName = "Alert" const AlertTitle = React.forwardRef< HTMLParagraphElement, @@ -38,11 +38,11 @@ const AlertTitle = React.forwardRef< >(({ className, ...props }, ref) => (
-)); -AlertTitle.displayName = "AlertTitle"; +)) +AlertTitle.displayName = "AlertTitle" const AlertDescription = React.forwardRef< HTMLParagraphElement, @@ -50,10 +50,10 @@ const AlertDescription = React.forwardRef< >(({ className, ...props }, ref) => (
-)); -AlertDescription.displayName = "AlertDescription"; +)) +AlertDescription.displayName = "AlertDescription" -export { Alert, AlertTitle, AlertDescription }; +export { Alert, AlertTitle, AlertDescription } diff --git a/packages/section-blog-theme/components/ui/avatar.tsx b/packages/section-blog-theme/components/ui/avatar.tsx index 4ae80c0..e9b945c 100644 --- a/packages/section-blog-theme/components/ui/avatar.tsx +++ b/packages/section-blog-theme/components/ui/avatar.tsx @@ -1,7 +1,7 @@ -import * as React from "react"; -import * as AvatarPrimitive from "@radix-ui/react-avatar"; +import * as React from "react" +import * as AvatarPrimitive from "@radix-ui/react-avatar" -import { cn } from "@/utility/utils"; +import { cn } from "@/utility/utils" const Avatar = React.forwardRef< React.ElementRef, @@ -10,13 +10,13 @@ const Avatar = React.forwardRef< -)); -Avatar.displayName = AvatarPrimitive.Root.displayName; +)) +Avatar.displayName = AvatarPrimitive.Root.displayName const AvatarImage = React.forwardRef< React.ElementRef, @@ -24,11 +24,11 @@ const AvatarImage = React.forwardRef< >(({ className, ...props }, ref) => ( -)); -AvatarImage.displayName = AvatarPrimitive.Image.displayName; +)) +AvatarImage.displayName = AvatarPrimitive.Image.displayName const AvatarFallback = React.forwardRef< React.ElementRef, @@ -37,12 +37,12 @@ const AvatarFallback = React.forwardRef< -)); -AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName; +)) +AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName -export { Avatar, AvatarImage, AvatarFallback }; +export { Avatar, AvatarImage, AvatarFallback } diff --git a/packages/section-blog-theme/components/ui/button.tsx b/packages/section-blog-theme/components/ui/button.tsx index e885412..0850b78 100644 --- a/packages/section-blog-theme/components/ui/button.tsx +++ b/packages/section-blog-theme/components/ui/button.tsx @@ -1,56 +1,57 @@ -import * as React from "react"; -import { Slot } from "@radix-ui/react-slot"; -import { cva, type VariantProps } from "class-variance-authority"; -import { cn } from "@/utility/utils"; +import * as React from "react" +import { Slot } from "@radix-ui/react-slot" +import { cva, type VariantProps } from "class-variance-authority" + +import { cn } from "@/utility/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-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50", + "nx-inline-flex nx-items-center nx-justify-center nx-whitespace-nowrap nx-rounded-md nx-text-sm nx-font-medium nx-transition-colors focus-visible:nx-outline-none focus-visible:nx-ring-1 focus-visible:nx-ring-ring disabled:nx-pointer-events-none disabled:nx-opacity-50", { variants: { variant: { default: - "bg-primary text-primary-foreground shadow hover:bg-primary/90", + "nx-bg-primary nx-text-primary-foreground nx-shadow hover:nx-bg-primary/90", destructive: - "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90", + "nx-bg-destructive nx-text-destructive-foreground nx-shadow-sm hover:nx-bg-destructive/90", outline: - "border border-input bg-transparent shadow-sm hover:bg-accent hover:text-accent-foreground", + "nx-border nx-border-input nx-bg-background nx-shadow-sm hover:nx-bg-accent hover:nx-text-accent-foreground", secondary: - "bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80", - ghost: "hover:bg-accent hover:text-accent-foreground", - link: "text-primary underline-offset-4 hover:underline", + "nx-bg-secondary nx-text-secondary-foreground nx-shadow-sm hover:nx-bg-secondary/80", + ghost: "hover:nx-bg-accent hover:nx-text-accent-foreground", + link: "nx-text-primary nx-underline-offset-4 hover:nx-underline", }, size: { - default: "h-9 px-4 py-2", - sm: "h-8 rounded-md px-3 text-xs", - lg: "h-10 rounded-md px-8", - icon: "h-9 w-9", + default: "nx-h-9 nx-px-4 nx-py-2", + sm: "nx-h-8 nx-rounded-md nx-px-3 nx-text-xs", + lg: "nx-h-10 nx-rounded-md nx-px-8", + icon: "nx-h-9 nx-w-9", }, }, defaultVariants: { variant: "default", size: "default", }, - }, -); + } +) export interface ButtonProps extends React.ButtonHTMLAttributes, VariantProps { - asChild?: boolean; + asChild?: boolean } const Button = React.forwardRef( ({ className, variant, size, asChild = false, ...props }, ref) => { - const Comp = asChild ? Slot : "button"; + const Comp = asChild ? Slot : "button" return ( - ); - }, -); -Button.displayName = "Button"; + ) + } +) +Button.displayName = "Button" -export { Button, buttonVariants }; +export { Button, buttonVariants } diff --git a/packages/section-blog-theme/components/ui/card.tsx b/packages/section-blog-theme/components/ui/card.tsx index 9c1b764..b9e8a16 100644 --- a/packages/section-blog-theme/components/ui/card.tsx +++ b/packages/section-blog-theme/components/ui/card.tsx @@ -1,6 +1,6 @@ -import * as React from "react"; +import * as React from "react" -import { cn } from "@/utility/utils"; +import { cn } from "@/utility/utils" const Card = React.forwardRef< HTMLDivElement, @@ -9,13 +9,13 @@ const Card = React.forwardRef<
-)); -Card.displayName = "Card"; +)) +Card.displayName = "Card" const CardHeader = React.forwardRef< HTMLDivElement, @@ -23,11 +23,11 @@ const CardHeader = React.forwardRef< >(({ className, ...props }, ref) => (
-)); -CardHeader.displayName = "CardHeader"; +)) +CardHeader.displayName = "CardHeader" const CardTitle = React.forwardRef< HTMLParagraphElement, @@ -35,11 +35,11 @@ const CardTitle = React.forwardRef< >(({ className, ...props }, ref) => (

-)); -CardTitle.displayName = "CardTitle"; +)) +CardTitle.displayName = "CardTitle" const CardDescription = React.forwardRef< HTMLParagraphElement, @@ -47,19 +47,19 @@ const CardDescription = React.forwardRef< >(({ className, ...props }, ref) => (

-)); -CardDescription.displayName = "CardDescription"; +)) +CardDescription.displayName = "CardDescription" const CardContent = React.forwardRef< HTMLDivElement, React.HTMLAttributes >(({ className, ...props }, ref) => ( -

-)); -CardContent.displayName = "CardContent"; +
+)) +CardContent.displayName = "CardContent" const CardFooter = React.forwardRef< HTMLDivElement, @@ -67,17 +67,10 @@ const CardFooter = React.forwardRef< >(({ className, ...props }, ref) => (
-)); -CardFooter.displayName = "CardFooter"; +)) +CardFooter.displayName = "CardFooter" -export { - Card, - CardHeader, - CardFooter, - CardTitle, - CardDescription, - CardContent, -}; +export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent } diff --git a/packages/section-blog-theme/components/ui/command.tsx b/packages/section-blog-theme/components/ui/command.tsx index 455baff..5da4f79 100644 --- a/packages/section-blog-theme/components/ui/command.tsx +++ b/packages/section-blog-theme/components/ui/command.tsx @@ -1,9 +1,11 @@ -import * as React from "react"; -import { DialogProps } from "@radix-ui/react-dialog"; -import { Search } from "lucide-react"; -import { Command as CommandPrimitive } from "cmdk"; -import { cn } from "@/utility/utils"; -import { Dialog, DialogContent } from "@/components//ui/dialog"; +import * as React from "react" +import { type DialogProps } from "@radix-ui/react-dialog" +import { SearchIcon } from "lucide-react"; + +import { Command as CommandPrimitive } from "cmdk" + +import { cn } from "@/utility/utils" +import { Dialog, DialogContent } from "@/components//ui/dialog" const Command = React.forwardRef< React.ElementRef, @@ -12,46 +14,46 @@ const Command = React.forwardRef< -)); -Command.displayName = CommandPrimitive.displayName; +)) +Command.displayName = CommandPrimitive.displayName interface CommandDialogProps extends DialogProps {} const CommandDialog = ({ children, ...props }: CommandDialogProps) => { return ( - - + + {children} - ); -}; + ) +} const CommandInput = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( -
- +
+
-)); +)) -CommandInput.displayName = CommandPrimitive.Input.displayName; +CommandInput.displayName = CommandPrimitive.Input.displayName const CommandList = React.forwardRef< React.ElementRef, @@ -59,12 +61,12 @@ const CommandList = React.forwardRef< >(({ className, ...props }, ref) => ( -)); +)) -CommandList.displayName = CommandPrimitive.List.displayName; +CommandList.displayName = CommandPrimitive.List.displayName const CommandEmpty = React.forwardRef< React.ElementRef, @@ -72,12 +74,12 @@ const CommandEmpty = React.forwardRef< >((props, ref) => ( -)); +)) -CommandEmpty.displayName = CommandPrimitive.Empty.displayName; +CommandEmpty.displayName = CommandPrimitive.Empty.displayName const CommandGroup = React.forwardRef< React.ElementRef, @@ -86,14 +88,14 @@ const CommandGroup = React.forwardRef< -)); +)) -CommandGroup.displayName = CommandPrimitive.Group.displayName; +CommandGroup.displayName = CommandPrimitive.Group.displayName const CommandSeparator = React.forwardRef< React.ElementRef, @@ -101,11 +103,11 @@ const CommandSeparator = React.forwardRef< >(({ className, ...props }, ref) => ( -)); -CommandSeparator.displayName = CommandPrimitive.Separator.displayName; +)) +CommandSeparator.displayName = CommandPrimitive.Separator.displayName const CommandItem = React.forwardRef< React.ElementRef, @@ -114,14 +116,14 @@ const CommandItem = React.forwardRef< -)); +)) -CommandItem.displayName = CommandPrimitive.Item.displayName; +CommandItem.displayName = CommandPrimitive.Item.displayName const CommandShortcut = ({ className, @@ -130,14 +132,14 @@ const CommandShortcut = ({ return ( - ); -}; -CommandShortcut.displayName = "CommandShortcut"; + ) +} +CommandShortcut.displayName = "CommandShortcut" export { Command, @@ -149,4 +151,4 @@ export { CommandItem, CommandShortcut, CommandSeparator, -}; +} diff --git a/packages/section-blog-theme/components/ui/dialog.tsx b/packages/section-blog-theme/components/ui/dialog.tsx index 106c52e..1e2aa9b 100644 --- a/packages/section-blog-theme/components/ui/dialog.tsx +++ b/packages/section-blog-theme/components/ui/dialog.tsx @@ -1,17 +1,16 @@ -import * as React from "react"; -import * as DialogPrimitive from "@radix-ui/react-dialog"; -import { cn } from "@/utility/utils"; -const Dialog = DialogPrimitive.Root; +import * as React from "react" +import * as DialogPrimitive from "@radix-ui/react-dialog" +import { XIcon } from 'lucide-react'; -const DialogTrigger = DialogPrimitive.Trigger; +import { cn } from "@/utility/utils" -const DialogPortal = ({ - className, - ...props -}: DialogPrimitive.DialogPortalProps) => ( - -); -DialogPortal.displayName = DialogPrimitive.Portal.displayName; +const Dialog = DialogPrimitive.Root + +const DialogTrigger = DialogPrimitive.Trigger + +const DialogPortal = DialogPrimitive.Portal + +const DialogClose = DialogPrimitive.Close const DialogOverlay = React.forwardRef< React.ElementRef, @@ -20,13 +19,13 @@ const DialogOverlay = React.forwardRef< -)); -DialogOverlay.displayName = DialogPrimitive.Overlay.displayName; +)) +DialogOverlay.displayName = DialogPrimitive.Overlay.displayName const DialogContent = React.forwardRef< React.ElementRef, @@ -37,34 +36,20 @@ const DialogContent = React.forwardRef< {children} - - - - - Close + + + Close -)); -DialogContent.displayName = DialogPrimitive.Content.displayName; +)) +DialogContent.displayName = DialogPrimitive.Content.displayName const DialogHeader = ({ className, @@ -72,13 +57,13 @@ const DialogHeader = ({ }: React.HTMLAttributes) => (
-); -DialogHeader.displayName = "DialogHeader"; +) +DialogHeader.displayName = "DialogHeader" const DialogFooter = ({ className, @@ -86,13 +71,13 @@ const DialogFooter = ({ }: React.HTMLAttributes) => (
-); -DialogFooter.displayName = "DialogFooter"; +) +DialogFooter.displayName = "DialogFooter" const DialogTitle = React.forwardRef< React.ElementRef, @@ -101,13 +86,13 @@ const DialogTitle = React.forwardRef< -)); -DialogTitle.displayName = DialogPrimitive.Title.displayName; +)) +DialogTitle.displayName = DialogPrimitive.Title.displayName const DialogDescription = React.forwardRef< React.ElementRef, @@ -115,18 +100,21 @@ const DialogDescription = React.forwardRef< >(({ className, ...props }, ref) => ( -)); -DialogDescription.displayName = DialogPrimitive.Description.displayName; +)) +DialogDescription.displayName = DialogPrimitive.Description.displayName export { Dialog, + DialogPortal, + DialogOverlay, + DialogTrigger, + DialogClose, DialogContent, - DialogDescription, - DialogFooter, DialogHeader, + DialogFooter, DialogTitle, - DialogTrigger, -}; + DialogDescription, +} diff --git a/packages/section-blog-theme/components/ui/dropdown-menu.tsx b/packages/section-blog-theme/components/ui/dropdown-menu.tsx index 2e6442e..2a4df4a 100644 --- a/packages/section-blog-theme/components/ui/dropdown-menu.tsx +++ b/packages/section-blog-theme/components/ui/dropdown-menu.tsx @@ -1,41 +1,42 @@ -import * as React from "react"; -import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu"; -import { CheckIcon, ChevronRightIcon, DotIcon } from "lucide-react"; -import { cn } from "@/utility/utils"; +import * as React from "react" +import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu" +import { ChevronRightIcon, CheckIcon, DotIcon} from 'lucide-react'; -const DropdownMenu = DropdownMenuPrimitive.Root; +import { cn } from "@/utility/utils" -const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger; +const DropdownMenu = DropdownMenuPrimitive.Root -const DropdownMenuGroup = DropdownMenuPrimitive.Group; +const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger -const DropdownMenuPortal = DropdownMenuPrimitive.Portal; +const DropdownMenuGroup = DropdownMenuPrimitive.Group -const DropdownMenuSub = DropdownMenuPrimitive.Sub; +const DropdownMenuPortal = DropdownMenuPrimitive.Portal -const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup; +const DropdownMenuSub = DropdownMenuPrimitive.Sub + +const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup const DropdownMenuSubTrigger = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef & { - inset?: boolean; + inset?: boolean } >(({ className, inset, children, ...props }, ref) => ( {children} - + -)); +)) DropdownMenuSubTrigger.displayName = - DropdownMenuPrimitive.SubTrigger.displayName; + DropdownMenuPrimitive.SubTrigger.displayName const DropdownMenuSubContent = React.forwardRef< React.ElementRef, @@ -44,14 +45,14 @@ const DropdownMenuSubContent = React.forwardRef< -)); +)) DropdownMenuSubContent.displayName = - DropdownMenuPrimitive.SubContent.displayName; + DropdownMenuPrimitive.SubContent.displayName const DropdownMenuContent = React.forwardRef< React.ElementRef, @@ -62,33 +63,33 @@ const DropdownMenuContent = React.forwardRef< ref={ref} sideOffset={sideOffset} className={cn( - "z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md", - "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2", - className, + "nx-z-50 nx-min-w-[8rem] nx-overflow-hidden nx-rounded-md nx-border nx-bg-popover nx-p-1 nx-text-popover-foreground nx-shadow-md", + "data-[state=open]:nx-animate-in data-[state=closed]:nx-animate-out data-[state=closed]:nx-fade-out-0 data-[state=open]:nx-fade-in-0 data-[state=closed]:nx-zoom-out-95 data-[state=open]:nx-zoom-in-95 data-[side=bottom]:nx-slide-in-from-top-2 data-[side=left]:nx-slide-in-from-right-2 data-[side=right]:nx-slide-in-from-left-2 data-[side=top]:nx-slide-in-from-bottom-2", + className )} {...props} /> -)); -DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName; +)) +DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName const DropdownMenuItem = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef & { - inset?: boolean; + inset?: boolean } >(({ className, inset, ...props }, ref) => ( -)); -DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName; +)) +DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName const DropdownMenuCheckboxItem = React.forwardRef< React.ElementRef, @@ -97,22 +98,22 @@ const DropdownMenuCheckboxItem = React.forwardRef< - + - + {children} -)); +)) DropdownMenuCheckboxItem.displayName = - DropdownMenuPrimitive.CheckboxItem.displayName; + DropdownMenuPrimitive.CheckboxItem.displayName const DropdownMenuRadioItem = React.forwardRef< React.ElementRef, @@ -121,38 +122,38 @@ const DropdownMenuRadioItem = React.forwardRef< - + - + {children} -)); -DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName; +)) +DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName const DropdownMenuLabel = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef & { - inset?: boolean; + inset?: boolean } >(({ className, inset, ...props }, ref) => ( -)); -DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName; +)) +DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName const DropdownMenuSeparator = React.forwardRef< React.ElementRef, @@ -160,11 +161,11 @@ const DropdownMenuSeparator = React.forwardRef< >(({ className, ...props }, ref) => ( -)); -DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName; +)) +DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName const DropdownMenuShortcut = ({ className, @@ -172,12 +173,12 @@ const DropdownMenuShortcut = ({ }: React.HTMLAttributes) => { return ( - ); -}; -DropdownMenuShortcut.displayName = "DropdownMenuShortcut"; + ) +} +DropdownMenuShortcut.displayName = "DropdownMenuShortcut" export { DropdownMenu, @@ -195,4 +196,4 @@ export { DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuRadioGroup, -}; +} diff --git a/packages/section-blog-theme/components/ui/input.tsx b/packages/section-blog-theme/components/ui/input.tsx index 716d8b4..1adce38 100644 --- a/packages/section-blog-theme/components/ui/input.tsx +++ b/packages/section-blog-theme/components/ui/input.tsx @@ -1,6 +1,6 @@ -import * as React from "react"; +import * as React from "react" -import { cn } from "@/utility/utils"; +import { cn } from "@/utility/utils" export interface InputProps extends React.InputHTMLAttributes {} @@ -11,15 +11,15 @@ const Input = React.forwardRef( - ); - }, -); -Input.displayName = "Input"; + ) + } +) +Input.displayName = "Input" -export { Input }; +export { Input } diff --git a/packages/section-blog-theme/components/ui/label.tsx b/packages/section-blog-theme/components/ui/label.tsx index 4eb7668..308ba18 100644 --- a/packages/section-blog-theme/components/ui/label.tsx +++ b/packages/section-blog-theme/components/ui/label.tsx @@ -1,12 +1,12 @@ -import * as React from "react"; -import * as LabelPrimitive from "@radix-ui/react-label"; -import { cva, type VariantProps } from "class-variance-authority"; +import * as React from "react" +import * as LabelPrimitive from "@radix-ui/react-label" +import { cva, type VariantProps } from "class-variance-authority" -import { cn } from "@/utility/utils"; +import { cn } from "@/utility/utils" const labelVariants = cva( - "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70", -); + "nx-text-sm nx-font-medium nx-leading-none peer-disabled:nx-cursor-not-allowed peer-disabled:nx-opacity-70" +) const Label = React.forwardRef< React.ElementRef, @@ -18,7 +18,7 @@ const Label = React.forwardRef< className={cn(labelVariants(), className)} {...props} /> -)); -Label.displayName = LabelPrimitive.Root.displayName; +)) +Label.displayName = LabelPrimitive.Root.displayName -export { Label }; +export { Label } diff --git a/packages/section-blog-theme/components/ui/navigation-menu.tsx b/packages/section-blog-theme/components/ui/navigation-menu.tsx index 40dc682..37b1e3d 100644 --- a/packages/section-blog-theme/components/ui/navigation-menu.tsx +++ b/packages/section-blog-theme/components/ui/navigation-menu.tsx @@ -1,8 +1,9 @@ -import * as React from "react"; -import { ChevronDownIcon } from "lucide-react"; -import * as NavigationMenuPrimitive from "@radix-ui/react-navigation-menu"; -import { cva } from "class-variance-authority"; -import { cn } from "@/utility/utils"; +import * as React from "react" +import { ChevronDown } from 'lucide-react'; +import * as NavigationMenuPrimitive from "@radix-ui/react-navigation-menu" +import { cva } from "class-variance-authority" + +import { cn } from "@/utility/utils" const NavigationMenu = React.forwardRef< React.ElementRef, @@ -11,16 +12,16 @@ const NavigationMenu = React.forwardRef< {children} -)); -NavigationMenu.displayName = NavigationMenuPrimitive.Root.displayName; +)) +NavigationMenu.displayName = NavigationMenuPrimitive.Root.displayName const NavigationMenuList = React.forwardRef< React.ElementRef, @@ -29,19 +30,19 @@ const NavigationMenuList = React.forwardRef< -)); -NavigationMenuList.displayName = NavigationMenuPrimitive.List.displayName; +)) +NavigationMenuList.displayName = NavigationMenuPrimitive.List.displayName -const NavigationMenuItem = NavigationMenuPrimitive.Item; +const NavigationMenuItem = NavigationMenuPrimitive.Item const navigationMenuTriggerStyle = cva( - "group inline-flex h-9 w-max items-center justify-center rounded-md bg-background px-4 py-2 text-sm font-medium transition-colors hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus:outline-none disabled:pointer-events-none disabled:opacity-50 data-[active]:bg-accent/50 data-[state=open]:bg-accent/50", -); + "nx-group nx-inline-flex nx-h-9 nx-w-max nx-items-center nx-justify-center nx-rounded-md nx-bg-background nx-px-4 nx-py-2 nx-text-sm nx-font-medium nx-transition-colors hover:nx-bg-accent hover:nx-text-accent-foreground focus:nx-bg-accent focus:nx-text-accent-foreground focus:nx-outline-none disabled:nx-pointer-events-none disabled:nx-opacity-50 data-[active]:nx-bg-accent/50 data-[state=open]:nx-bg-accent/50" +) const NavigationMenuTrigger = React.forwardRef< React.ElementRef, @@ -49,17 +50,17 @@ const NavigationMenuTrigger = React.forwardRef< >(({ className, children, ...props }, ref) => ( {children}{" "} - -)); -NavigationMenuTrigger.displayName = NavigationMenuPrimitive.Trigger.displayName; +)) +NavigationMenuTrigger.displayName = NavigationMenuPrimitive.Trigger.displayName const NavigationMenuContent = React.forwardRef< React.ElementRef, @@ -68,33 +69,33 @@ const NavigationMenuContent = React.forwardRef< -)); -NavigationMenuContent.displayName = NavigationMenuPrimitive.Content.displayName; +)) +NavigationMenuContent.displayName = NavigationMenuPrimitive.Content.displayName -const NavigationMenuLink = NavigationMenuPrimitive.Link; +const NavigationMenuLink = NavigationMenuPrimitive.Link const NavigationMenuViewport = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( -
+
-)); +)) NavigationMenuViewport.displayName = - NavigationMenuPrimitive.Viewport.displayName; + NavigationMenuPrimitive.Viewport.displayName const NavigationMenuIndicator = React.forwardRef< React.ElementRef, @@ -103,16 +104,16 @@ const NavigationMenuIndicator = React.forwardRef< -
+
-)); +)) NavigationMenuIndicator.displayName = - NavigationMenuPrimitive.Indicator.displayName; + NavigationMenuPrimitive.Indicator.displayName export { navigationMenuTriggerStyle, @@ -124,4 +125,4 @@ export { NavigationMenuLink, NavigationMenuIndicator, NavigationMenuViewport, -}; +} diff --git a/packages/section-blog-theme/components/ui/separator.tsx b/packages/section-blog-theme/components/ui/separator.tsx index fc43266..9f7692f 100644 --- a/packages/section-blog-theme/components/ui/separator.tsx +++ b/packages/section-blog-theme/components/ui/separator.tsx @@ -1,7 +1,7 @@ -import * as React from "react"; -import * as SeparatorPrimitive from "@radix-ui/react-separator"; +import * as React from "react" +import * as SeparatorPrimitive from "@radix-ui/react-separator" -import { cn } from "@/utility/utils"; +import { cn } from "@/utility/utils" const Separator = React.forwardRef< React.ElementRef, @@ -9,21 +9,21 @@ const Separator = React.forwardRef< >( ( { className, orientation = "horizontal", decorative = true, ...props }, - ref, + ref ) => ( - ), -); -Separator.displayName = SeparatorPrimitive.Root.displayName; + ) +) +Separator.displayName = SeparatorPrimitive.Root.displayName -export { Separator }; +export { Separator } diff --git a/packages/section-blog-theme/components/ui/tabs.tsx b/packages/section-blog-theme/components/ui/tabs.tsx index 0fbbf9d..66026cf 100644 --- a/packages/section-blog-theme/components/ui/tabs.tsx +++ b/packages/section-blog-theme/components/ui/tabs.tsx @@ -1,9 +1,9 @@ -import * as React from "react"; -import * as TabsPrimitive from "@radix-ui/react-tabs"; +import * as React from "react" +import * as TabsPrimitive from "@radix-ui/react-tabs" -import { cn } from "@/utility/utils"; +import { cn } from "@/utility/utils" -const Tabs = TabsPrimitive.Root; +const Tabs = TabsPrimitive.Root const TabsList = React.forwardRef< React.ElementRef, @@ -12,13 +12,13 @@ const TabsList = React.forwardRef< -)); -TabsList.displayName = TabsPrimitive.List.displayName; +)) +TabsList.displayName = TabsPrimitive.List.displayName const TabsTrigger = React.forwardRef< React.ElementRef, @@ -27,13 +27,13 @@ const TabsTrigger = React.forwardRef< -)); -TabsTrigger.displayName = TabsPrimitive.Trigger.displayName; +)) +TabsTrigger.displayName = TabsPrimitive.Trigger.displayName const TabsContent = React.forwardRef< React.ElementRef, @@ -42,12 +42,12 @@ const TabsContent = React.forwardRef< -)); -TabsContent.displayName = TabsPrimitive.Content.displayName; +)) +TabsContent.displayName = TabsPrimitive.Content.displayName -export { Tabs, TabsList, TabsTrigger, TabsContent }; +export { Tabs, TabsList, TabsTrigger, TabsContent } diff --git a/packages/section-blog-theme/components/ui/toast.tsx b/packages/section-blog-theme/components/ui/toast.tsx index 0646aba..091d6e7 100644 --- a/packages/section-blog-theme/components/ui/toast.tsx +++ b/packages/section-blog-theme/components/ui/toast.tsx @@ -1,11 +1,11 @@ -import * as React from "react"; -import { Cross2Icon } from "@radix-ui/react-icons"; -import * as ToastPrimitives from "@radix-ui/react-toast"; -import { cva, type VariantProps } from "class-variance-authority"; +import * as React from "react" +import { Cross2Icon } from "@radix-ui/react-icons" +import * as ToastPrimitives from "@radix-ui/react-toast" +import { cva, type VariantProps } from "class-variance-authority" -import { cn } from "@/utility/utils"; +import { cn } from "@/utility/utils" -const ToastProvider = ToastPrimitives.Provider; +const ToastProvider = ToastPrimitives.Provider const ToastViewport = React.forwardRef< React.ElementRef, @@ -14,29 +14,29 @@ const ToastViewport = React.forwardRef< -)); -ToastViewport.displayName = ToastPrimitives.Viewport.displayName; +)) +ToastViewport.displayName = ToastPrimitives.Viewport.displayName const toastVariants = cva( - "group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md border p-4 pr-6 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full", + "nx-group nx-pointer-events-auto nx-relative nx-flex nx-w-full nx-items-center nx-justify-between nx-space-x-2 nx-overflow-hidden nx-rounded-md nx-border nx-p-4 nx-pr-6 nx-shadow-lg nx-transition-all data-[swipe=cancel]:nx-translate-x-0 data-[swipe=end]:nx-translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:nx-translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:nx-transition-none data-[state=open]:nx-animate-in data-[state=closed]:nx-animate-out data-[swipe=end]:nx-animate-out data-[state=closed]:nx-fade-out-80 data-[state=closed]:nx-slide-out-to-right-full data-[state=open]:nx-slide-in-from-top-full data-[state=open]:sm:nx-slide-in-from-bottom-full", { variants: { variant: { - default: "border bg-background text-foreground", + default: "nx-border nx-bg-background nx-text-foreground", destructive: - "destructive group border-destructive bg-destructive text-destructive-foreground", + "nx-destructive nx-group nx-border-destructive nx-bg-destructive nx-text-destructive-foreground", }, }, defaultVariants: { variant: "default", }, - }, -); + } +) const Toast = React.forwardRef< React.ElementRef, @@ -49,9 +49,9 @@ const Toast = React.forwardRef< className={cn(toastVariants({ variant }), className)} {...props} /> - ); -}); -Toast.displayName = ToastPrimitives.Root.displayName; + ) +}) +Toast.displayName = ToastPrimitives.Root.displayName const ToastAction = React.forwardRef< React.ElementRef, @@ -60,13 +60,13 @@ const ToastAction = React.forwardRef< -)); -ToastAction.displayName = ToastPrimitives.Action.displayName; +)) +ToastAction.displayName = ToastPrimitives.Action.displayName const ToastClose = React.forwardRef< React.ElementRef, @@ -75,16 +75,16 @@ const ToastClose = React.forwardRef< - + -)); -ToastClose.displayName = ToastPrimitives.Close.displayName; +)) +ToastClose.displayName = ToastPrimitives.Close.displayName const ToastTitle = React.forwardRef< React.ElementRef, @@ -92,11 +92,11 @@ const ToastTitle = React.forwardRef< >(({ className, ...props }, ref) => ( -)); -ToastTitle.displayName = ToastPrimitives.Title.displayName; +)) +ToastTitle.displayName = ToastPrimitives.Title.displayName const ToastDescription = React.forwardRef< React.ElementRef, @@ -104,15 +104,15 @@ const ToastDescription = React.forwardRef< >(({ className, ...props }, ref) => ( -)); -ToastDescription.displayName = ToastPrimitives.Description.displayName; +)) +ToastDescription.displayName = ToastPrimitives.Description.displayName -type ToastProps = React.ComponentPropsWithoutRef; +type ToastProps = React.ComponentPropsWithoutRef -type ToastActionElement = React.ReactElement; +type ToastActionElement = React.ReactElement export { type ToastProps, @@ -124,4 +124,4 @@ export { ToastDescription, ToastClose, ToastAction, -}; +} diff --git a/packages/section-blog-theme/components/ui/toaster.tsx b/packages/section-blog-theme/components/ui/toaster.tsx index a4f50b3..e4c2b8e 100644 --- a/packages/section-blog-theme/components/ui/toaster.tsx +++ b/packages/section-blog-theme/components/ui/toaster.tsx @@ -5,18 +5,18 @@ import { ToastProvider, ToastTitle, ToastViewport, -} from "@/components//ui/toast"; -import { useToast } from "@/components//ui/use-toast"; +} from "@/components//ui/toast" +import { useToast } from "@/components//ui/use-toast" export function Toaster() { - const { toasts } = useToast(); + const { toasts } = useToast() return ( {toasts.map(function ({ id, title, description, action, ...props }) { return ( -
+
{title && {title}} {description && ( {description} @@ -25,9 +25,9 @@ export function Toaster() { {action} - ); + ) })} - ); + ) } diff --git a/packages/section-blog-theme/components/ui/tooltip.tsx b/packages/section-blog-theme/components/ui/tooltip.tsx index 299fe56..639956f 100644 --- a/packages/section-blog-theme/components/ui/tooltip.tsx +++ b/packages/section-blog-theme/components/ui/tooltip.tsx @@ -1,13 +1,13 @@ -import * as React from "react"; -import * as TooltipPrimitive from "@radix-ui/react-tooltip"; +import * as React from "react" +import * as TooltipPrimitive from "@radix-ui/react-tooltip" -import { cn } from "@/utility/utils"; +import { cn } from "@/utility/utils" -const TooltipProvider = TooltipPrimitive.Provider; +const TooltipProvider = TooltipPrimitive.Provider -const Tooltip = TooltipPrimitive.Root; +const Tooltip = TooltipPrimitive.Root -const TooltipTrigger = TooltipPrimitive.Trigger; +const TooltipTrigger = TooltipPrimitive.Trigger const TooltipContent = React.forwardRef< React.ElementRef, @@ -17,12 +17,12 @@ const TooltipContent = React.forwardRef< ref={ref} sideOffset={sideOffset} className={cn( - "z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2", - className, + "nx-z-50 nx-overflow-hidden nx-rounded-md nx-bg-primary nx-px-3 nx-py-1.5 nx-text-xs nx-text-primary-foreground nx-animate-in nx-fade-in-0 nx-zoom-in-95 data-[state=closed]:nx-animate-out data-[state=closed]:nx-fade-out-0 data-[state=closed]:nx-zoom-out-95 data-[side=bottom]:nx-slide-in-from-top-2 data-[side=left]:nx-slide-in-from-right-2 data-[side=right]:nx-slide-in-from-left-2 data-[side=top]:nx-slide-in-from-bottom-2", + className )} {...props} /> -)); -TooltipContent.displayName = TooltipPrimitive.Content.displayName; +)) +TooltipContent.displayName = TooltipPrimitive.Content.displayName -export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider }; +export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider } diff --git a/packages/section-blog-theme/components/ui/use-toast.ts b/packages/section-blog-theme/components/ui/use-toast.ts index a799d87..cbd2ac4 100644 --- a/packages/section-blog-theme/components/ui/use-toast.ts +++ b/packages/section-blog-theme/components/ui/use-toast.ts @@ -1,73 +1,76 @@ // Inspired by react-hot-toast library -import * as React from "react"; +import * as React from "react" -import type { ToastActionElement, ToastProps } from "@/components//ui/toast"; +import type { + ToastActionElement, + ToastProps, +} from "@/components//ui/toast" -const TOAST_LIMIT = 1; -const TOAST_REMOVE_DELAY = 1000000; +const TOAST_LIMIT = 1 +const TOAST_REMOVE_DELAY = 1000000 type ToasterToast = ToastProps & { - id: string; - title?: React.ReactNode; - description?: React.ReactNode; - action?: ToastActionElement; -}; + id: string + title?: React.ReactNode + description?: React.ReactNode + action?: ToastActionElement +} const actionTypes = { ADD_TOAST: "ADD_TOAST", UPDATE_TOAST: "UPDATE_TOAST", DISMISS_TOAST: "DISMISS_TOAST", REMOVE_TOAST: "REMOVE_TOAST", -} as const; +} as const -let count = 0; +let count = 0 function genId() { - count = (count + 1) % Number.MAX_VALUE; - return count.toString(); + count = (count + 1) % Number.MAX_SAFE_INTEGER + return count.toString() } -type ActionType = typeof actionTypes; +type ActionType = typeof actionTypes type Action = | { - type: ActionType["ADD_TOAST"]; - toast: ToasterToast; + type: ActionType["ADD_TOAST"] + toast: ToasterToast } | { - type: ActionType["UPDATE_TOAST"]; - toast: Partial; + type: ActionType["UPDATE_TOAST"] + toast: Partial } | { - type: ActionType["DISMISS_TOAST"]; - toastId?: ToasterToast["id"]; + type: ActionType["DISMISS_TOAST"] + toastId?: ToasterToast["id"] } | { - type: ActionType["REMOVE_TOAST"]; - toastId?: ToasterToast["id"]; - }; + type: ActionType["REMOVE_TOAST"] + toastId?: ToasterToast["id"] + } interface State { - toasts: ToasterToast[]; + toasts: ToasterToast[] } -const toastTimeouts = new Map>(); +const toastTimeouts = new Map>() const addToRemoveQueue = (toastId: string) => { if (toastTimeouts.has(toastId)) { - return; + return } const timeout = setTimeout(() => { - toastTimeouts.delete(toastId); + toastTimeouts.delete(toastId) dispatch({ type: "REMOVE_TOAST", toastId: toastId, - }); - }, TOAST_REMOVE_DELAY); + }) + }, TOAST_REMOVE_DELAY) - toastTimeouts.set(toastId, timeout); -}; + toastTimeouts.set(toastId, timeout) +} export const reducer = (state: State, action: Action): State => { switch (action.type) { @@ -75,27 +78,27 @@ export const reducer = (state: State, action: Action): State => { return { ...state, toasts: [action.toast, ...state.toasts].slice(0, TOAST_LIMIT), - }; + } case "UPDATE_TOAST": return { ...state, toasts: state.toasts.map((t) => - t.id === action.toast.id ? { ...t, ...action.toast } : t, + t.id === action.toast.id ? { ...t, ...action.toast } : t ), - }; + } case "DISMISS_TOAST": { - const { toastId } = action; + const { toastId } = action // ! Side effects ! - This could be extracted into a dismissToast() action, // but I'll keep it here for simplicity if (toastId) { - addToRemoveQueue(toastId); + addToRemoveQueue(toastId) } else { state.toasts.forEach((toast) => { - addToRemoveQueue(toast.id); - }); + addToRemoveQueue(toast.id) + }) } return { @@ -106,46 +109,46 @@ export const reducer = (state: State, action: Action): State => { ...t, open: false, } - : t, + : t ), - }; + } } case "REMOVE_TOAST": if (action.toastId === undefined) { return { ...state, toasts: [], - }; + } } return { ...state, toasts: state.toasts.filter((t) => t.id !== action.toastId), - }; + } } -}; +} -const listeners: Array<(state: State) => void> = []; +const listeners: Array<(state: State) => void> = [] -let memoryState: State = { toasts: [] }; +let memoryState: State = { toasts: [] } function dispatch(action: Action) { - memoryState = reducer(memoryState, action); + memoryState = reducer(memoryState, action) listeners.forEach((listener) => { - listener(memoryState); - }); + listener(memoryState) + }) } -type Toast = Omit; +type Toast = Omit function toast({ ...props }: Toast) { - const id = genId(); + const id = genId() const update = (props: ToasterToast) => dispatch({ type: "UPDATE_TOAST", toast: { ...props, id }, - }); - const dismiss = () => dispatch({ type: "DISMISS_TOAST", toastId: id }); + }) + const dismiss = () => dispatch({ type: "DISMISS_TOAST", toastId: id }) dispatch({ type: "ADD_TOAST", @@ -154,36 +157,36 @@ function toast({ ...props }: Toast) { id, open: true, onOpenChange: (open) => { - if (!open) dismiss(); + if (!open) dismiss() }, }, - }); + }) return { id: id, dismiss, update, - }; + } } function useToast() { - const [state, setState] = React.useState(memoryState); + const [state, setState] = React.useState(memoryState) React.useEffect(() => { - listeners.push(setState); + listeners.push(setState) return () => { - const index = listeners.indexOf(setState); + const index = listeners.indexOf(setState) if (index > -1) { - listeners.splice(index, 1); + listeners.splice(index, 1) } - }; - }, [state]); + } + }, [state]) return { ...state, toast, dismiss: (toastId?: string) => dispatch({ type: "DISMISS_TOAST", toastId }), - }; + } } -export { useToast, toast }; +export { useToast, toast }