"use client" import { Button } from "@/components/ui/button" import { SectionHeading } from "@/components/ui/section-heading" import { ComponentContainer } from "@/components/ui/component-container" import { commonProperties, getIconByName, generateIconImport, generateIconJSX, getActualValue, } from "@/utils/component-properties" import { cn } from "@/lib/utils" export function ButtonsSection() { // Define button properties const buttonProperties = [ commonProperties.buttonVariant, commonProperties.buttonSize, { name: "text", type: "text", defaultValue: "Button", label: "Text", description: "The text content of the button", }, commonProperties.icon, commonProperties.iconPosition, commonProperties.disabled, { name: "loading", type: "boolean", defaultValue: false, label: "Loading", description: "Show loading spinner", }, ] // Render button based on properties const renderButton = (props: Record) => { const icon = getIconByName(props.icon) const isIconOnly = getActualValue(props.size) === "icon" const actualVariant = getActualValue(props.variant) const actualSize = getActualValue(props.size) const actualIconPosition = getActualValue(props.iconPosition) return ( ) } // Generate button code const generateButtonCode = (props: Record) => { const isIconOnly = getActualValue(props.size) === "icon" const actualVariant = getActualValue(props.variant) const actualSize = getActualValue(props.size) const actualIconPosition = getActualValue(props.iconPosition) const actualIcon = getActualValue(props.icon) let code = `import { Button } from "@/components/ui/button"\n` if (actualIcon !== "none") { code += generateIconImport(props.icon) } code += "\n" code += `` if (props.loading) { code += `\n \n` } if (props.loading) { code += ` ` } if (!isIconOnly) { if (actualIcon !== "none" && actualIconPosition === "left") { code += props.loading ? "" : "\n " code += `${generateIconJSX(props.icon)}` code += props.loading ? "" : "\n " } else { code += props.loading ? "" : " " } code += props.text if (actualIcon !== "none" && actualIconPosition === "right") { code += props.loading ? "" : "\n " code += `${generateIconJSX(props.icon)}` code += props.loading ? "" : "\n" } } else { code += generateIconJSX(props.icon) } if (props.loading) { code += `` } code += `\n` return code } return (
Default `} >
Default `} >
Default `} >

Usage

            {`import { Button } from "@/components/ui/button"`}
          
) }