-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
72018a5
commit e2fb4a1
Showing
2 changed files
with
53 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,52 @@ | ||
import React from 'react' | ||
import styles from '../../styles/TravelerProfile.module.css' | ||
import btnStyles from '../../styles/Button.module.css' | ||
import { useCurrentUser } from '../../contexts/CurrentUserContext' | ||
import { Link } from 'react-router-dom' | ||
import Avatar from '../../components/Avatar' | ||
import React from "react"; | ||
import styles from "../../styles/TravelerProfile.module.css"; | ||
import btnStyles from "../../styles/Button.module.css"; | ||
import { useCurrentUser } from "../../contexts/CurrentUserContext"; | ||
import { Link } from "react-router-dom"; | ||
import Avatar from "../../components/Avatar"; | ||
import { Button } from "react-bootstrap"; | ||
|
||
const Traveler = (props) => { | ||
const {traveler, mobile, imageSize=55} = props | ||
const {id, following_id, image, owner} = traveler; | ||
const { traveler, mobile, imageSize = 55 } = props; | ||
const { id, following_id, image, owner } = traveler; | ||
|
||
const currentUser = useCurrentUser(); | ||
const is_owner = currentUser?.username === owner; | ||
const currentUser = useCurrentUser(); | ||
const is_owner = currentUser?.username === owner; | ||
|
||
return ( | ||
<div className={`my-3 d-flex align-items-center ${mobile && 'flex-column'}`}> | ||
<div> | ||
<Link className="align-self-center" to={`/travelers/${id}`}> | ||
<Avatar src={image} height={imageSize} /> | ||
</Link> | ||
</div> | ||
<div className={`mx-2 ${styles.WordBreak}`}> | ||
<strong>{owner}</strong> | ||
|
||
</div> | ||
<div | ||
className={`my-3 d-flex align-items-center ${mobile && "flex-column"}`} | ||
> | ||
<div> | ||
<Link className="align-self-center" to={`/travelers/${id}`}> | ||
<Avatar src={image} height={imageSize} /> | ||
</Link> | ||
</div> | ||
<div className={`mx-2 ${styles.WordBreak}`}> | ||
<strong>{owner}</strong> | ||
</div> | ||
<div className={`text-right ${!mobile && "ml-auto"}`}> | ||
{!mobile && | ||
currentUser && | ||
!is_owner && | ||
(following_id ? ( | ||
<Button | ||
className={`me-1 ${btnStyles.Button} ${btnStyles.Pink}`} | ||
onClick={() => {}} | ||
> | ||
unfollow | ||
</Button> | ||
) : ( | ||
<Button | ||
className={`me-1 btn-sm ${btnStyles.Button} ${btnStyles.PinkOutline}`} | ||
onClick={() => {}} | ||
> | ||
follow | ||
</Button> | ||
))} | ||
</div> | ||
</div> | ||
) | ||
} | ||
); | ||
}; | ||
|
||
export default Traveler | ||
export default Traveler; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters