@engie-group/fluid-design-system-react
Version:
Fluid Design System React
20 lines (17 loc) • 820 B
JavaScript
import { jsx } from 'react/jsx-runtime';
import React__default from 'react';
import { Utils } from '../../utils/util.js';
const Component = ({ children, as, scale, isNotInvertible = false, variant, className, ...htmlProps }, ref) => {
const Wrapper = as ?? 'h1';
const classNames = Utils.classNames('nj-display', {
[`nj-display--${scale}`]: !!scale,
[`nj-display--${variant}`]: !!variant,
[`nj-display--not-invertible`]: isNotInvertible
}, className);
return (jsx(Wrapper, { ...htmlProps, ref: ref, className: classNames, children: children }));
};
/** Generic type with forwardRef
* (cf. https://stackoverflow.com/questions/58469229/react-with-typescript-generics-while-using-react-forwardref)
*/
const NJDisplay = React__default.forwardRef(Component);
export { NJDisplay };