+ "content": "import { Frame } from \"@/components/nurui/frame\";\nimport { twMerge } from \"tailwind-merge\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\n\n// 🎨 Theme colors — no CSS variables, pure hex/rgba\nconst COLORS = {\n default: {\n stroke1: \"#4f46e5\",\n fill1: \"rgba(79,70,229,0.22)\",\n stroke2: \"#4f46e5\",\n fill2: \"rgba(79,70,229,0.1)\",\n text: \"#ffffff\",\n },\n accent: {\n stroke1: \"#f97316\",\n fill1: \"rgba(249,115,22,0.4)\",\n stroke2: \"#f97316\",\n fill2: \"rgba(249,115,22,0.2)\",\n text: \"#ffffff\",\n },\n destructive: {\n stroke1: \"#dc2626\",\n fill1: \"rgba(220,38,38,0.22)\",\n stroke2: \"#dc2626\",\n fill2: \"rgba(220,38,38,0.1)\",\n text: \"#ffffff\",\n },\n secondary: {\n stroke1: \"#64748b\",\n fill1: \"rgba(100,116,139,0.15)\",\n stroke2: \"#64748b\",\n fill2: \"rgba(100,116,139,0.1)\",\n text: \"#ffffff\",\n },\n success: {\n stroke1: \"#16a34a\",\n fill1: \"rgba(22,163,74,0.22)\",\n stroke2: \"#16a34a\",\n fill2: \"rgba(22,163,74,0.1)\",\n text: \"#ffffff\",\n },\n};\n\nconst buttonVariants = cva(\n \"group font-bold mb-2 relative px-8 py-2 cursor-pointer transition-all outline-none [&>span]:relative [&>span]:flex [&>span]:items-center [&>span]:justify-center\",\n {\n variants: {\n shape: {\n default: \"\",\n flat: \"\",\n simple: \"ps-8 pe-6\",\n },\n },\n defaultVariants: {\n shape: \"default\",\n },\n },\n);\n\nfunction FutureButton({\n className,\n children,\n shape = \"default\",\n enableBackdropBlur = false,\n enableViewBox = false,\n customPaths,\n textColor,\n ...props\n}: React.ComponentProps<\"button\"> &\n VariantProps<typeof buttonVariants> & {\n customPaths?: string[];\n enableBackdropBlur?: boolean;\n enableViewBox?: boolean;\n bgColor?: string;\n textColor?: string;\n }) {\n const colors = COLORS.default;\n\n return (\n <button\n {...props}\n style={{\n color: textColor || colors.text,\n }}\n className={twMerge(buttonVariants({ shape, className }))}\n >\n <div className=\"absolute inset-0 -mb-2\">\n {!customPaths && (shape === \"default\" || shape === \"flat\") && (\n <Frame\n enableBackdropBlur={enableBackdropBlur}\n enableViewBox={enableViewBox}\n paths={[\n {\n show: true,\n style: {\n strokeWidth: \"1\",\n stroke: colors.stroke1,\n fill: colors.fill1,\n },\n path: [\n [\"M\", \"17\", \"0\"],\n [\"L\", \"100% - 7\", \"0\"],\n [\"L\", \"100% + 0\", \"0% + 9.5\"],\n [\"L\", \"100% - 18\", \"100% - 6\"],\n [\"L\", \"4\", \"100% - 6\"],\n [\"L\", \"0\", \"100% - 15\"],\n [\"L\", \"17\", \"0\"],\n ],\n },\n {\n show: true,\n style: {\n strokeWidth: \"1\",\n stroke: colors.stroke2,\n fill: colors.fill2,\n },\n path: [\n [\"M\", \"9\", \"100% - 6\"],\n [\"L\", \"100% - 22\", \"100% - 6\"],\n [\"L\", \"100% - 25\", \"100% + 0\"],\n [\"L\", \"12\", \"100% + 0\"],\n [\"L\", \"9\", \"100% - 6\"],\n ],\n },\n ]}\n />\n )}\n\n {!customPaths && shape === \"simple\" && (\n <Frame\n enableBackdropBlur={enableBackdropBlur}\n enableViewBox={enableViewBox}\n paths={[\n {\n show: true,\n style: {\n strokeWidth: \"1\",\n stroke: colors.stroke1,\n fill: colors.fill1,\n },\n path: [\n [\"M\", \"17\", \"0\"],\n [\"L\", \"100% - 0\", \"0\"],\n [\"L\", \"100% - 0\", \"100% - 6\"],\n [\"L\", \"0% + 3\", \"100% - 6\"],\n [\"L\", \"0% - 0\", \"100% - 16\"],\n [\"L\", \"17\", \"0\"],\n ],\n },\n {\n show: true,\n style: {\n strokeWidth: \"1\",\n stroke: colors.stroke2,\n fill: colors.fill2,\n },\n path: [\n [\"M\", \"8\", \"100% - 6\"],\n [\"L\", \"100% - 5\", \"100% - 6\"],\n [\"L\", \"100% - 7\", \"100% - 0\"],\n [\"L\", \"10\", \"100% - 0\"],\n [\"L\", \"8\", \"100% - 6\"],\n ],\n },\n ]}\n />\n )}\n\n {customPaths?.map((customPath, i) => (\n <Frame key={i} paths={JSON.parse(customPath)} />\n ))}\n </div>\n <span>{children}</span>\n </button>\n );\n}\n\nexport default FutureButton;\n",
0 commit comments