| 1 |
import { Button } from '@wordpress/components'; |
| 2 |
import { __ } from '@wordpress/i18n'; |
| 3 |
|
| 4 |
import getIcon from '../../utils/get-icon'; |
| 5 |
import ActiveIndicator from '../active-indicator'; |
| 6 |
|
| 7 |
/** |
| 8 |
* Component Class |
| 9 |
* |
| 10 |
* @param props |
| 11 |
*/ |
| 12 |
export default function ElementStateToggle(props) { |
| 13 |
const { |
| 14 |
isHover, |
| 15 |
onChange, |
| 16 |
checkActive = () => { |
| 17 |
return false; |
| 18 |
}, |
| 19 |
} = props; |
| 20 |
|
| 21 |
return ( |
| 22 |
<Button |
| 23 |
className="ghostkit-control-element-state-toggle" |
| 24 |
onClick={() => { |
| 25 |
onChange(!isHover); |
| 26 |
}} |
| 27 |
> |
| 28 |
{getIcon('icon-pointer')} |
| 29 |
{checkActive() && <ActiveIndicator />} |
| 30 |
{isHover && <span>{__(':hover', 'ghostkit')}</span>} |
| 31 |
</Button> |
| 32 |
); |
| 33 |
} |
| 34 |
|