Skip to content

Commit

Permalink
added state in TweetsPage
Browse files Browse the repository at this point in the history
  • Loading branch information
olesya-aldoshyna-0885 committed Nov 12, 2023
1 parent 10308a8 commit 8f8ab9b
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/components/Tweet/Tweet.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Avatar from '../Avatar/Avatar';
import Button from '../Button/Button';
import { CardContainer, CardImage, Line, Logo } from './Tweet.styled';

const Tweet = ({ imageURL }) => {
const Tweet = ({ imageURL, folowers, tweets, id }) => {
const [isActive, setIsActive] = useState(false);
const [isLoading, setIsLoading] = useState(true);

Expand Down
24 changes: 24 additions & 0 deletions src/components/UserList/UserList.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import Tweet from 'components/Tweet/Tweet';
import { GridContainer } from './UserList.syled';

const UserList = ({ users }) => {
return (
<>
<GridContainer>
{users.map(({ avatar, folowers, tweets, id }) => {
return (
<Tweet
imageURL={avatar}
folowers={folowers}
tweets={tweets}
id={id}
key={id}
/>
);
})}
</GridContainer>
</>
);
};

export default UserList;
8 changes: 8 additions & 0 deletions src/components/UserList/UserList.syled.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import styled from "@emotion/styled";

export const GridContainer = styled.ul`
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-gap: 20px;
list-style: none;
`;
15 changes: 14 additions & 1 deletion src/pages/TweetsPage.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
const TweetsPage = params => {};
import UserList from 'components/UserList/UserList';
import { useState } from 'react';

const TweetsPage = () => {
const [users, setUsers] = useState([]);
const [page, setPage] = useState(1);
const [isLoading, setIsLoading] = useState(false);

return (
<>
<UserList users={users} />
</>
);
};

export default TweetsPage;

0 comments on commit 8f8ab9b

Please sign in to comment.