Server IP : 172.67.158.161 / Your IP : 3.137.216.227 Web Server : LiteSpeed System : Linux business53.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64 User : giankuin ( 1871) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/self/root/proc/thread-self/root/home/giankuin/thietke365.net/wp-content/plugins/woocommerce/packages/woocommerce-blocks/assets/js/base/components/button/ |
Upload File : |
/** * External dependencies */ import { Button as WPButton } from 'wordpress-components'; import type { Button as WPButtonType } from '@wordpress/components'; import classNames from 'classnames'; import Spinner from '@woocommerce/base-components/spinner'; /** * Internal dependencies */ import './style.scss'; export interface ButtonProps extends Omit< WPButtonType.ButtonProps, 'variant' | 'href' > { /** * Show spinner * * @default false */ showSpinner?: boolean | undefined; /** * Button variant */ variant?: 'text' | 'contained' | 'outlined'; /** * The URL the button should link to. */ href?: string | undefined; } export interface AnchorProps extends Omit< ButtonProps, 'href' > { /** * Button href */ href?: string | undefined; } /** * Component that visually renders a button but semantically might be `<button>` or `<a>` depending * on the props. */ const Button = ( { className, showSpinner = false, children, variant = 'contained', ...props }: ButtonProps ): JSX.Element => { const buttonClassName = classNames( 'wc-block-components-button', 'wp-element-button', className, variant, { 'wc-block-components-button--loading': showSpinner, } ); return ( <WPButton className={ buttonClassName } { ...props }> { showSpinner && <Spinner /> } <span className="wc-block-components-button__text"> { children } </span> </WPButton> ); }; export default Button;