Components: refactored UI components to use new state. Minor changes to exports and props

This commit is contained in:
Paweł Malak
2021-11-09 13:46:07 +01:00
parent adc017c48d
commit 89d935e27f
16 changed files with 118 additions and 146 deletions

View File

@@ -1,15 +1,10 @@
import { ReactNode } from 'react';
import classes from './InputGroup.module.css';
interface ComponentProps {
children: JSX.Element | JSX.Element[];
interface Props {
children: ReactNode;
}
const InputGroup = (props: ComponentProps): JSX.Element => {
return (
<div className={classes.InputGroup}>
{props.children}
</div>
)
}
export default InputGroup;
export const InputGroup = (props: Props): JSX.Element => {
return <div className={classes.InputGroup}>{props.children}</div>;
};

View File

@@ -1,31 +1,27 @@
import { SyntheticEvent } from 'react';
import { ReactNode, SyntheticEvent } from 'react';
import classes from './ModalForm.module.css';
import Icon from '../../Icons/Icon/Icon';
import { Icon } from '../..';
interface ComponentProps {
children: JSX.Element | JSX.Element[];
children: ReactNode;
modalHandler?: () => void;
formHandler: (e: SyntheticEvent<HTMLFormElement>) => void;
}
const ModalForm = (props: ComponentProps): JSX.Element => {
export const ModalForm = (props: ComponentProps): JSX.Element => {
const _modalHandler = (): void => {
if (props.modalHandler) {
props.modalHandler();
}
}
};
return (
<div className={classes.ModalForm}>
<div className={classes.ModalFormIcon} onClick={_modalHandler}>
<Icon icon='mdiClose' />
<Icon icon="mdiClose" />
</div>
<form onSubmit={(e) => props.formHandler(e)}>
{props.children}
</form>
<form onSubmit={(e) => props.formHandler(e)}>{props.children}</form>
</div>
)
}
export default ModalForm;
);
};