# ghostkit/3.7.2/gutenberg/components/remove-button/index.js

Block Animations, Motion &amp; Scroll Effects – Ghost Kit, version 3.7.2. 69 lines.

- Page: https://pluginprobe.com/plugins/ghostkit/3.7.2/code/gutenberg/components/remove-button/index.js
- Raw: https://pluginprobe.com/plugins/ghostkit/3.7.2/raw/gutenberg/components/remove-button/index.js
- Modified: 2024-02-18T18:40:24+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/ghostkit/3.7.2/code/gutenberg/components/remove-button/index.js#L10-L20`.

```javascript
import { Button, Popover } from '@wordpress/components';
import { useState } from '@wordpress/element';
import { __ } from '@wordpress/i18n';

import getIcon from '../../utils/get-icon';

/**
 * Component Class
 *
 * @param props
 */
export default function RemoveButton(props) {
	const [confirmed, setConfirmed] = useState(-1);

	const {
		onRemove,
		show,
		style,
		tooltipText = __('Remove Block?', 'ghostkit'),
		tooltipRemoveText = __('Remove', 'ghostkit'),
		tooltipCancelText = __('Cancel', 'ghostkit'),
	} = props;

	if (!show) {
		return null;
	}

	return (
		<Button
			className="ghostkit-component-remove-button"
			onClick={() => {
				if (confirmed === -1) {
					setConfirmed(0);
				}
			}}
			style={style}
		>
			{confirmed === 0 ? (
				<Popover
					className="ghostkit-component-remove-button-confirm"
					onClose={() => {
						setConfirmed(-1);
					}}
					onFocusOutside={() => {
						setConfirmed(-1);
					}}
				>
					{tooltipText}
					<Button
						className="ghostkit-component-remove-button-confirm-yep"
						onClick={onRemove}
					>
						{tooltipRemoveText}
					</Button>
					<Button
						className="ghostkit-component-remove-button-confirm-nope"
						onClick={() => {
							setConfirmed(-1);
						}}
					>
						{tooltipCancelText}
					</Button>
				</Popover>
			) : null}
			{getIcon('icon-trash')}
		</Button>
	);
}

```
