1
0
mirror of https://github.com/SomboChea/ui synced 2026-01-17 00:25:50 +07:00

fix: detailContainer Component - Replaced class by func. comp (#130)

* refactor: coverted class comp. into func.comp

* refactor: added forward ref comp.

* fix: fixed external link color

* fix: fixed typo

* refactor: applied feedbacks
This commit is contained in:
Priscila Oliveira
2019-10-03 18:17:04 +02:00
committed by Juan Picado @jotadeveloper
parent 28c982a7da
commit f84fd79c5b
30 changed files with 824 additions and 343 deletions

View File

@@ -0,0 +1,12 @@
import React, { forwardRef } from 'react';
import { default as MuiIconButton, IconButtonProps } from '@material-ui/core/IconButton';
type IconButtonRef = HTMLElementTagNameMap['button'];
/* eslint-disable verdaccio/jsx-spread */
// eslint-disable-next-line react/display-name
const IconButton = forwardRef<IconButtonRef, IconButtonProps>(function IconButton(props, ref) {
return <MuiIconButton {...props} ref={ref} />;
});
export default IconButton;

View File

@@ -0,0 +1 @@
export { default } from './IconButton';

View File

@@ -0,0 +1,15 @@
import React from 'react';
import { mount } from 'enzyme';
import TextField from './TextField';
describe('<TextField /> component', () => {
const props = {
name: 'test',
value: 'test',
};
test('should render the component in default state', () => {
const wrapper = mount(<TextField name={props.name} value={props.value} />);
expect(wrapper.html()).toMatchSnapshot();
});
});

View File

@@ -0,0 +1,22 @@
import React, { forwardRef } from 'react';
import { default as TextFieldMaterialUI, TextFieldProps } from '@material-ui/core/TextField';
// The default element type of MUI's TextField is 'div'
type TextFieldRef = HTMLElementTagNameMap['div'];
/* eslint-disable verdaccio/jsx-spread */
// eslint-disable-next-line react/display-name
const TextField = forwardRef<TextFieldRef, TextFieldProps>(function ToolTip({ InputProps, classes, ...props }, ref) {
return (
<TextFieldMaterialUI
{...props}
InputProps={{
...InputProps,
classes,
}}
innerRef={ref}
/>
);
});
export default TextField;

View File

@@ -0,0 +1,3 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`<TextField /> component should render the component in default state 1`] = `"<div class=\\"MuiFormControl-root MuiTextField-root\\"><div class=\\"MuiInputBase-root MuiInput-root MuiInput-underline MuiInputBase-formControl MuiInput-formControl\\"><input aria-invalid=\\"false\\" class=\\"MuiInputBase-input MuiInput-input\\" name=\\"test\\" type=\\"text\\" value=\\"test\\"></div></div>"`;

View File

@@ -0,0 +1 @@
export { default } from './TextField';

View File

@@ -0,0 +1,13 @@
import React, { forwardRef } from 'react';
import { default as MuiTooltip, TooltipProps } from '@material-ui/core/Tooltip';
// The default element type of MUI's Tooltip is 'div' and the change of this prop is not allowed
type TooltipRef = HTMLElementTagNameMap['div'];
/* eslint-disable verdaccio/jsx-spread */
// eslint-disable-next-line react/display-name
const Tooltip = forwardRef<TooltipRef, TooltipProps>(function ToolTip(props, ref) {
return <MuiTooltip {...props} innerRef={ref} />;
});
export default Tooltip;

View File

@@ -0,0 +1 @@
export { default } from './Tooltip';