verdaccio-ui/src/muiComponents/Heading/Heading.tsx
Priscila Oliveira a8deeb9b9d fix: typography Component - Introduced ForwardRef (#179)
* refactor: introduced forwardref

* refacttor: updated ref's

* fix: fixed func's name

* fix: fixed snapshots

* fix: updated snap
2019-10-12 21:41:42 +02:00

20 lines
528 B
TypeScript

import React, { forwardRef } from 'react';
import { default as MaterialUITypography, TypographyProps } from '@material-ui/core/Typography';
type HeadingType = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
type HeadingRef = HeadingType;
interface Props extends Omit<TypographyProps, 'variant'> {
variant?: HeadingType;
}
const Heading = forwardRef<HeadingRef, Props>(function Heading(props, ref) {
return <MaterialUITypography {...props} ref={ref} />;
});
Heading.defaultProps = {
variant: 'h6',
};
export default Heading;