Back

100% Statements 2/2
100% Branches 0/0
100% Functions 1/1
100% Lines 2/2

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33                            1x 153x                                  
import { Button } from '@wordpress/components';
import { Stack } from '@wordpress/ui';
 
/**
 * MediaBrowserSelectButton component
 *
 * @param {object}   props              - The component props
 * @param {string}   props.label        - The label of the button
 * @param {string}   props.limitMessage - Message shown when the selection limit is reached
 * @param {boolean}  props.isLoading    - Whether the button is loading
 * @param {boolean}  props.disabled     - Whether the button is disabled
 * @param {Function} props.onClick      - To handle the click
 * @return {import('react').ReactElement} - JSX element
 */
const MediaBrowserSelectButton = ( { label, limitMessage, isLoading, disabled, onClick } ) => {
	return (
		<Stack
			align="center"
			justify="flex-end"
			className="jetpack-external-media-browser__media__toolbar"
		>
			<p className="jetpack-external-media-browser__media__limit" role="status">
				{ limitMessage }
			</p>
			<Button variant="primary" isBusy={ isLoading } disabled={ disabled } onClick={ onClick }>
				{ label }
			</Button>
		</Stack>
	);
};
 
export default MediaBrowserSelectButton;