Просмотр исходного кода

Working on code cleanup

bugfix/520
jovan.cirkovic 3 лет назад
Родитель
Сommit
125da167c0

+ 22
- 0
src/components/Cards/CreateOfferCard/CloseButton/CloseButton.js Просмотреть файл

import React from "react";
import PropTypes from "prop-types";
import { CloseIcon } from "./CloseButton.styled";
import { ReactComponent as CloseButtonIcon } from "../../../../assets/images/svg/close-modal.svg";

const CloseButton = (props) => {
const closeModalHandler = () => {
props.closeCreateOfferModal(false);
};

return (
<CloseIcon onClick={closeModalHandler}>
<CloseButtonIcon />
</CloseIcon>
);
};

CloseButton.propTypes = {
closeCreateOfferModal: PropTypes.func,
};

export default CloseButton;

+ 16
- 0
src/components/Cards/CreateOfferCard/CloseButton/CloseButton.styled.js Просмотреть файл

import styled from "styled-components";
import { Box } from "@mui/system";

export const CloseIcon = styled(Box)`
cursor: pointer;
position: absolute;
right: 40px;

@media screen and (max-width: 600px) {
right: 20px;

& svg {
width: 20px;
}
}
`;

+ 16
- 10
src/components/Cards/CreateOfferCard/CreateOffer.js Просмотреть файл

ModalCreateOfferContainer, ModalCreateOfferContainer,
ModalHeader, ModalHeader,
BackIcon, BackIcon,
CloseIcon,
// CloseIcon,
} from "./CreateOffer.styled"; } from "./CreateOffer.styled";
import StepProgress from "../../StepProgress/StepProgress"; import StepProgress from "../../StepProgress/StepProgress";
import FirstPartCreateOffer from "./FirstPart/FirstPartCreateOffer"; import FirstPartCreateOffer from "./FirstPart/FirstPartCreateOffer";
} from "../../../store/actions/offers/offersActions"; } from "../../../store/actions/offers/offersActions";
import { editOneOffer } from "../../../store/actions/offers/offersActions"; import { editOneOffer } from "../../../store/actions/offers/offersActions";
import { ReactComponent as ArrowBack } from "../../../assets/images/svg/arrow-back.svg"; import { ReactComponent as ArrowBack } from "../../../assets/images/svg/arrow-back.svg";
import { ReactComponent as CloseButton } from "../../../assets/images/svg/close-modal.svg";
// import { ReactComponent as CloseButton } from "../../../assets/images/svg/close-modal.svg";
import { useTranslation } from "react-i18next";
import BackdropComponent from "../../MUI/BackdropComponent"; import BackdropComponent from "../../MUI/BackdropComponent";
import CloseButton from "./CloseButton/CloseButton";


