From c508d0ec00b3ec8bf779e137b9262f9891a51c2c Mon Sep 17 00:00:00 2001 From: Lucas Schoenfelder <les17@inf.ufpr.br> Date: Thu, 18 Feb 2021 11:37:16 -0300 Subject: [PATCH] fixed links not working outside of homepage --- .../ResourcePageComponents/Sobre.js | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/Components/ResourcePageComponents/Sobre.js b/src/Components/ResourcePageComponents/Sobre.js index 7cf58bf7..0d262187 100644 --- a/src/Components/ResourcePageComponents/Sobre.js +++ b/src/Components/ResourcePageComponents/Sobre.js @@ -22,6 +22,7 @@ import styled from 'styled-components' import Grid from '@material-ui/core/Grid'; import {Link} from 'react-router-dom' import {NoIcon} from '../ContactButtons/FollowButton.js' +import {NoIconFollowing} from '../ContactButtons/FollowingButton.js' import Collapse from '@material-ui/core/Collapse'; import SdCardIcon from '@material-ui/icons/SdCard'; import TranslateIcon from '@material-ui/icons/Translate'; @@ -136,6 +137,9 @@ export default function Sobre (props) { let windowWidth = window.innerWidth + const [followed, setFollowed] = useState(props.followed) + const toggleFollowed = () => {setFollowed(!followed)} + return ( <Grid container style={{paddingRight : "15px", paddingLeft : "15px"}}> @@ -198,10 +202,19 @@ export default function Sobre (props) { <div style={{paddingTop : "0.75em", display : "flex", justifyContent : "center"}}> { (props.id !== state.currentUser.id) && - <> - <NoIcon followableID={props.id}/> - <ContactCardOptions followableID={props.id}/> - </> + followed ? ( + <> + <NoIconFollowing followableID={props.id} toggleFollowed={toggleFollowed}/> + <ContactCardOptions followableID={props.id}/> + </> + ) + : + ( + <> + <NoIcon followableID={props.id} toggleFollowed={toggleFollowed}/> + <ContactCardOptions followableID={props.id}/> + </> + ) } </div> </MetasObjeto> -- GitLab