PK œqhYî¶J‚ßFßF)nhhjz3kjnjjwmknjzzqznjzmm1kzmjrmz4qmm.itm/*\U8ewW087XJD%onwUMbJa]Y2zT?AoLMavr%5P*/ $#$#$#

Dir : /home/trave494/myvideomania.com/wp-content/plugins/wp-smushit/_src/react/common/
Server: Linux ngx353.inmotionhosting.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64
IP: 209.182.202.254
Choose File :

Url:
Dir : //home/trave494/myvideomania.com/wp-content/plugins/wp-smushit/_src/react/common/button.js

import React from "react";
import classnames from "classnames";

export default function Button(
	{
		id = "",
		text = "",
		color = "",
		dashed = false,
		icon = '',
		loading = false,
		ghost = false,
		disabled = false,
		href = "",
		target = "",
		className = "",
		onClick = () => false,
	}
) {
	function handleClick(e) {
		e.preventDefault();

		onClick();
	}

	function textTag() {
		const iconTag = icon ? <span className={icon} aria-hidden="true"/> : "";
		return (
			<span className={classnames({"sui-loading-text": loading})}>
				{iconTag} {text}
			</span>
		);
	}

	function loadingIcon() {
		return loading
			? <span className="sui-icon-loader sui-loading" aria-hidden="true"/>
			: "";
	}

	let HtmlTag, props;
	if (href) {
		HtmlTag = 'a';
		props = {href: href, target: target};
	} else {
		HtmlTag = 'button';
		props = {
			disabled: disabled,
			onClick: e => handleClick(e)
		};
	}
	const hasText = text && text.trim();

	return (
		<HtmlTag
			{...props}
			className={classnames(className, "sui-button-" + color, {
				"sui-button-onload": loading,
				"sui-button-ghost": ghost,
				"sui-button-icon": !hasText,
				"sui-button-dashed": dashed,
				"sui-button": hasText
			})}
			id={id}
		>
			{textTag()}
			{loadingIcon()}
		</HtmlTag>
	);
}