-
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.
ft(user): WIP: Setup Skeleton Loading to improve User Experience
- Install react-skeleton loading component - Create a CardSkeleton Component
- Loading branch information
Blessing Makaraba
authored and
Blessing Makaraba
committed
Sep 25, 2021
1 parent
3ac9fca
commit 393f93b
Showing
26 changed files
with
453 additions
and
44 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,11 @@ | ||
import styled from "styled-components"; | ||
|
||
export const Avatar = styled.img``; | ||
export const AvatarImg = styled.div` | ||
width: 250px; | ||
height: 80px; | ||
overflow: hidden; | ||
img { | ||
display: block; | ||
} | ||
`; |
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,10 +1,14 @@ | ||
import { AvatarImg } from "./Avatar.styles"; | ||
|
||
type AvatarProps = { | ||
imgUrl: string; | ||
fullName: string; | ||
}; | ||
|
||
const Avatar: React.FC<AvatarProps> = ({ imgUrl, fullName }) => ( | ||
<img src={imgUrl} alt={`${fullName}-avatar`} /> | ||
<AvatarImg> | ||
<img src={imgUrl} alt={`${fullName}-avatar`} /> | ||
</AvatarImg> | ||
); | ||
|
||
export default Avatar; |
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,3 +1,15 @@ | ||
import styled from "styled-components"; | ||
|
||
export const Button = styled.button``; | ||
export const StyledButton = styled.button` | ||
appearance: none; | ||
outline: none; | ||
padding: 0.6rem; | ||
color: white; | ||
background-color: #0e1117; | ||
border: none; | ||
&:disabled { | ||
background-color: gray; | ||
cursor: none; | ||
} | ||
`; |
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,3 +1,11 @@ | ||
const Button: React.FC<{}> = () => <button type="submit">Search</button>; | ||
import { StyledButton } from "./Button.styles"; | ||
|
||
const Button: React.FC<{ disable: boolean }> = ({ disable }) => { | ||
return ( | ||
<StyledButton type="submit" disabled={disable}> | ||
Search | ||
</StyledButton> | ||
); | ||
}; | ||
|
||
export default Button; |
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,3 +1,7 @@ | ||
import styled from "styled-components"; | ||
|
||
export const InputField = styled.input``; | ||
export const InputField = styled.input` | ||
padding: 0.5rem; | ||
width: 90%; | ||
margin: 0 auto; | ||
`; |
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,3 +1,5 @@ | ||
import styled from "styled-components"; | ||
|
||
export const Label = styled.h3``; | ||
export const StyledTitle = styled.h1` | ||
text-align: center; | ||
`; |
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,3 +1,7 @@ | ||
const Title: React.FC<{}> = () => <h1>GitHub Repository Search</h1>; | ||
import { StyledTitle } from "./Title.styles"; | ||
|
||
const Title: React.FC<{ children: string }> = ({ children }) => ( | ||
<StyledTitle>{children}</StyledTitle> | ||
); | ||
|
||
export default Title; |
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,23 @@ | ||
import styled, { keyframes } from "styled-components"; | ||
|
||
const rotate = keyframes` | ||
to { | ||
transform: rotate(360deg); | ||
} | ||
`; | ||
|
||
export const SpinnerContainer = styled.div` | ||
position: absolute; | ||
top: 50%; | ||
left: 50%; | ||
transform: translate(-50%, -50%); | ||
`; | ||
|
||
export const Spinner = styled.div` | ||
width: 100px; | ||
height: 100px; | ||
border: 3px solid #f5f5f5; | ||
border-radius: 50%; | ||
border-top-color: paleturquoise; | ||
animation: ${rotate} 0.5s linear infinite; | ||
`; |
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,9 @@ | ||
import { SpinnerContainer, Spinner } from "./Loader.styles"; | ||
|
||
const Loader = () => ( | ||
<SpinnerContainer> | ||
<Spinner /> | ||
</SpinnerContainer> | ||
); | ||
|
||
export default Loader; |
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,3 +1,14 @@ | ||
import styled from "styled-components"; | ||
|
||
export const SearchComponent = styled.div``; | ||
export const SearchComponent = styled.div` | ||
background-color: white; | ||
display: flex; | ||
justify-content: space-between; | ||
margin: 0 auto; | ||
padding: 2rem; | ||
`; | ||
|
||
export const SearchBox = styled.div` | ||
width: 60%; | ||
align-self: center; | ||
`; |
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,3 @@ | ||
import styled from "styled-components"; | ||
|
||
export const ContributorsComponent = styled.div``; |
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,3 +1,9 @@ | ||
import styled from "styled-components"; | ||
|
||
export const Home = styled.div``; | ||
|
||
export const CardDisplayWrapper = styled.div` | ||
display: flex; | ||
justify-content: space-around; | ||
flex-wrap: wrap; | ||
`; |
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,3 +1,30 @@ | ||
import styled from "styled-components"; | ||
import { Link } from "react-router-dom"; | ||
|
||
export const CardDisplay = styled.div``; | ||
export const StyledCard = styled.div` | ||
background-color: white; | ||
border-bottom: 1px solid #272b36; | ||
padding: 1rem; | ||
flex-basis: 80%; | ||
margin-top: 2rem; | ||
& p { | ||
margin-top: 2rem; | ||
} | ||
@media screen and (min-width: 1200px) { | ||
flex-basis: 30%; | ||
} | ||
`; | ||
|
||
export const StyledLink = styled(Link)` | ||
appearance: none; | ||
text-decoration: none; | ||
background-color: #0e1117; | ||
display: inline-block; | ||
color: white; | ||
border-radius: 6px; | ||
padding: 0.5rem; | ||
margin-top: 2rem; | ||
`; |
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,11 +1,17 @@ | ||
import { Link } from "react-router-dom"; | ||
import Avatar from "UI/atoms/Avatar/Avatar"; | ||
import Description from "UI/atoms/Description/Description"; | ||
import { StyledCard, StyledLink } from "./Card.styles"; | ||
|
||
const Card: React.FC<{}> = () => ( | ||
<> | ||
<div> | ||
<Link to="/contributors" /> | ||
</div> | ||
</> | ||
const Card: React.FC<{ datum: any }> = ({ datum }) => ( | ||
<StyledCard> | ||
<Avatar imgUrl="https://google.com" fullName="facebbok" /> | ||
<Description label="Repository" content="Facebook/React" /> | ||
<Description label="Owner" content="Facebook" /> | ||
<Description label="Number of Stars" content="12345" /> | ||
<Description label="Number of Forks" content="123485" /> | ||
|
||
<StyledLink to="/contributors">View Contributors</StyledLink> | ||
</StyledCard> | ||
); | ||
|
||
export default Card; |
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,6 @@ | ||
import styled from "styled-components"; | ||
|
||
import Skeleton from "react-skeleton-loading"; | ||
import Description from "UI/atoms/Description/Description"; | ||
|
||
export const DescriptionSkeleton = styled(Skeleton)``; |
Oops, something went wrong.