import React from 'react';
import { Formatering } from './Formatering';

interface Props {
	tekst?: string;
	vedRef?: (event: any) => void;
	children?: React.ReactNode;
}

function Feilmelding(props: Props) {
	const { tekst, vedRef, children } = props;
	return tekst ? (
		<div
			className="plakat plakat-feilmelding"
			tabIndex={-1}
			ref={(e) => (vedRef ? vedRef(e) : undefined)}
		>
			<div className="advarsel-om-feil">
				<Formatering tekst={tekst} fullbredde />
				{children ? children : null}
			</div>
		</div>
	) : null;
}

export { Feilmelding };
