Home / File/ reset-button.tsx — ui Source File

reset-button.tsx — ui Source File

Architecture documentation for reset-button.tsx, a tsx file in the ui codebase. 7 imports, 0 dependents.

File tsx DesignEngine PreviewSystem 7 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  13e5e26c_b364_ac66_f476_d90b636b6f1a["reset-button.tsx"]
  1d141819_425e_b5fd_4c8e_32f7c6a42cf2["react"]
  13e5e26c_b364_ac66_f476_d90b636b6f1a --> 1d141819_425e_b5fd_4c8e_32f7c6a42cf2
  81821566_3643_c91a_1397_57950c94b526["core-free-icons"]
  13e5e26c_b364_ac66_f476_d90b636b6f1a --> 81821566_3643_c91a_1397_57950c94b526
  614a3ef5_2f09_8b4c_c7b8_666db5a9ce32["react"]
  13e5e26c_b364_ac66_f476_d90b636b6f1a --> 614a3ef5_2f09_8b4c_c7b8_666db5a9ce32
  f14cf7ca_f213_afc2_bc66_ebc0fb7d9834["config"]
  13e5e26c_b364_ac66_f476_d90b636b6f1a --> f14cf7ca_f213_afc2_bc66_ebc0fb7d9834
  22caac49_069c_c355_0aca_120ba055a229["alert-dialog"]
  13e5e26c_b364_ac66_f476_d90b636b6f1a --> 22caac49_069c_c355_0aca_120ba055a229
  57e86e45_ac6e_7278_be08_9092724e8401["button"]
  13e5e26c_b364_ac66_f476_d90b636b6f1a --> 57e86e45_ac6e_7278_be08_9092724e8401
  c27c6e95_5daf_4dd4_dc3a_add496837570["search-params"]
  13e5e26c_b364_ac66_f476_d90b636b6f1a --> c27c6e95_5daf_4dd4_dc3a_add496837570
  style 13e5e26c_b364_ac66_f476_d90b636b6f1a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

"use client"

import * as React from "react"
import { Undo02Icon } from "@hugeicons/core-free-icons"
import { HugeiconsIcon } from "@hugeicons/react"

import { DEFAULT_CONFIG } from "@/registry/config"
import {
  AlertDialog,
  AlertDialogAction,
  AlertDialogCancel,
  AlertDialogContent,
  AlertDialogDescription,
  AlertDialogFooter,
  AlertDialogHeader,
  AlertDialogTitle,
  AlertDialogTrigger,
} from "@/registry/new-york-v4/ui/alert-dialog"
import { Button } from "@/registry/new-york-v4/ui/button"
import { useDesignSystemSearchParams } from "@/app/(create)/lib/search-params"

export function ResetButton() {
  const [params, setParams] = useDesignSystemSearchParams()

  const handleReset = React.useCallback(() => {
    setParams({
      base: params.base, // Keep the current base value.
      style: DEFAULT_CONFIG.style,
      baseColor: DEFAULT_CONFIG.baseColor,
      theme: DEFAULT_CONFIG.theme,
      iconLibrary: DEFAULT_CONFIG.iconLibrary,
      font: DEFAULT_CONFIG.font,
      menuAccent: DEFAULT_CONFIG.menuAccent,
      menuColor: DEFAULT_CONFIG.menuColor,
      radius: DEFAULT_CONFIG.radius,
      template: DEFAULT_CONFIG.template,
      item: "preview",
    })
  }, [setParams, params.base])

  return (
    <AlertDialog>
      <AlertDialogTrigger asChild>
        <Button
          variant="ghost"
          size="sm"
          className="border-foreground/10 bg-muted/50 hidden h-[calc(--spacing(13.5))] w-[140px] touch-manipulation justify-between rounded-xl border select-none focus-visible:border-transparent focus-visible:ring-1 sm:rounded-lg md:flex md:w-full md:rounded-lg md:border-transparent md:bg-transparent md:pr-3.5! md:pl-2!"
        >
          <div className="flex flex-col justify-start text-left">
            <div className="text-muted-foreground text-xs">Reset</div>
            <div className="text-foreground text-sm font-medium">
              Start Over
            </div>
          </div>
          <HugeiconsIcon icon={Undo02Icon} className="-translate-x-0.5" />
        </Button>
      </AlertDialogTrigger>
      <AlertDialogContent className="dialog-ring p-4 sm:max-w-sm">
        <AlertDialogHeader>
          <AlertDialogTitle>Reset to defaults?</AlertDialogTitle>
          <AlertDialogDescription>
            This will reset all customization options to their default values.
            This action cannot be undone.
          </AlertDialogDescription>
        </AlertDialogHeader>
        <AlertDialogFooter>
          <AlertDialogCancel className="rounded-lg">Cancel</AlertDialogCancel>
          <AlertDialogAction className="rounded-lg" onClick={handleReset}>
            Reset
          </AlertDialogAction>
        </AlertDialogFooter>
      </AlertDialogContent>
    </AlertDialog>
  )
}

Domain

Subdomains

Functions

Dependencies

  • alert-dialog
  • button
  • config
  • core-free-icons
  • react
  • react
  • search-params

Frequently Asked Questions

What does reset-button.tsx do?
reset-button.tsx is a source file in the ui codebase, written in tsx. It belongs to the DesignEngine domain, PreviewSystem subdomain.
What functions are defined in reset-button.tsx?
reset-button.tsx defines 1 function(s): ResetButton.
What does reset-button.tsx depend on?
reset-button.tsx imports 7 module(s): alert-dialog, button, config, core-free-icons, react, react, search-params.
Where is reset-button.tsx in the architecture?
reset-button.tsx is located at apps/v4/app/(create)/components/reset-button.tsx (domain: DesignEngine, subdomain: PreviewSystem, directory: apps/v4/app/(create)/components).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free