Sfoglia il codice sorgente

Finished profile on tablet

feature/589
jovan.cirkovic 3 anni fa
parent
commit
ba34b15bf1

+ 2
- 2
src/components/Cards/OfferCard/OfferCard.styled.js Vedi File

@media screen and (max-width: 600px) { @media screen and (max-width: 600px) {
display: block; display: block;
position: absolute; position: absolute;
left: 59px;
top: 325px; top: 325px;
left: 18px;
} }
`; `;
export const RemoveIcon = styled(Remove)``; export const RemoveIcon = styled(Remove)``;
@media screen and (max-width: 600px) { @media screen and (max-width: 600px) {
position: absolute; position: absolute;
display: block; display: block;
left: 59px;
top: 325px; top: 325px;
left: 18px;
} }
`; `;
export const EditIcon = styled(Edit)``; export const EditIcon = styled(Edit)``;

+ 43
- 0
src/components/Profile/Header/Header.js Vedi File

import React from "react";
import PropTypes from "prop-types";
import { useHistory } from "react-router-dom";
import { HeaderContainer, HeaderText, ButtonContainer } from "./Header.styled";
import { ArrowButton } from "../../Buttons/ArrowButton/ArrowButton";
import { useTranslation } from "react-i18next";
import { HOME_PAGE } from "../../../constants/pages";

const Header = (props) => {
const history = useHistory();
const { t } = useTranslation();

const handleBackButton = () => {
history.push(HOME_PAGE);
};

return (
<HeaderContainer
onClick={handleBackButton}
component="header"
className={props.className}
>
<ButtonContainer>
<ArrowButton side={"left"}></ArrowButton>
<HeaderText>{t("profile.backToHome")}</HeaderText>
</ButtonContainer>
</HeaderContainer>
);
};

Header.propTypes = {
children: PropTypes.node,
setIsGrid: PropTypes.func,
isGrid: PropTypes.bool,
filters: PropTypes.array,
category: PropTypes.string,
className: PropTypes.string,
};
Header.defaultProps = {
isGrid: false,
};

export default Header;

+ 26
- 0
src/components/Profile/Header/Header.styled.js Vedi File

import { Box, Link, Typography } from "@mui/material";
import styled from "styled-components";
import selectedTheme from "../../../themes";

export const HeaderContainer = styled(Box)`
margin-top: 20px;

@media (max-width: 600px) {
margin-top: 40px;
}
`;
export const ButtonContainer = styled(Link)`
width: fit-content;
cursor: pointer;
display: flex;
justify-content: start;
align-items: center;
gap: 12px;
`;
export const HeaderText = styled(Typography)`
font-family: "Open Sans";
line-height: 22px;
font-size: 16px;
color: ${selectedTheme.primaryPurple};
text-decoration: underline;
`;

+ 21
- 19
src/components/Profile/Profile.js Vedi File

import React, { useEffect, useMemo } from 'react'
import PropTypes from 'prop-types'
import { ProfileContainer } from './Profile.styled'
import ProfileCard from '../ProfileCard/ProfileCard'
import ProfileOffers from './ProfileOffers/ProfileOffers'
import { useDispatch, useSelector } from 'react-redux'
import { selectUserId } from '../../store/selectors/loginSelectors'
import { useRouteMatch } from 'react-router-dom'
import { fetchProfile } from '../../store/actions/profile/profileActions'
import { fetchProfileOffers } from '../../store/actions/offers/offersActions'
import React, { useEffect, useMemo } from "react";
import PropTypes from "prop-types";
import { ProfileContainer } from "./Profile.styled";
import ProfileCard from "../ProfileCard/ProfileCard";
import ProfileOffers from "./ProfileOffers/ProfileOffers";
import { useDispatch, useSelector } from "react-redux";
import { selectUserId } from "../../store/selectors/loginSelectors";
import { useRouteMatch } from "react-router-dom";
import { fetchProfile } from "../../store/actions/profile/profileActions";
import { fetchProfileOffers } from "../../store/actions/offers/offersActions";
import Header from "./Header/Header";


