-
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.
Create blog stream Create post template Configured multiple route Add README file to explain WHAT IS HAPPENING
- Loading branch information
Efrain Villanueva
committed
May 26, 2021
1 parent
8389dd2
commit 60c9cb6
Showing
17 changed files
with
472 additions
and
98 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"semi": true, | ||
"trailingComma": "all", | ||
"singleQuote": true, | ||
"tabWidth": 2, | ||
"useTabs": false, | ||
"printWidth": 70 | ||
} |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,68 @@ | ||
import React from 'react'; | ||
import { NavLink } from 'react-router-dom'; | ||
|
||
import Grid from '@material-ui/core/Grid'; | ||
import Skeleton from '@material-ui/lab/Skeleton'; | ||
|
||
import useStyles from './styles'; | ||
|
||
const EntriesTemplate = ({ | ||
blogEntries, | ||
isLoading | ||
}) => { | ||
const classes = useStyles(); | ||
|
||
const entries = blogEntries; | ||
let cont = 0; | ||
|
||
const getColSpace = () => { | ||
let colSpace = 12; | ||
|
||
if (cont === 0) { | ||
colSpace = 12; | ||
} else if (cont < 2 || cont > 5) { | ||
colSpace = 6; | ||
} else { | ||
colSpace = 3; | ||
} | ||
|
||
if (cont === 7) { | ||
cont = 1; | ||
} | ||
|
||
cont += 1; | ||
|
||
return colSpace; | ||
} | ||
|
||
return entries.map((entry, index) => { | ||
console.log(entry.image); | ||
return ( | ||
<Grid key={`blog-entries-key-${index}`} item xs={getColSpace()}> | ||
{isLoading ? ( | ||
<Skeleton | ||
animation='wave' | ||
variant='rect' | ||
width='100%' | ||
height={280} | ||
/> | ||
) : ( | ||
<NavLink | ||
className={classes.entry} | ||
exact | ||
to={`/blog/${entry.slug}`} | ||
style={{ | ||
backgroundImage: `url(${entry.image})`, | ||
}} | ||
> | ||
|
||
<h2>{entry.title}</h2> | ||
<h3>{entry.author.name}</h3> | ||
</NavLink> | ||
)} | ||
</Grid> | ||
); | ||
}); | ||
}; | ||
|
||
export default EntriesTemplate; |
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 @@ | ||
**Efra programming BLOG** | ||
|
||
This is my blog, the design was inspired by this theme https://partio.golem.io/ on [Ghost Blog](https://ghost.org/themes/?tag=Blog) |
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
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,30 @@ | ||
import React from 'react'; | ||
import { Chip } from '@material-ui/core'; | ||
import useStyles from './styles'; | ||
|
||
const Footer = ({ category, author }) => { | ||
const classes = useStyles(); | ||
|
||
return ( | ||
<div className={classes.footer}> | ||
{author && ( | ||
<div> | ||
<figure> | ||
{/* Implement link to all posts of this author */} | ||
<a href="#efra-link"> | ||
<img src={author.avatar} alt={author.name} /> | ||
</a> | ||
</figure> | ||
<h3> | ||
<a href="#efra-link">{author.name}</a> | ||
</h3> | ||
</div> | ||
)} | ||
<div> | ||
<Chip label={category} /> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Footer; |
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,37 @@ | ||
import React from 'react'; | ||
import {Container, Grid, Chip} from '@material-ui/core'; | ||
import useStyle from './styles'; | ||
|
||
const Header = ({ | ||
entry | ||
}) => { | ||
const classes = useStyle(); | ||
|
||
return ( | ||
<header className={classes.hero} style={{ backgroundImage: `url(${entry.image})` }}> | ||
<Grid container justify='center'> | ||
<Grid item sm={10} xs={11}> | ||
<Container maxWidth='md'> | ||
<h1>{entry.title}</h1> | ||
<div> | ||
{entry.author && | ||
<> | ||
<a className={classes.author} href={`mailto:${entry.author.email}`} >{entry.author.name}</a> | ||
<div className={classes.avatar}><img src={entry.author.avatar} alt={`${entry.author.name}`} /></div> | ||
</> | ||
} | ||
</div> | ||
<div className={classes.postDetail}> | ||
<div> | ||
<Chip color="secondary" className="chip" label={entry.category} /> | ||
<Chip color="secondary" className="chip" label={entry.date} /> | ||
</div> | ||
</div> | ||
</Container> | ||
</Grid> | ||
</Grid> | ||
</header> | ||
) | ||
}; | ||
|
||
export default Header; |
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,45 @@ | ||
import React, { useState, useEffect } from 'react'; | ||
import { Container, Grid } from '@material-ui/core'; | ||
import { useParams } from 'react-router'; | ||
import { getPostBySlug } from '../../../constants/blogEntries'; | ||
import useStyle from './styles'; | ||
import Header from './Header'; | ||
import Footer from './Footer'; | ||
import IconButton from '@material-ui/core/IconButton'; | ||
import FacebookIcon from '@material-ui/icons/Facebook'; | ||
import TwitterIcon from '@material-ui/icons/Twitter'; | ||
|
||
const Post = () => { | ||
const slug = useParams(); | ||
const [entry, setEntry] = useState({}); | ||
const classes = useStyle(); | ||
|
||
useEffect(() => { | ||
setEntry(getPostBySlug(slug.slug)); | ||
}, [slug]); | ||
|
||
return ( | ||
<> | ||
<Header entry={entry} /> | ||
<main className={classes.body}> | ||
<Grid container justify="center"> | ||
<Grid item sm={10} xs={11}> | ||
<Container maxWidth="md">{entry.body}</Container> | ||
<aside className={classes.socials}> | ||
<IconButton aria-label="Facebook share Button"> | ||
<FacebookIcon /> | ||
</IconButton> | ||
<IconButton aria-label="Twitter share Button"> | ||
<TwitterIcon /> | ||
</IconButton> | ||
</aside> | ||
</Grid> | ||
</Grid> | ||
</main> | ||
<Footer category={entry.category} author={entry.author} /> | ||
{/* Add a widget for more posts */} | ||
</> | ||
); | ||
}; | ||
|
||
export default Post; |
Oops, something went wrong.