Whole page working

This commit is contained in:
Maxime Lalo 2023-04-19 16:05:43 +02:00
parent 961c7709a8
commit ccd4efa090
3 changed files with 56 additions and 29 deletions

View File

@ -6,8 +6,8 @@ import Typography, { ITypo, ITypoColor } from "../Typography";
import classes from "./classes.module.scss"; import classes from "./classes.module.scss";
type IProps = { type IProps = {
name?: string;
option: IOption; option: IOption;
name: string;
toolTip?: string; toolTip?: string;
}; };
@ -20,7 +20,11 @@ export default class CheckBox extends React.Component<IProps> {
return ( return (
<Typography typo={ITypo.P_ERR_16} color={ITypoColor.BLACK}> <Typography typo={ITypo.P_ERR_16} color={ITypoColor.BLACK}>
<label className={classes["root"]}> <label className={classes["root"]}>
<input type="checkbox" name={this.props.name} value={this.props.option.value as string} /> <input
type="checkbox"
name={this.props.name ?? (this.props.option.value as string)}
value={this.props.option.value as string}
/>
{this.props.option.label} {this.props.option.label}
{this.props.toolTip && <Tooltip className={classes["tooltip"]} text={this.props.toolTip} />} {this.props.toolTip && <Tooltip className={classes["tooltip"]} text={this.props.toolTip} />}
</label> </label>

View File

@ -7,9 +7,6 @@
.form-container { .form-container {
margin-top: 16px; margin-top: 16px;
display: flex;
flex-direction: column;
gap: 24px;
.checkbox-container { .checkbox-container {
margin-top: 32px; margin-top: 32px;
@ -17,6 +14,16 @@
grid-template-columns: repeat(2, 1fr); grid-template-columns: repeat(2, 1fr);
gap: 24px; gap: 24px;
} }
.buttons-container {
display: flex;
gap: 32px;
margin-top: 32px;
}
}
.add-document-container {
margin-top: 32px;
} }
.buttons-container { .buttons-container {

View File

@ -1,4 +1,5 @@
import Button from "@Front/Components/DesignSystem/Button"; import PlusIcon from "@Assets/Icons/plus.svg";
import Button, { EButtonVariant } from "@Front/Components/DesignSystem/Button";
import CheckBox from "@Front/Components/DesignSystem/CheckBox"; import CheckBox from "@Front/Components/DesignSystem/CheckBox";
import Form, { IApiFormErrors } from "@Front/Components/DesignSystem/Form"; import Form, { IApiFormErrors } from "@Front/Components/DesignSystem/Form";
import Confirm from "@Front/Components/DesignSystem/Modal/Confirm"; import Confirm from "@Front/Components/DesignSystem/Modal/Confirm";
@ -42,17 +43,15 @@ export default class AskDocuments extends BasePage<IProps, IState> {
super(props); super(props);
this.state = { this.state = {
actType: { actType: null,
label: "Divorce", isCreateDocumentModalVisible: false,
value: "divorce",
},
isCreateDocumentModalVisible: true,
}; };
this.onActTypeChange = this.onActTypeChange.bind(this); this.onActTypeChange = this.onActTypeChange.bind(this);
this.onFormSubmit = this.onFormSubmit.bind(this); this.onFormSubmit = this.onFormSubmit.bind(this);
this.closeModal = this.closeModal.bind(this); this.closeModal = this.closeModal.bind(this);
this.openModal = this.openModal.bind(this); this.openModal = this.openModal.bind(this);
this.cancel = this.cancel.bind(this);
} }
public override render(): JSX.Element { public override render(): JSX.Element {
@ -69,22 +68,36 @@ export default class AskDocuments extends BasePage<IProps, IState> {
<Select options={this.actsOptions} placeholder={"Type dacte"} onChange={this.onActTypeChange} /> <Select options={this.actsOptions} placeholder={"Type dacte"} onChange={this.onActTypeChange} />
)} )}
{this.state.actType && ( {this.state.actType && (
<>
<div className={classes["checkbox-container"]}> <div className={classes["checkbox-container"]}>
{this.documentsType.map((documentType) => ( {this.documentsType.map((documentType) => (
<CheckBox <CheckBox
name="document_type"
toolTip="Checkbox with tooltip" toolTip="Checkbox with tooltip"
option={documentType} option={documentType}
key={documentType.value as string} key={documentType.value as string}
/> />
))} ))}
</div> </div>
<div className={classes["add-document-container"]}>
<Button
icon={PlusIcon}
iconposition={"right"}
iconstyle={{ transform: "rotate(180deg)", width: "22px", height: "22px" }}
variant={EButtonVariant.LINE}
onClick={this.openModal}>
Ajouter un document
</Button>
</div>
<div className={classes["buttons-container"]}>
<Button variant={EButtonVariant.GHOST} onClick={this.cancel}>
Annuler
</Button>
<Button type="submit">Valider</Button>
</div>
</>
)} )}
</div> </div>
</Form> </Form>
<Button type="submit" onClick={this.openModal}>
Open modal
</Button>
<Confirm <Confirm
isOpen={this.state.isCreateDocumentModalVisible} isOpen={this.state.isCreateDocumentModalVisible}
onClose={this.closeModal} onClose={this.closeModal}
@ -100,11 +113,12 @@ export default class AskDocuments extends BasePage<IProps, IState> {
); );
} }
override componentDidMount(): void { private cancel() {
setTimeout(() => { this.setState({
debugger; actType: null,
}, 3000); });
} }
private openModal() { private openModal() {
this.setState({ this.setState({
isCreateDocumentModalVisible: true, isCreateDocumentModalVisible: true,
@ -129,5 +143,7 @@ export default class AskDocuments extends BasePage<IProps, IState> {
[key: string]: string; [key: string]: string;
}, },
onApiErrors: (apiFormErrors: IApiFormErrors | null) => void, onApiErrors: (apiFormErrors: IApiFormErrors | null) => void,
) {} ) {
console.log(values);
}
} }