UNPKG

@kadconsulting/dry

Version:
32 lines 1.73 kB
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; // // CLI Version 1.1.0 // Component Version 1.0.0 // External imports import { forwardRef, useState } from 'react'; import classnames from 'classnames'; import { Button, LoadingOverlay } from '../index'; // Utils // import * as Utils from "./HeadingSection.utils.js"; // Hooks // Styles import './HeadingSection.scss'; const HeadingSection = forwardRef(({ id, className, heading, supportingText, buttonInfo, logoImage, onClick, ...props }, ref) => { // ============= State ============= const [loading, setLoading] = useState(false); // ============= Variables ============= // ============= Use Effect ============= // ============= Handle Functions ============= const handleButtonClick = () => { setLoading(true); onClick && onClick(); }; // ============= Display Functions ============= // ============= Return ============= // TODO-p1: this is a anti pattern that needs to be updated if (loading) { return (_jsx(LoadingOverlay, { logo: { src: logoImage || '' }, isLoading: loading, componentName: 'Heading Section' })); } return (_jsxs("div", { id: id, ref: ref, className: classnames(className, 'dry-headingsection'), ...props, children: [_jsxs("div", { children: [_jsx("div", { className: 'headingSection__heading', children: heading || '' }), _jsx("div", { className: 'headingSection__supportingText', children: supportingText || '' })] }), buttonInfo && (_jsx("div", { className: 'headingSection__buttonWrapper', children: _jsx(Button, { text: buttonInfo.buttonText, onClick: handleButtonClick }) }))] })); }); export default HeadingSection; //# sourceMappingURL=HeadingSection.js.map