-
Notifications
You must be signed in to change notification settings - Fork 1
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
Blog page improvements #18
Open
tejash-patel
wants to merge
16
commits into
master
Choose a base branch
from
blog-page-improvements
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
16 commits
Select commit
Hold shift + click to select a range
2fcbe0c
add default profile icon
tejash-patel 90ddbd0
remove duplicate header component
tejash-patel d257143
remove separate css files
tejash-patel 1ae770c
update blog cards to use styled components
tejash-patel ae1df66
add blog card component for latest post
tejash-patel a31e361
update header to include blog item
tejash-patel 72140d4
use styled components
tejash-patel eae44f5
various css fixes
tejash-patel 40dfdac
show black logo in blogs
tejash-patel 09116e3
fix width size + show no ruler in mobile view
tejash-patel 0368d37
add helper function for common code
tejash-patel 9b6e9cf
remove console log
tejash-patel 4add639
fix skewed feature image
tejash-patel b82006d
use the ?? operator
tejash-patel 4560048
use proper tye for helper function
tejash-patel fc1584a
update props interface
tejash-patel 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
This file was deleted.
Oops, something went wrong.
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
import React from 'react' | ||
import { Link } from 'gatsby' | ||
import styled from 'styled-components' | ||
import FeatureImage from 'images/default-feature-image.jpg' | ||
import ProfileIcon from 'images/DefaultProfileIcon.png' | ||
import { formatDate } from './helpers' | ||
|
||
const Card = styled.div` | ||
margin: 15px; | ||
position: relative; | ||
display: flex; | ||
flex-direction: column; | ||
min-width: 0; | ||
word-wrap: break-word; | ||
background-color: var(--white); | ||
background-clip: border-box; | ||
border-radius: 0.25rem; | ||
|
||
border: 2px solid #bfbfbf; | ||
border-radius: var(--border-radius); | ||
` | ||
|
||
const CardBody = styled.div` | ||
flex: 1 1 auto; | ||
min-height: 1px; | ||
padding: 1.25rem; | ||
` | ||
|
||
const CardImgTop = styled.img` | ||
width: 100%; | ||
border-top-left-radius: calc(0.25rem - 1px); | ||
border-top-right-radius: calc(0.25rem - 1px); | ||
` | ||
|
||
const Tag = styled.span` | ||
color: var(--purple2); | ||
` | ||
|
||
const Small = styled.div` | ||
font-size: 62.5%; | ||
` | ||
|
||
type BlogCardProps = { | ||
title: String | ||
reading_time: number | ||
published_at: Date | ||
excerpt: String | ||
feature_image: String | ||
slug: String | ||
tags: Array<any> | ||
primary_author_name: String | ||
authors: Array<any> | ||
Comment on lines
+50
to
+52
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. Can you also specify interfaces for Tags and Authors? (and any other interfaces that might be required). |
||
} | ||
|
||
const BlogCard = ({ | ||
title, | ||
reading_time, | ||
published_at, | ||
excerpt, | ||
feature_image, | ||
slug, | ||
tags, | ||
authors, | ||
primary_author_name | ||
}: BlogCardProps) => { | ||
return ( | ||
<Card className='mb-2'> | ||
<Link to={'/blog/' + slug}> | ||
<CardImgTop src={feature_image ?? FeatureImage} alt='img' /> | ||
<CardBody> | ||
{tags.map((tag: any) => ( | ||
<Tag key='tag.name'>{tag.name.toUpperCase()}</Tag> | ||
))} | ||
<h2>{title}</h2> | ||
<p>{excerpt}</p> | ||
<Small> | ||
<section className='post-full-byline-content'> | ||
<ul className='author-list'> | ||
{authors.map((author: any) => ( | ||
<li className='author-list-item' key='author.name'> | ||
<div className='author-card'> | ||
<img | ||
className='author-profile-image' | ||
src={author.profile_image} | ||
alt='Ghost' | ||
/> | ||
<div className='author-info'> | ||
<div className='bio'> | ||
<h2>{author.name}</h2> | ||
</div> | ||
</div> | ||
</div> | ||
<div className='author-avatar'> | ||
<img | ||
className='author-profile-image' | ||
src={author.profile_image ?? ProfileIcon} | ||
alt='Ghost' | ||
/> | ||
</div> | ||
</li> | ||
))} | ||
</ul> | ||
|
||
<section className='post-full-byline-meta'> | ||
<h4 className='author-name'>{primary_author_name}</h4> | ||
<div className='byline-meta-content'> | ||
<time className='byline-meta-date'> | ||
{formatDate(published_at)} | ||
</time> | ||
<span className='byline-reading-time'> | ||
<span className='bull'>•</span> {reading_time} min read | ||
</span> | ||
</div> | ||
</section> | ||
</section> | ||
</Small> | ||
</CardBody> | ||
</Link> | ||
</Card> | ||
) | ||
} | ||
|
||
export default BlogCard |
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.
Use primitive types