import * as React from 'react';
import clsx from 'classnames';
import { ActionButtonContext } from '../context';
const RecordIcon = ({ isRecording }) => {
    const context = React.useContext(ActionButtonContext);
    const prefixCls = (context === null || context === void 0 ? void 0 : context.prefixCls) || 'cn-sender-actions-btn';
    return (React.createElement("div", { className: `${prefixCls}-record-icon` },
        React.createElement("img", { src: isRecording
                ? 'https://img.alicdn.com/imgextra/i3/O1CN01ElNnVC1moyAYYBdrJ_!!6000000005002-55-tps-16-16.svg'
                : 'https://img.alicdn.com/imgextra/i4/O1CN01f26w1Z1Wh9YdajZBl_!!6000000002819-55-tps-16-16.svg', alt: "record" })));
};
function RecordButton(props, ref) {
    const { className, style, disabled, isRecording = false, onRecordClick, ...restProps } = props;
    const context = React.useContext(ActionButtonContext);
    const prefixCls = (context === null || context === void 0 ? void 0 : context.prefixCls) || 'cn-sender-actions-btn';
    return (React.createElement("button", { type: "button", ...restProps, ref: ref, onClick: (e) => {
            e.stopPropagation();
            if (!disabled) {
                onRecordClick === null || onRecordClick === void 0 ? void 0 : onRecordClick();
            }
        }, disabled: disabled, className: clsx(`${prefixCls}-record`, className), style: style },
        React.createElement(RecordIcon, { isRecording: isRecording })));
}
export default React.forwardRef(RecordButton);