const CreateOffer = ({ history, closeCreateOfferModal, editOffer, offer }) => { const CreateOffer = ({ history, closeCreateOfferModal, editOffer, offer }) => {
const dispatch = useDispatch(); const dispatch = useDispatch();
const [currentStep, setCurrentStep] = useState(1); const [currentStep, setCurrentStep] = useState(1);
const categories = useSelector((state) => state.categories.categories); const categories = useSelector((state) => state.categories.categories);
const historyRouter = useHistory(); const historyRouter = useHistory();
const { t } = useTranslation();


const handleApiResponseSuccess = () => { const handleApiResponseSuccess = () => {
if (editOffer === undefined) { if (editOffer === undefined) {
setCurrentStep((prevState) => prevState - 1); setCurrentStep((prevState) => prevState - 1);
}; };


const closeModalHandler = () => {
closeCreateOfferModal(false);
};
// const closeModalHandler = () => {
// closeCreateOfferModal(false);
// };


const goStepBack = (stepNumber) => { const goStepBack = (stepNumber) => {
setCurrentStep(stepNumber); setCurrentStep(stepNumber);
<> <>
<BackdropComponent <BackdropComponent
isLoading isLoading
handleClose={closeModalHandler}
handleClose={closeCreateOfferModal}
position="fixed" position="fixed"
/> />
<ModalCreateOfferContainer currentStep={currentStep}> <ModalCreateOfferContainer currentStep={currentStep}>
</BackIcon> </BackIcon>
<CreateOfferTitle component="h1" variant="h5"> <CreateOfferTitle component="h1" variant="h5">
{currentStep === 3 {currentStep === 3
? "Pregled"
? `${t("offer.review")}`
: `${ : `${
editOffer !== undefined ? "Izmena Objave" : "Nova Objava"
editOffer !== undefined
? `${t("offer.changeOffer")}`
: `${t("offer.newOffer")}`
}`} }`}
</CreateOfferTitle> </CreateOfferTitle>
<CloseIcon onClick={closeModalHandler}>
<CloseButton closeCreateOfferModal={closeCreateOfferModal} />
{/* <CloseIcon onClick={closeModalHandler}>
<CloseButton /> <CloseButton />
</CloseIcon>
</CloseIcon> */}
</ModalHeader> </ModalHeader>


<StepProgress <StepProgress

+ 15
- 16
src/components/Cards/CreateOfferCard/CreateOffer.styled.js Просмотреть файл

export const ModalCreateOfferContainer = styled(Box)` export const ModalCreateOfferContainer = styled(Box)`
background-color: #fff; background-color: #fff;
position: fixed; position: fixed;
${props => props.currentStep === 3 && `overflow-y: auto;`}
${(props) => props.currentStep === 3 && `overflow-y: auto;`}
max-height: 90vh; max-height: 90vh;
top: ${(props) => top: ${(props) =>
props.currentStep === 1 ? "calc(50% - 400px);" : "calc(50% - 350px);"}; props.currentStep === 1 ? "calc(50% - 400px);" : "calc(50% - 350px);"};
scrollbar-color: #ddd; scrollbar-color: #ddd;


@media (max-height: 820px) { @media (max-height: 820px) {
top: ${props => props.currentStep === 1 ? 'calc(50% - 340px)' : 'calc(50% - 340px)'};
top: ${(props) =>
props.currentStep === 1 ? "calc(50% - 340px)" : "calc(50% - 340px)"};
} }


@media screen and (max-width: 628px) { @media screen and (max-width: 628px) {
left: 0; left: 0;
padding: 0 30px; padding: 0 30px;
} }

`; `;


export const ModalHeader = styled(Box)` export const ModalHeader = styled(Box)`
} }
`; `;


export const CloseIcon = styled(Box)`
cursor: pointer;
position: absolute;
right: 40px;
// export const CloseIcon = styled(Box)`
// cursor: pointer;
// position: absolute;
// right: 40px;


@media screen and (max-width: 600px) {
right: 20px;
// @media screen and (max-width: 600px) {
// right: 20px;


& svg {
width: 20px;
}
}
`;
// & svg {
// width: 20px;
// }
// }
// `;


export const CreateOfferContainer = styled(Container)` export const CreateOfferContainer = styled(Container)`
margin-top: 0px; margin-top: 0px;
export const CreateOfferFormContainer = styled(Box)` export const CreateOfferFormContainer = styled(Box)`
width: 335px; width: 335px;
height: 700px; height: 700px;
${props => props.currentStep === 3 && `width: 120%; height: 420px;`}
${(props) => props.currentStep === 3 && `width: 120%; height: 420px;`}
`; `;
export const RegisterAltText = styled(Typography)` export const RegisterAltText = styled(Typography)`
font-family: "Poppins"; font-family: "Poppins";

+ 3
- 0
src/i18n/resources/rs.js Просмотреть файл

"Podržani formati fotografija: <strong>.JPG</strong> | <strong>.JPEG</strong> | <strong>.PNG</strong>", "Podržani formati fotografija: <strong>.JPG</strong> | <strong>.JPEG</strong> | <strong>.PNG</strong>",
continue: "NASTAVI", continue: "NASTAVI",
publish: "OBJAVI", publish: "OBJAVI",
review: "Pregled",
changeOffer: "Izmena Objave",
newOffer: "Nova Objava",
}, },
apiErrors: { apiErrors: {
somethingWentWrong: "Greska sa serverom!", somethingWentWrong: "Greska sa serverom!",

Загрузка…
Отмена
Сохранить