Create New Item
Item Type
File
Folder
Item Name
Search file in folder and subfolders...
Are you sure want to rename?
optometrists
/
cache
/
cache
/
cache
/
.wp-cli
/
wp-content
/
plugins
/
woocommerce
/
packages
/
woocommerce-blocks
/
assets
/
js
/
base
/
components
/
button
:
index.tsx
Advanced Search
Upload
New Item
Settings
Back
Back Up
Advanced Editor
Save
/** * External dependencies */ import { Button as WPButton } from 'wordpress-components'; import type { ReactNode } from 'react'; import classNames from 'classnames'; /** * Internal dependencies */ import './style.scss'; interface ButtonProps extends WPButton.ButtonProps { className?: string; showSpinner?: boolean; children?: ReactNode; } /** * Component that visually renders a button but semantically might be `<button>` or `<a>` depending * on the props. */ const Button = ( { className, showSpinner = false, children, ...props }: ButtonProps ): JSX.Element => { const buttonClassName = classNames( 'wc-block-components-button', className, { 'wc-block-components-button--loading': showSpinner, } ); return ( <WPButton className={ buttonClassName } { ...props }> { showSpinner && ( <span className="wc-block-components-button__spinner" aria-hidden="true" /> ) } <span className="wc-block-components-button__text"> { children } </span> </WPButton> ); }; export default Button;