UNPKG

@carbon/react

Version:

React components for the Carbon Design System

59 lines (57 loc) 1.59 kB
/** * Copyright IBM Corp. 2016, 2026 * * This source code is licensed under the Apache-2.0 license found in the * LICENSE file in the root directory of this source tree. */ import { usePrefix } from "../../internal/usePrefix.js"; import classNames from "classnames"; import "react"; import PropTypes from "prop-types"; import { jsx } from "react/jsx-runtime"; //#region src/components/Button/Button.Skeleton.tsx /** * Copyright IBM Corp. 2016, 2025 * * This source code is licensed under the Apache-2.0 license found in the * LICENSE file in the root directory of this source tree. */ const ButtonSkeleton = ({ className, small = false, href, size = "lg", ...rest }) => { const prefix = usePrefix(); const commonProps = { className: classNames(className, { [`${prefix}--skeleton`]: true, [`${prefix}--btn`]: true, [`${prefix}--btn--xs`]: size === "xs", [`${prefix}--btn--sm`]: small || size === "sm", [`${prefix}--btn--md`]: size === "md", [`${prefix}--btn--lg`]: size === "lg", [`${prefix}--btn--xl`]: size === "xl", [`${prefix}--btn--2xl`]: size === "2xl", [`${prefix}--layout--size-${size}`]: size }), ...rest }; const button = /* @__PURE__ */ jsx("div", { ...commonProps }); const anchor = /* @__PURE__ */ jsx("a", { ...commonProps, href, role: "button" }); return href ? anchor : button; }; ButtonSkeleton.propTypes = { className: PropTypes.string, href: PropTypes.string, size: PropTypes.oneOf([ "xs", "sm", "md", "lg", "xl", "2xl" ]), small: PropTypes.bool }; //#endregion export { ButtonSkeleton as default };