-
Notifications
You must be signed in to change notification settings - Fork 3k
Added modern styling and file organization #3350
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
arian-fallahpour
wants to merge
4
commits into
zero-to-mastery:master
Choose a base branch
from
arian-fallahpour:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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,71 @@ | ||
.Card { | ||
background-color: white; | ||
border-radius: 1rem; | ||
margin-top: 4rem; | ||
|
||
.dark-mode & { | ||
background-color: rgb(61, 61, 61); | ||
} | ||
|
||
&Header { | ||
display: grid; | ||
margin-top: -25%; | ||
} | ||
|
||
&Image { | ||
background-color: #eeeeee; | ||
border-radius: 100%; | ||
border: 0.5rem solid #eeeeee; | ||
height: 7rem; | ||
width: 7rem; | ||
overflow: hidden; | ||
|
||
.dark-mode & { | ||
background-color: rgb(51, 51, 51); | ||
border: 0.5rem solid rgb(51, 51, 51); | ||
} | ||
} | ||
|
||
&Main { | ||
display: grid; | ||
padding: 0 1rem; | ||
|
||
.dark-mode & { | ||
color: rgb(201, 201, 201); | ||
} | ||
} | ||
|
||
&Links { | ||
display: flex; | ||
gap: 0.4rem; | ||
justify-content: center; | ||
align-items: center; | ||
} | ||
|
||
&Link { | ||
background-color: black; | ||
color: inherit; | ||
width: 2rem; | ||
height: 2rem; | ||
display: block; | ||
border-radius: 100%; | ||
padding: 0.5rem; | ||
|
||
& > svg { | ||
fill: white; | ||
width: 100%; | ||
height: 100%; | ||
} | ||
|
||
.dark-mode & { | ||
background-color: rgb(129, 129, 129); | ||
|
||
& > svg { | ||
fill: rgb(33, 33, 33); | ||
} | ||
} | ||
} | ||
|
||
&Footer { | ||
} | ||
} |
This file contains hidden or 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,5 +1,6 @@ | ||
import React from 'react' | ||
import LazyLoad from 'react-lazyload' | ||
import './Card.scss' | ||
|
||
const defaultImageDataURI = | ||
"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='000000' fill-opacity='0.25' viewBox='0 0 24 24'%3E %3Cpath d='M9,11.75A1.25,1.25 0 0,0 7.75,13A1.25,1.25 0 0,0 9,14.25A1.25,1.25 0 0,0 10.25,13A1.25,1.25 0 0,0 9,11.75M15,11.75A1.25,1.25 0 0,0 13.75,13A1.25,1.25 0 0,0 15,14.25A1.25,1.25 0 0,0 16.25,13A1.25,1.25 0 0,0 15,11.75M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M12,20C7.59,20 4,16.41 4,12C4,11.71 4,11.42 4.05,11.14C6.41,10.09 8.28,8.16 9.26,5.77C11.07,8.33 14.05,10 17.42,10C18.2,10 18.95,9.91 19.67,9.74C19.88,10.45 20,11.21 20,12C20,16.41 16.41,20 12,20Z' /%3E %3C/svg%3E" | ||
|
@@ -10,44 +11,38 @@ const addDefaultImg = (e: any) => { | |
e.target.src = defaultImageDataURI | ||
} | ||
const Card = ({ user }: any) => { | ||
let { id, img, name, email, jobTitle, location, links } = user | ||
const { id, img, name, email, jobTitle, location, links } = user | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nitpick: we should avoid variable name "img". It should be descriptive. What image it is? |
||
|
||
if (id) { | ||
return ( | ||
<div | ||
id={`person-${id}`} | ||
className="card ma3 w5 tc bg-white br3 custom--shadow-2 custom--shadow-hover-8 custom--o-95 z-1" | ||
> | ||
<div className="header relative pt3 br2 br--top z-0"> | ||
<LazyLoad | ||
throttle={200} | ||
height={128} | ||
offset={100} | ||
once={true} | ||
> | ||
<img | ||
className="photo relative br-100 bw2 b--solid custom--b--primary bg-center object-fit-cover" | ||
height="128px" | ||
width="128px" | ||
src={img || defaultImageDataURI} | ||
alt={name} | ||
loading="lazy" | ||
onError={(e) => addDefaultImg(e)} | ||
/> | ||
</LazyLoad> | ||
<h2 className="name mt3 mb1 ph3 w-100 flex items-center justify-center"> | ||
{name} | ||
</h2> | ||
<p className="title text-center">{jobTitle}</p> | ||
</div> | ||
<div className="main pv2 ph3 flex items-center justify-center"> | ||
if (!id) { | ||
return <div></div> | ||
} | ||
|
||
return ( | ||
<div id={`person-${id}`} className="Card"> | ||
<div className="CardHeader"> | ||
<LazyLoad throttle={200} height={128} offset={100} once={true}> | ||
<img | ||
className="CardImage" | ||
height="128px" | ||
width="128px" | ||
src={img || defaultImageDataURI} | ||
alt={name} | ||
loading="lazy" | ||
onError={(e) => addDefaultImg(e)} | ||
/> | ||
</LazyLoad> | ||
</div> | ||
<div className="CardMain"> | ||
<h2 className="CardName">{name}</h2> | ||
<p className="CardJob">{jobTitle}</p> | ||
<div className="CardLinks"> | ||
{/* adding email button */} | ||
{email === '' ? ( | ||
'' | ||
) : ( | ||
<a | ||
href={'mailto:' + email} | ||
className="w2 h2 ma2" | ||
className="CardLink" | ||
title="email" | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
|
@@ -62,7 +57,7 @@ const Card = ({ user }: any) => { | |
) : ( | ||
<a | ||
href={links.website} | ||
className="w2 h2 ma2" | ||
className="CardLink" | ||
title="Website/Portfolio" | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
|
@@ -77,7 +72,7 @@ const Card = ({ user }: any) => { | |
) : ( | ||
<a | ||
href={links.github} | ||
className="w2 h2 ma2" | ||
className="CardLink" | ||
title="GitHub profile" | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
|
@@ -92,7 +87,7 @@ const Card = ({ user }: any) => { | |
) : ( | ||
<a | ||
href={links.linkedin} | ||
className="w2 h2 ma2" | ||
className="CardLink" | ||
title="LinkedIn profile" | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
|
@@ -104,7 +99,7 @@ const Card = ({ user }: any) => { | |
)} | ||
</div> | ||
<div style={{ margin: 0, padding: 0 }}> | ||
<p className="footer items-center justify-center br2 br--bottom"> | ||
<p className="CardFooter"> | ||
{location.city === '' ? '' : location.city} | ||
{(location.city !== '' && location.state !== '') || | ||
(location.city !== '' && location.country !== '') | ||
|
@@ -119,10 +114,8 @@ const Card = ({ user }: any) => { | |
</p> | ||
</div> | ||
</div> | ||
) | ||
} else { | ||
return <div></div> | ||
} | ||
</div> | ||
) | ||
} | ||
|
||
export default Card |
This file contains hidden or 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 @@ | ||
.CardList { | ||
display: grid; | ||
grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); | ||
gap: 1rem; | ||
padding: 3rem 0; | ||
width: 100%; | ||
} |
9 changes: 5 additions & 4 deletions
9
src/components/CardList.tsx → src/components/CardList/CardList.tsx
This file contains hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: for the consistency of the css colors, use same color formats