const Profile = () => { const Profile = () => {
const userId = useSelector(selectUserId); const userId = useSelector(selectUserId);
useEffect(() => { useEffect(() => {
if (idProfile?.length > 0) { if (idProfile?.length > 0) {
dispatch(fetchProfile(idProfile)); dispatch(fetchProfile(idProfile));
dispatch(fetchProfileOffers(idProfile))
dispatch(fetchProfileOffers(idProfile));
} }
}, [idProfile]); }, [idProfile]);
const isMyProfile = useMemo(() => { const isMyProfile = useMemo(() => {
return true; return true;
} }
return false; return false;
}, [userId, idProfile])
}, [userId, idProfile]);
return ( return (
<ProfileContainer> <ProfileContainer>
<ProfileCard isMyProfile={isMyProfile}/>
<ProfileOffers isMyProfile={isMyProfile}/>
<Header />
<ProfileCard isMyProfile={isMyProfile} />
<ProfileOffers isMyProfile={isMyProfile} />
</ProfileContainer> </ProfileContainer>
)
}
);
};


Profile.propTypes = { Profile.propTypes = {
children: PropTypes.node,
}
children: PropTypes.node,
};


export default Profile
export default Profile;

+ 9
- 2
src/components/Profile/ProfileOffers/ProfileOffers.styled.js Vedi File

import styled from "styled-components"; import styled from "styled-components";
import selectedTheme from "../../../themes"; import selectedTheme from "../../../themes";
import { ReactComponent as Search } from "../../../assets/images/svg/magnifying-glass.svg"; import { ReactComponent as Search } from "../../../assets/images/svg/magnifying-glass.svg";
import { ReactComponent as Refresh } from "../../../assets/images/svg/refresh.svg";
import { ReactComponent as Package } from "../../../assets/images/svg/package-gray.svg";
import { TextField } from "../../TextFields/TextField/TextField"; import { TextField } from "../../TextFields/TextField/TextField";
import { Icon } from "../../Icon/Icon"; import { Icon } from "../../Icon/Icon";
import Select from "../../Select/Select"; import Select from "../../Select/Select";
padding: 0 50px; padding: 0 50px;
margin-top: 34px; margin-top: 34px;
position: relative; position: relative;
@media (max-width: 1200px) {
padding: 0 36px 0 0;
}
@media (max-width: 600px) { @media (max-width: 600px) {
padding: 0; padding: 0;
} }
font-size: 12px; font-size: 12px;
} }
`; `;
export const OffersIcon = styled(Refresh)`
export const OffersIcon = styled(Package)`
width: 18px; width: 18px;
height: 18px; height: 18px;
& path { & path {
padding-left: 8px; padding-left: 8px;
} }


@media (max-width: 1200px) {
right: 36px;
}

@media (max-width: 650px) { @media (max-width: 650px) {
width: 144px; width: 144px;
height: 30px; height: 30px;

+ 4
- 0
src/components/ProfileCard/ProfileCard.styled.js Vedi File

box-sizing: border-box; box-sizing: border-box;
padding: 0 50px; padding: 0 50px;
margin-top: 34px; margin-top: 34px;

@media (max-width: 1200px) {
padding: 0 36px 0 0;
}
@media (max-width: 600px) { @media (max-width: 600px) {
padding: 0; padding: 0;
} }

+ 1
- 0
src/i18n/resources/rs.js Vedi File

mainText: "Objave nisu pronađene", mainText: "Objave nisu pronađene",
altText: "Nažalost nemate ni jednu objavu", altText: "Nažalost nemate ni jednu objavu",
}, },
backToHome: "Nazad na sve objave",
}, },
about: { about: {
header: { header: {

Loading…
Annulla
Salva