generated from goitacademy/react-homework-template
-
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
Showing
16 changed files
with
6,290 additions
and
212 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,13 +1,22 @@ | ||
import { Profile } from './Profile/Profile'; | ||
import user from '../data/user.json'; | ||
import { Layout } from './Layout'; | ||
import { GlobalStyle } from './Globalstyle'; | ||
import { Statistics } from './Statistics/Statistics'; | ||
import { Profile } from './Profile/Profile'; | ||
import { FriendList } from './FriendList/FriendList'; | ||
import stats from '../data/statistics.json'; | ||
import user from '../data/user.json'; | ||
import friends from '../data/friends.json'; | ||
import transactions from '../data/transactions.json'; | ||
import { TransactionsHistory } from './Transactions/TransactionsHistory'; | ||
|
||
export const App = () => { | ||
return ( | ||
<Layout> | ||
<GlobalStyle /> | ||
<Profile {...user} /> | ||
<Statistics title="Upload stats" items={stats} /> | ||
<FriendList friends={friends} /> | ||
<TransactionsHistory items={transactions} />; | ||
</Layout> | ||
); | ||
}; |
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,11 @@ | ||
import { Avatar, Name, Status } from './FriendItem.styled'; | ||
|
||
export const FriendItem = ({ avatar, name, isOnline }) => { | ||
return ( | ||
<> | ||
<Status $isonline={isOnline}></Status> | ||
<Avatar src={avatar} alt="User avatar" width="48" /> | ||
<Name>{name}</Name> | ||
</> | ||
); | ||
}; |
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,17 @@ | ||
import styled from 'styled-components'; | ||
|
||
export const Status = styled.span` | ||
width: 15px; | ||
height: 15px; | ||
background-color: ${({ $isonline }) => ($isonline ? 'green' : 'red')}; | ||
border-radius: 50%; | ||
`; | ||
|
||
export const Avatar = styled.img` | ||
width: 50px; | ||
`; | ||
|
||
export const Name = styled.p` | ||
font-size: 26px; | ||
font-weight: 700; | ||
`; |
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,18 @@ | ||
import { FriendItem } from './FriendItem/FriendItem'; | ||
import { FriendWrapper, FriendWrapperItem } from './FriendList.styled'; | ||
|
||
export const FriendList = ({ friends }) => { | ||
return ( | ||
<FriendWrapper> | ||
{friends.map(({ avatar, name, isOnline, id }) => ( | ||
<FriendWrapperItem key={id}> | ||
<FriendItem | ||
avatar={avatar} | ||
name={name} | ||
isOnline={isOnline} | ||
></FriendItem> | ||
</FriendWrapperItem> | ||
))} | ||
</FriendWrapper> | ||
); | ||
}; |
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,31 @@ | ||
import styled from 'styled-components'; | ||
|
||
export const FriendWrapper = styled.ul` | ||
display: flex; | ||
flex-direction: column; | ||
gap: 10px; | ||
`; | ||
|
||
export const FriendWrapperItem = styled.li` | ||
display: flex; | ||
align-items: center; | ||
gap: 15px; | ||
min-width: 250px; | ||
min-height: 50px; | ||
margin: 0 auto; | ||
padding: 20px; | ||
border: 1px solid lightskyblue; | ||
border-radius: 4px; | ||
box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.12); | ||
background-color: white; | ||
color: midnightblue; | ||
transition: transform var(--animation-duration) var(--timing-function), | ||
box-shadow var(--animation-duration) var(--timing-function); | ||
&:hover, | ||
:focus { | ||
box-shadow: 0px 1px 1px rgba(0, 0, 0, 0.12), 0px 4px 4px rgba(0, 0, 0, 0.06), | ||
1px 4px 6px rgba(0, 0, 0, 0.16); | ||
cursor: pointer; | ||
transform: scale(1.03); | ||
} | ||
`; |
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,25 @@ | ||
import { | ||
StatsItem, | ||
StatsLabel, | ||
StatsList, | ||
StatsSection, | ||
StatsValue, | ||
Title, | ||
} from './Statistics.styled'; | ||
|
||
export const Statistics = ({ title, items }) => { | ||
return ( | ||
<StatsSection> | ||
{title && <Title title={title}>{title}</Title>} | ||
{/* <Wave1></Wave1> */} | ||
<StatsList> | ||
{items.map(({ id, label, percentage }) => ( | ||
<StatsItem key={id} $count={items.length}> | ||
<StatsLabel>{label}</StatsLabel> | ||
<StatsValue>{percentage}%</StatsValue> | ||
</StatsItem> | ||
))} | ||
</StatsList> | ||
</StatsSection> | ||
); | ||
}; |
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,60 @@ | ||
import styled from 'styled-components'; | ||
import { Wave } from 'react-animated-text'; | ||
|
||
const StyledTitle = styled.h2` | ||
text-align: center; | ||
text-transform: uppercase; | ||
font-size: 30px; | ||
font-weight: 700; | ||
padding: 32px 0; | ||
color: midnightblue; | ||
`; | ||
|
||
export const Title = ({ title }) => ( | ||
<StyledTitle> | ||
<Wave text={`${title}`} effect="fadeOut" effectChange={1.0} /> | ||
</StyledTitle> | ||
); | ||
export const StatsSection = styled.section` | ||
margin: 60px auto; | ||
padding: 20px; | ||
border: 1px solid lightskyblue; | ||
border-radius: 4px; | ||
background-color: lightskyblue; | ||
width: 500px; | ||
`; | ||
|
||
export const StatsList = styled.ul` | ||
display: flex; | ||
gap: 15px; | ||
padding: 15px; | ||
background-color: white; | ||
border-radius: 4px; | ||
`; | ||
|
||
export const StatsItem = styled.li` | ||
text-align: center; | ||
flex-basis: ${({ $count }) => `calc(100% / ${$count})`}; | ||
background-color: ${getRandomHexColor}; | ||
border: 1px solid midnightblue; | ||
border-radius: 4px; | ||
`; | ||
|
||
export const StatsLabel = styled.p` | ||
margin-top: 18px; | ||
margin-bottom: 9px; | ||
font-size: 20px; | ||
font-weight: bold; | ||
color: midnightblue; | ||
`; | ||
|
||
export const StatsValue = styled.p` | ||
font-size: 18px; | ||
margin-bottom: 16px; | ||
font-weight: bold; | ||
color: midnightblue; | ||
`; | ||
|
||
function getRandomHexColor() { | ||
return `#${Math.floor(Math.random() * 16777215).toString(16)}`; | ||
} |
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,24 @@ | ||
import { Table } from './TransactionsHistory.styled'; | ||
|
||
export const TransactionsHistory = ({ items }) => { | ||
return ( | ||
<Table> | ||
<thead> | ||
<tr> | ||
<th>Type</th> | ||
<th>Amount</th> | ||
<th>Currency</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{items.map(({ id, type, amount, currency }) => ( | ||
<tr key={id}> | ||
<td>{type}</td> | ||
<td>{amount}</td> | ||
<td>{currency}</td> | ||
</tr> | ||
))} | ||
</tbody> | ||
</Table> | ||
); | ||
}; |
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,24 @@ | ||
import styled from 'styled-components'; | ||
|
||
export const Table = styled.table` | ||
box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.12), 0px 1px 1px rgba(0, 0, 0, 0.14), | ||
0px 2px 1px rgba(0, 0, 0, 0.2); | ||
border-radius: 0px 0px 4px 4px; | ||
margin: 60px auto 0 auto; | ||
text-align: center; | ||
color: midnightblue; | ||
width: 40%; | ||
& thead { | ||
background-color: lightskyblue; | ||
} | ||
& tr:hover { | ||
background-color: lightskyblue; | ||
text-shadow: 1px 1px 2px white, 0 0 1em white, 0 0 0.2em white; | ||
} | ||
& th, | ||
& td { | ||
padding: 8px 16px; | ||
border: 1px solid lightskyblue; | ||
border-radius: 10px; | ||
} | ||
`; |
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,32 @@ | ||
[ | ||
{ | ||
"avatar": "https://cdn-icons-png.flaticon.com/512/1998/1998592.png", | ||
"name": "Mango", | ||
"isOnline": true, | ||
"id": 1812 | ||
}, | ||
{ | ||
"avatar": "https://cdn-icons-png.flaticon.com/512/616/616438.png", | ||
"name": "Kiwi", | ||
"isOnline": false, | ||
"id": 1137 | ||
}, | ||
{ | ||
"avatar": "https://cdn-icons-png.flaticon.com/512/1623/1623681.png", | ||
"name": "Ajax", | ||
"isOnline": true, | ||
"id": 1213 | ||
}, | ||
{ | ||
"avatar": "https://cdn-icons-png.flaticon.com/512/2977/2977285.png", | ||
"name": "Jay", | ||
"isOnline": true, | ||
"id": 1714 | ||
}, | ||
{ | ||
"avatar": "https://cdn-icons-png.flaticon.com/512/1998/1998749.png", | ||
"name": "Poly", | ||
"isOnline": false, | ||
"id": 1284 | ||
} | ||
] |
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,7 @@ | ||
[ | ||
{ "id": "id-1", "label": ".docx", "percentage": 22 }, | ||
{ "id": "id-2", "label": ".pdf", "percentage": 4 }, | ||
{ "id": "id-3", "label": ".mp3", "percentage": 17 }, | ||
{ "id": "id-4", "label": ".psd", "percentage": 47 }, | ||
{ "id": "id-5", "label": ".pdf", "percentage": 10 } | ||
] |
Oops, something went wrong.