forked from manikandanraji/instaclone-frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
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
0b496cb
commit 3e29856
Showing
10 changed files
with
249 additions
and
70 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
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
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
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 |
---|---|---|
@@ -0,0 +1,84 @@ | ||
import React, { useState, useEffect } from "react"; | ||
import styled from "styled-components"; | ||
import Avatar from "../styles/Avatar"; | ||
import Follow from "./Follow"; | ||
import { getUsers } from "../services/api"; | ||
import Loader from "./Loader"; | ||
|
||
const Wrapper = styled.div` | ||
background: ${props => props.theme.white}; | ||
border: 1px solid ${props => props.theme.borderColor}; | ||
width: 600px; | ||
padding: 1rem; | ||
justify-self: center; | ||
.suggestion { | ||
display: flex; | ||
align-items: center; | ||
justify-content: space-between; | ||
margin-bottom: 1rem; | ||
} | ||
.user-info { | ||
display: flex; | ||
align-items: center; | ||
} | ||
button { | ||
font-size: 0.9rem; | ||
} | ||
@media screen and (max-width: 660px) { | ||
width: 500px; | ||
} | ||
@media screen and (max-width: 530px) { | ||
width: 450px; | ||
} | ||
@media screen and (max-width: 480px) { | ||
width: 380px; | ||
} | ||
@media screen and (max-width: 400px) { | ||
width: 340px; | ||
} | ||
`; | ||
|
||
const NoFeedSuggestions = () => { | ||
const [users, setUsers] = useState([]); | ||
const [loading, setLoading] = useState(true); | ||
|
||
useEffect(() => { | ||
getUsers().then(res => { | ||
setUsers(res.data.data); | ||
setLoading(false); | ||
}); | ||
}, []); | ||
|
||
if (loading) { | ||
return <Loader />; | ||
} | ||
|
||
return ( | ||
<div style={{ display: "flex", flexDirection: "column" }}> | ||
<h3 style={{ marginBottom: "0.7rem" }}>Suggestions for you</h3> | ||
<Wrapper> | ||
{users.map(user => ( | ||
<div key={user._id} className="suggestion"> | ||
<div className="user-info"> | ||
<Avatar src={user.avatar} alt="avatar" /> | ||
<div className="user-meta"> | ||
<h4>{user.username}</h4> | ||
<span className="secondary">{user.fullname}</span> | ||
</div> | ||
</div> | ||
<Follow isFollowing={user.isFollowing} userId={user._id} /> | ||
</div> | ||
))} | ||
</Wrapper> | ||
</div> | ||
); | ||
}; | ||
|
||
export default NoFeedSuggestions; |
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
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
Oops, something went wrong.