1
0
Fork 1
mirror of https://github.com/SomboChea/ui synced 2024-06-16 08:29:41 +07:00
verdaccio-ui/src/muiComponents/Text/Text.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

21 lines
623 B
TypeScript

import React, { forwardRef } from 'react';
import { default as MaterialUITypography, TypographyProps } from '@material-ui/core/Typography';
type TextType = 'subtitle1' | 'subtitle2' | 'body1' | 'body2';
type TextRef = keyof HTMLElementTagNameMap;
interface Props extends Omit<TypographyProps, 'variant'> {
variant?: TextType;
}
// The reference is already from type of the Component, so the any below is not a problem
const Text = forwardRef<TextRef, Props>(function Text(props, ref) {
return <MaterialUITypography {...props} ref={ref} />;
});
Text.defaultProps = {
variant: 'subtitle1',
};
export default Text;