Skip to content

Commit

Permalink
remove advanced settings collapsible
Browse files Browse the repository at this point in the history
  • Loading branch information
pedronunes19 committed Nov 27, 2023
1 parent 33eb94b commit 5a66c7f
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 70 deletions.
96 changes: 30 additions & 66 deletions src/components/Offers/Form/form-components/OfferForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ import {
Grid,
FormControl,
Typography,
Collapse,
Button,
} from "@material-ui/core";
import React, { useState, useCallback, useContext, useEffect } from "react";
import React, { useContext, useEffect } from "react";
import { Redirect } from "react-router-dom";
import PropTypes from "prop-types";
import MultiOptionTextField from "../../../utils/form/MultiOptionTextField";
Expand All @@ -27,10 +26,6 @@ import PublicationDateComponent from "./PublicationDateComponent";
import PublicationEndDateComponent from "./PublicationEndDateComponent";
import IsHiddenComponent from "./IsHiddenComponent";
import TextEditorComponent from "./TextEditorComponent";
import {
KeyboardArrowDown,
KeyboardArrowUp,
} from "@material-ui/icons";
import useOfferFormStyles from "./offerStyles";
import { Controller } from "react-hook-form";
import { useMobile } from "../../../../utils/media-queries";
Expand Down Expand Up @@ -85,22 +80,6 @@ const OfferForm = ({ context, title }) => {

const formDisabled = !isLoggedIn || companyUnfinishedRegistration;

const [isAdvancedOpen, setAdvancedOpen] = useState(false);

const shouldShowAdvancedOptions = useCallback(() => (
isAdvancedOpen ||
!!errors.publishDate || !!requestErrors.publishDate ||
!!errors.publishEndDate || !!requestErrors.publishEndDate ||
!!errors.isHidden
), [
errors.isHidden,
errors.publishDate,
errors.publishEndDate,
isAdvancedOpen,
requestErrors.publishDate,
requestErrors.publishEndDate,
]);

const Content = isMobile ? DialogContent : CardContent;
const classes = useOfferFormStyles(isMobile)();

Expand Down Expand Up @@ -271,57 +250,42 @@ const OfferForm = ({ context, title }) => {
/>
</Grid>
<Grid item xs={12} lg={12}>
<Button
onClick={() => setAdvancedOpen(!isAdvancedOpen)}
size="small"
margin="dense"
endIcon={
shouldShowAdvancedOptions()
? <KeyboardArrowUp />
: <KeyboardArrowDown />}
>
<Typography>Advanced Settings</Typography>
</Button>
</Grid>
<Grid item xs={12} lg={12}>
<Collapse in={shouldShowAdvancedOptions()}>
<Grid container spacing={4} className={classes.advancedSettingsCollapse}>
<Grid item xs={12} lg={6} className={classes.gridWithInfo}>
<PublicationDateComponent
disabled={formDisabled}
errors={errors}
requestErrors={requestErrors}
control={control}
datePickerProps={{
className: classes.advancedSettingsDatePicker,
}}
/>
</Grid>
<Grid container spacing={4}>
<Grid item xs={12} lg={6} className={classes.gridWithInfo}>
<PublicationDateComponent
disabled={formDisabled}
errors={errors}
requestErrors={requestErrors}
control={control}
datePickerProps={{
className: classes.publicationDatePicker,
}}
/>
</Grid>
<Grid item xs={12} lg={6} className={classes.gridWithInfo}>
<PublicationEndDateComponent
fields={fields}
disabled={formDisabled}
errors={errors}
requestErrors={requestErrors}
control={control}
datePickerProps={{
className: classes.publicationDatePicker,
}}
/>
</Grid>
{
showHiddenField &&
<Grid item xs={12} lg={6} className={classes.gridWithInfo}>
<PublicationEndDateComponent
fields={fields}
<IsHiddenComponent
disabled={formDisabled}
errors={errors}
requestErrors={requestErrors}
control={control}
datePickerProps={{
className: classes.advancedSettingsDatePicker,
}}
/>
</Grid>
{
showHiddenField &&
<Grid item xs={12} lg={6} className={classes.gridWithInfo}>
<IsHiddenComponent
disabled={formDisabled}
errors={errors}
requestErrors={requestErrors}
control={control}
/>
</Grid>
}
</Grid>
</Collapse>
}
</Grid>
</Grid>
<Grid item xs={12} className={classes.highlightOptionGrid}>
<ApplyURLComponent
Expand Down
5 changes: 1 addition & 4 deletions src/components/Offers/Form/form-components/offerStyles.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default (isMobile) => makeStyles((theme) => ({
autocompleteChipWrapper: {
minHeight: "40px",
},
advancedSettingsDatePicker: {
publicationDatePicker: {
width: "100%",
marginRight: theme.spacing(2),
},
Expand All @@ -56,9 +56,6 @@ export default (isMobile) => makeStyles((theme) => ({
vacanciesGrid: {
marginBottom: theme.spacing(5),
},
advancedSettingsCollapse: {
marginBottom: theme.spacing(4),
},
jobTypeGrid: {
marginBottom: theme.spacing(4),
},
Expand Down

0 comments on commit 5a66c7f

Please sign in to comment.