From b312a9cdd3c24b06a1e72dcaa923e267d805ffa7 Mon Sep 17 00:00:00 2001 From: processing Date: Sat, 15 Jul 2023 15:11:53 +0100 Subject: [PATCH] Use style with status chips. --- .../Manage/CompanyOffersManagementWidget.js | 1 - .../Offers/Manage/CompanyOffersTitle.js | 35 ++++++++++++------- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/src/components/Company/Offers/Manage/CompanyOffersManagementWidget.js b/src/components/Company/Offers/Manage/CompanyOffersManagementWidget.js index 5eccbeb1..530e9725 100644 --- a/src/components/Company/Offers/Manage/CompanyOffersManagementWidget.js +++ b/src/components/Company/Offers/Manage/CompanyOffersManagementWidget.js @@ -27,7 +27,6 @@ const generateRow = ({ ), align: "left", linkDestination: `/offer/${_id}` }, publishStartDate: { value: format(parseISO(publishDate), "yyyy-MM-dd") }, diff --git a/src/components/Company/Offers/Manage/CompanyOffersTitle.js b/src/components/Company/Offers/Manage/CompanyOffersTitle.js index f5c34398..c592f484 100644 --- a/src/components/Company/Offers/Manage/CompanyOffersTitle.js +++ b/src/components/Company/Offers/Manage/CompanyOffersTitle.js @@ -2,19 +2,25 @@ import React, { useEffect, useState } from "react"; import PropTypes from "prop-types"; import { Chip, makeStyles } from "@material-ui/core"; -const statusChips = { - hidden: , - blocked: , - archived: , -}; - const useStyles = makeStyles(() => ({ + hiddenChip: { + backgroundColor: "#90A4AE", + marginRight: "5px", + }, + blockedChip: { + backgroundColor: "#DC4338", + marginRight: "5px", + }, + archivedChip: { + backgroundColor: "#56A8D6", + marginRight: "5px", + }, chips: { position: "absolute", }, })); -const OfferTitle = ({ title, getOfferVisibility, setOfferVisibility, offerId }) => { +const OfferTitle = ({ title, getOfferVisibility, offerId }) => { const [chips, setChips] = useState([]); const isHidden = getOfferVisibility(offerId)?.isHidden; const isBlocked = getOfferVisibility(offerId)?.isDisabled; @@ -23,15 +29,21 @@ const OfferTitle = ({ title, getOfferVisibility, setOfferVisibility, offerId }) const classes = useStyles(); useEffect(() => { + const statusChips = { + hidden: , + blocked: , + archived: , + }; + const tempChips = []; if (isHidden) - tempChips.push(statusChips.hidden,  ); + tempChips.push(statusChips.hidden); if (isBlocked) - tempChips.push(statusChips.blocked,  ); + tempChips.push(statusChips.blocked); if (isArchived) - tempChips.push(statusChips.archived,  ); + tempChips.push(statusChips.archived); setChips(tempChips); - }, [isArchived, isBlocked, isHidden, setOfferVisibility]); + }, [classes, isArchived, isBlocked, isHidden]); return ( <> @@ -46,7 +58,6 @@ const OfferTitle = ({ title, getOfferVisibility, setOfferVisibility, offerId }) OfferTitle.propTypes = { title: PropTypes.string.isRequired, getOfferVisibility: PropTypes.func.isRequired, - setOfferVisibility: PropTypes.func.isRequired, offerId: PropTypes.number.isRequired, };