Ignore:
Timestamp:
02/14/22 01:41:41 (2 years ago)
Author:
Tasevski2 <39170279+Tasevski2@…>
Branches:
master
Children:
747e0ab
Parents:
e8b1076
Message:

Push before video

Location:
sources/client/src/components/admin/ParkingZones/ParkingZoneCard
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sources/client/src/components/admin/ParkingZones/ParkingZoneCard/index.js

    re8b1076 rbc20307  
    22
    33import {
    4   ParkingZoneWrapper,
    5   Container,
    6   ZoneName,
    7   InfoWrapper,
    8   Label,
    9   Value,
    10   ProgressBar,
    11   ProgressBarLabel,
     4    ParkingZoneWrapper,
     5    Container,
     6    ZoneName,
     7    InfoWrapper,
     8    Label,
     9    Value,
     10    ProgressBar,
     11    ProgressBarLabel,
    1212} from './styles';
    1313
     14import DropdownViewer from '../../../DropdownViewer';
     15
    1416const ParkingZoneCard = ({ info }) => {
    15   let history = useHistory();
     17    let history = useHistory();
     18    const takenDividedByTotal = info.takenSpaces / info.capacity;
    1619
    17   return (
    18     <ParkingZoneWrapper item xs={11} sm={6} md={3}>
    19       <Container onClick={() => history.push(`/zone/${info.id}`)}>
    20         <ZoneName>{info.zoneName}</ZoneName>
    21         <InfoWrapper>
    22           <Label>Одговорни лица:</Label>
    23           {info.responsiblePersons.slice(0, 1).map((person, index) => (
    24             <Value key={index}>{person}</Value>
    25           ))}
    26           {info.responsiblePersons.length > 1 ? <Value>...</Value> : null}
    27         </InfoWrapper>
    28         <InfoWrapper>
    29           <Label>Број на паркинг места:</Label>
    30           <Value>{info.parkingSpaces}</Value>
    31         </InfoWrapper>
    32         <ProgressBar
    33           percent={Math.floor(
    34             (info.takenParkingSpaces / info.parkingSpaces) * 100
    35           )}
    36           label={() => (
    37             <ProgressBarLabel>
    38               {info.takenParkingSpaces}/{info.parkingSpaces}
    39             </ProgressBarLabel>
    40           )}
    41         />
    42       </Container>
    43     </ParkingZoneWrapper>
    44   );
     20    return (
     21        <ParkingZoneWrapper item xs={11} sm={6} md={3}>
     22            <Container onClick={() => history.push(`/zone/${info.id}`)}>
     23                <ZoneName>{info.pzName}</ZoneName>
     24                <InfoWrapper>
     25                    <Label>Одговорни лица:</Label>
     26                    <DropdownViewer data={info?.responsibleWorkers ?? [] } />
     27                </InfoWrapper>
     28                <InfoWrapper style={{ marginTop: '30px' }}>
     29                    <Label>Број на паркинг места:</Label>
     30                    <Value>{info.capacity}</Value>
     31                </InfoWrapper>
     32                <ProgressBar
     33                    percent={Math.floor(
     34                        (isNaN(takenDividedByTotal) ? 0 : takenDividedByTotal) *
     35                            100
     36                    )}
     37                    label={() => (
     38                        <ProgressBarLabel>
     39                            {info.takenSpaces}/{info.capacity}
     40                        </ProgressBarLabel>
     41                    )}
     42                />
     43            </Container>
     44        </ParkingZoneWrapper>
     45    );
    4546};
    4647
  • sources/client/src/components/admin/ParkingZones/ParkingZoneCard/styles.js

    re8b1076 rbc20307  
    22import Grid from '@mui/material/Grid';
    33import { Typography } from '@mui/material';
    4 
    5 import { LineProgressBar } from '@frogress/line'
    6 
     4import { LineProgressBar } from '@frogress/line';
     5import { mobile_max_width } from '../../../../config/utilities';
    76
    87export const ParkingZoneWrapper = styled(Grid)`
    9     height: 350px;
     8  height: 350px;
     9
     10  @media (max-width: ${mobile_max_width}px) {
     11    padding-left: 15px !important;
     12    padding-right: 15px;
     13  }
    1014`;
    1115
    1216export const Container = styled.div`
    13     display: flex;
    14     flex-direction: column;
    15     align-items: center;
    16     width: 100%;
    17     height: 100%;
    18     box-shadow: 15px 15px 10px ${props => props.theme.palette.background.shadow};
    19     background-color: ${props => props.theme.palette.background.white};
    20     :hover {
    21         opacity: 0.8;
    22         cursor: pointer;
    23     }
    24     position: relative;
     17  display: flex;
     18  flex-direction: column;
     19  align-items: center;
     20  width: 100%;
     21  height: 100%;
     22  box-shadow: 15px 15px 10px ${(props) => props.theme.palette.background.shadow};
     23  background-color: ${(props) => props.theme.palette.background.white};
     24  :hover {
     25    opacity: 0.8;
     26    cursor: pointer;
     27  }
     28  position: relative;
    2529`;
    2630
    2731export const ZoneName = styled(Typography).attrs({
    28     variant: 'h2'
     32  variant: 'h2',
    2933})`
    30     font-size: 2rem;
    31     font-weight: 600;
    32     margin-top: 30px;
    33     text-align: center;
     34  font-size: 2rem;
     35  font-weight: 600;
     36  margin-top: 30px;
     37  text-align: center;
    3438`;
    3539
    3640export const InfoWrapper = styled.div`
    37     margin-top: 20px;
    38     display: flex;
    39     flex-direction: column;
    40     align-items: center;
    41 
     41  width: 100%;
     42  margin-top: 20px;
     43  display: flex;
     44  flex-direction: column;
     45  align-items: center;
    4246`;
    4347
    4448export const Label = styled(Typography).attrs({
    45     variant: 'h4'
     49  variant: 'h4',
    4650})`
    47     font-size: 1rem;
    48     margin-bottom: 5px;
     51  font-size: 1rem;
     52  margin-bottom: 5px;
    4953`;
    5054
    5155export const Value = styled(Typography).attrs({
    52     variant: 'h3'
     56  variant: 'h3',
    5357})`
    54     font-size: 1.25rem;
    55     font-weight: 600;
    56     margin-top: 5px;
     58  font-size: 1.25rem;
     59  font-weight: 600;
     60  margin-top: 5px;
    5761`;
    5862
    59 export const ProgressBar = styled(LineProgressBar).attrs(props => ({
    60     stripe: true,
    61     progressColor: props.theme.palette.primary.main,
    62     height: '30px',
     63export const ProgressBar = styled(LineProgressBar).attrs((props) => ({
     64  stripe: true,
     65  progressColor: props.theme.palette.primary.main,
     66  height: '30px',
    6367}))`
    64     position: absolute;
    65     bottom: 5px;
     68  position: absolute;
     69  bottom: 5px;
    6670`;
    6771
    6872export const ProgressBarLabel = styled.p`
    69     margin: 0 0 0 42.5%;
    70     line-height: 30px;
    71     position: absolute;
    72     font-weight: 500;
     73  margin: 0 0 0 42.5%;
     74  line-height: 30px;
     75  position: absolute;
     76  font-weight: 500;
    7377`;
Note: See TracChangeset for help on using the changeset viewer.