@amsterdam/design-system-react
Version:
All React components from the Amsterdam Design System. Use it to compose pages in your website or application.
22 lines (21 loc) • 661 B
JavaScript
import { jsxs as _jsxs } from "react/jsx-runtime";
/**
* @license EUPL-1.2+
* Copyright Gemeente Amsterdam
*/
import clsx from 'clsx';
import { forwardRef } from 'react';
const getHintText = ({ hint, optional }) => {
if (hint) {
return hint;
}
else if (optional) {
return 'niet verplicht';
}
return null;
};
export const Hint = forwardRef(({ className, hint, optional, ...restProps }, ref) => {
const hintText = getHintText({ hint, optional });
return (hintText && (_jsxs("span", { ...restProps, className: clsx('ams-hint', className), ref: ref, children: ["(", hintText, ")"] })));
});
Hint.displayName = 'Hint';