mirror of
https://github.com/pawelmalak/flame.git
synced 2026-03-10 22:43:11 +08:00
Components: refactored UI components to use new state. Minor changes to exports and props
This commit is contained in:
@@ -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>;
|
||||
};
|
||||
|
||||
@@ -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;
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user