UNPKG

@rainbow-me/rainbowkit

Version:
89 lines (86 loc) 2.16 kB
"use client"; import { Text } from "./chunk-32RBZPUM.js"; import { touchableStyles } from "./chunk-2W63IDAD.js"; import { isMobile } from "./chunk-N6EWR2LO.js"; import { Box } from "./chunk-ZKEPQLOV.js"; // src/components/Button/ActionButton.tsx import React from "react"; var sizeVariants = { large: { fontSize: "16", paddingX: "24", paddingY: "10" }, medium: { fontSize: "14", height: "28", paddingX: "12", paddingY: "4" }, small: { fontSize: "14", paddingX: "10", paddingY: "5" } }; function ActionButton({ disabled = false, href, label, onClick, rel = "noreferrer noopener", size = "medium", target = "_blank", testId, type = "primary" }) { const isPrimary = type === "primary"; const isNotLarge = size !== "large"; const mobile = isMobile(); const background = !disabled ? isPrimary ? "accentColor" : isNotLarge ? "actionButtonSecondaryBackground" : null : "actionButtonSecondaryBackground"; const { fontSize, height, paddingX, paddingY } = sizeVariants[size]; const hasBorder = !mobile || !isNotLarge; return /* @__PURE__ */ React.createElement( Box, { ...href ? !disabled ? { as: "a", href, rel, target } : {} : { as: "button", type: "button" }, onClick: !disabled ? onClick : void 0, ...hasBorder ? { borderColor: mobile && !isNotLarge && !isPrimary ? "actionButtonBorderMobile" : "actionButtonBorder", borderStyle: "solid", borderWidth: "1" } : {}, borderRadius: "actionButton", className: !disabled && touchableStyles({ active: "shrinkSm", hover: "grow" }), display: "block", paddingX, paddingY, style: { willChange: "transform" }, testId, textAlign: "center", transition: "transform", ...background ? { background } : {}, ...height ? { height } : {} }, /* @__PURE__ */ React.createElement( Text, { color: !disabled ? isPrimary ? "accentColorForeground" : "accentColor" : "modalTextSecondary", size: fontSize, weight: "bold" }, label ) ); } export { ActionButton };