Fix MiniPhotos component to link to the current users profile if index > 0
This commit is contained in:
parent
eb70197adb
commit
52f8bcbff2
|
@ -15,7 +15,16 @@ const MiniPhotos = (props) => {
|
|||
|
||||
const NUMBER_OF_PHOTOS = 9;
|
||||
|
||||
const photosLink = `/fakebook/${user.lastname}.${user.firstname}/Photos`;
|
||||
/* ---------- FIX: build unique slug ----------------------------- */
|
||||
|
||||
const slugBase = `${user.lastname}.${user.firstname}`;
|
||||
|
||||
const userSlug =
|
||||
user.index && user.index > 0 ? `${slugBase}.${user.index}` : slugBase;
|
||||
|
||||
const photosLink = `/fakebook/${userSlug}/Photos`;
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
function handleClick() {
|
||||
handleClickLink(
|
||||
|
@ -29,7 +38,7 @@ const MiniPhotos = (props) => {
|
|||
<Card {...rest}>
|
||||
<Card.Body>
|
||||
<Card.Title>
|
||||
<Link to={photosLink} className="text-body" onClick={handleClick}>
|
||||
<Link to={photosLink} className='text-body' onClick={handleClick}>
|
||||
<b>Photos</b>
|
||||
</Link>
|
||||
</Card.Title>
|
||||
|
@ -41,24 +50,26 @@ const MiniPhotos = (props) => {
|
|||
<Col
|
||||
key={index}
|
||||
xs={4}
|
||||
className="m-0"
|
||||
className='m-0'
|
||||
style={{
|
||||
paddingLeft: "3px",
|
||||
paddingRight: "3px",
|
||||
paddingTop: "0",
|
||||
paddingBottom: "0",
|
||||
}}>
|
||||
}}
|
||||
>
|
||||
<Link
|
||||
to={`/fakebook/photo/${userID}/${index}`}
|
||||
className="text-body"
|
||||
className='text-body'
|
||||
onClick={handleClick}
|
||||
tabIndex="-1">
|
||||
tabIndex='-1'
|
||||
>
|
||||
<ResponsiveImage
|
||||
photo={photo}
|
||||
userID={userID}
|
||||
index={index}
|
||||
width="100%"
|
||||
height="100%"
|
||||
width='100%'
|
||||
height='100%'
|
||||
/>
|
||||
</Link>
|
||||
</Col>
|
||||
|
|
Loading…
Reference in New Issue