Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
51 lines
1.3 KiB
Plaintext
51 lines
1.3 KiB
Plaintext
'use client';
|
|
|
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
import React from 'react';
|
|
import './index.scss';
|
|
const baseClass = 'popup-button';
|
|
export const PopupTrigger = props => {
|
|
const {
|
|
active,
|
|
button,
|
|
buttonType,
|
|
className,
|
|
disabled,
|
|
noBackground,
|
|
setActive,
|
|
size
|
|
} = props;
|
|
const classes = [baseClass, className, `${baseClass}--${buttonType}`, !noBackground && `${baseClass}--background`, size && `${baseClass}--size-${size}`, disabled && `${baseClass}--disabled`].filter(Boolean).join(' ');
|
|
const handleClick = () => {
|
|
setActive(!active, false);
|
|
};
|
|
const handleKeyDown = e => {
|
|
if (e.key === 'Enter' || e.key === ' ') {
|
|
e.preventDefault();
|
|
setActive(!active, true);
|
|
}
|
|
};
|
|
if (buttonType === 'none') {
|
|
return null;
|
|
}
|
|
if (buttonType === 'custom') {
|
|
return /*#__PURE__*/_jsx("div", {
|
|
className: classes,
|
|
onClick: handleClick,
|
|
onKeyDown: handleKeyDown,
|
|
role: "button",
|
|
tabIndex: 0,
|
|
children: button
|
|
});
|
|
}
|
|
return /*#__PURE__*/_jsx("button", {
|
|
className: classes,
|
|
disabled: disabled,
|
|
onClick: handleClick,
|
|
onKeyDown: handleKeyDown,
|
|
tabIndex: 0,
|
|
type: "button",
|
|
children: button
|
|
});
|
|
};
|
|
//# sourceMappingURL=index.js.map |