UNPKG

@engie-group/fluid-design-system-react

Version:

Fluid Design System React

15 lines (12 loc) 1.14 kB
import { jsx, jsxs } from 'react/jsx-runtime'; import React__default from 'react'; import { Utils } from '../../utils/util.js'; import { NJIconButton } from '../icon-button/NJIconButton.js'; const NJSidepanelHeader = React__default.forwardRef(({ title, className, children, onCloseIconClicked, closeIconLabel = 'Close', actions = [], ...htmlProps }, ref) => { const shouldDisplayActions = !!onCloseIconClicked || !!actions?.length; const titleContent = title ? (jsx("span", { className: "nj-sidepanel-header__title", children: title })) : (jsx("div", { className: "nj-sidepanel-header__custom-title", children: children })); const classes = Utils.classNames('nj-sidepanel-header', className); return (jsxs("div", { ref: ref, ...htmlProps, className: classes, children: [titleContent, shouldDisplayActions && (jsxs("div", { className: "nj-sidepanel-header__actions", children: [actions, onCloseIconClicked && (jsx(NJIconButton, { "aria-label": closeIconLabel, variant: "tertiary", icon: "close", onClick: onCloseIconClicked }))] }))] })); }); NJSidepanelHeader.displayName = 'NJSidepanelHeader'; export { NJSidepanelHeader };