Skip to content

Commit

Permalink
Restyled the portfolio and blog post section on homepage
Browse files Browse the repository at this point in the history
  • Loading branch information
bytrangle committed Dec 3, 2020
1 parent cf715fb commit faa3b1b
Show file tree
Hide file tree
Showing 15 changed files with 337 additions and 188 deletions.
2 changes: 1 addition & 1 deletion content/insight/redirect-in-gatsby/index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
"title": "All about Redirect with Gatsby"
"description": "Gatsby is cool, Gatsby is perfect. But can it redirect, a common requirement for modern web apps? Let's find out."
"description": "Gatsby is cool, Gatsby is perfect. But how easy it is to set up redirect in Gatsby, a common requirement for modern web apps? Let's find out."
"date": "2020-11-12"
"featuredImage": "direction-signage.jpg"
"category": "web development"
Expand Down
6 changes: 1 addition & 5 deletions gatsby-browser.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
import "typeface-archivo"
import "typeface-archivo-narrow"
import "fontsource-raleway"
import "./src/styles/_global.scss"
export const onInitialClientRender = () => {
setTimeout(function() {
document.getElementById("__loader").style.display = "none"
}, 900)
}
15 changes: 5 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"@mdx-js/mdx": "^1.6.16",
"@mdx-js/react": "^1.6.16",
"@svgr/webpack": "^5.4.0",
"fontsource-raleway": "^3.0.9",
"gatsby": "^2.20.12",
"gatsby-image": "^2.3.2",
"gatsby-plugin-mdx": "^1.2.39",
Expand All @@ -44,8 +45,6 @@
"react-helmet": "^6.1.0",
"typeface-archivo": "^1.1.13",
"typeface-archivo-narrow": "^1.1.13",
"typeface-fira-sans": "0.0.75",
"typeface-fira-sans-extra-condensed": "0.0.72",
"typeface-inconsolata": "0.0.72"
},
"devDependencies": {
Expand Down
83 changes: 83 additions & 0 deletions src/components/FeaturedArticles/FeaturedArticles.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
import React from "react"
import { StaticQuery, graphql } from "gatsby"
import { Link } from "gatsby"
import styles from "./article.module.scss"

export default () => (
<StaticQuery
query={graphql`
query {
allMdx(
filter: { fileAbsolutePath: { regex: "/(insight)/.*.md$/" } }
limit: 1
sort: { fields: frontmatter___date, order: DESC }
) {
totalCount
edges {
node {
fields {
slug
}
id
frontmatter {
title
description
date(formatString: "MMMM YYYY")
category
}
}
}
}
}
`}
render={data => (
<ul className={`list-style-none p0 ${styles.grid__simple}`}>
{data.allMdx.edges.map(({ node }) => {
const { category, title, description } = node.frontmatter
return (
<li className={styles.post__wrapper}>
<Link
to={`journal${node.fields.slug}`}
className={styles.post__link}
>
<article className={`sans-serif pb3 lg-flex ${styles.post}`}>
<div
className={`${styles.post__info} lg-col-4 lg-mr1 line-height-3`}
>
<div>
<span
className={`normal monospace ${styles.post__category}`}
>
{category}
</span>
<span className="medium">{title}</span>
</div>
</div>
<div className={`lg-col-8 ${styles.post__preview}`}>
<p>{description}</p>
</div>
{/* <h6
className={`uppercase sans-serif small mb1 bold ${styles.post__cat}`}
>
{node.frontmatter.category}
</h6>
<h4
className={`big display medium mbn1 line-height-3 ${styles.post__title}`}
>
{node.frontmatter.title}
</h4>
<p className={`normal ${styles.post__date}`}>
{node.frontmatter.date}
</p> */}
</article>
</Link>
</li>
)
})}
</ul>
)}
/>
)
39 changes: 39 additions & 0 deletions src/components/FeaturedArticles/article.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
.post__wrapper {
position: relative;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
width: 100%;
}
.post__link {
}
.post {
flex-direction: row;
justify-content: center;
align-items: flex-start;
width: 100%;
&__preview {
font-size: 1.25rem;
line-height: 1.3333rem;
max-width: 16em;
p {
margin: 0;
}
@include var.media("screen", ">xlWidth") {
font-size: 1.875rem;
line-height: 2.1111rem;
}
}
&__info {
font-size: 1.5rem;
}
&__info span {
display: inline-block;
margin-right: 0.6rem;
}
&__category {
font-size: 0.875rem;
letter-spacing: -0.02em;
}
}
1 change: 1 addition & 0 deletions src/components/FeaturedArticles/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from "./FeaturedArticles"
2 changes: 1 addition & 1 deletion src/components/Header/Header.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
.link {
margin-right: 40px;
@include var.media(">medWidth") {
font-size: 1.3333rem;
font-size: 1.1111rem;
}
}
}
1 change: 0 additions & 1 deletion src/components/Layout/Layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export default function Layout({
headerPosition,
}) {
const mainClass = width === "fixed" ? "container" : "none"
console.log(hasMargin)
return (
<div
id={pageType}
Expand Down
4 changes: 2 additions & 2 deletions src/components/article-list-homepage.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ export default () => (
query={graphql`
query {
allMdx(
filter: { fileAbsolutePath: { regex: "/(markdown)/.*.md$/" } }
limit: 6
filter: { fileAbsolutePath: { regex: "/(insight)/.*.md$/" } }
limit: 1
sort: { fields: frontmatter___date, order: DESC }
) {
totalCount
Expand Down
63 changes: 42 additions & 21 deletions src/components/portfolio-select.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,31 +34,52 @@ export default () => (
`}
render={data => (
<div className="portfolio">
{data.allMdx.edges.map(({ node }, index) => (
<div
className={`${styles.project} block items-center mb4 lg-mx0 mxn2`}
>
{/* <Img
{data.allMdx.edges.map(({ node }, index) => {
const order = (index + 1) % 2 === 0 ? "even" : "odd"
const projectClass = ["lg-flex", "block", "items-center", "mb4"]
const infoClass = [
"xl-col-5",
"lg-col-6",
"xl-p2",
"p1",
"z4",
"border",
"border-thick",
"relative",
]
const imgClass = ["xl-col-7", "lg-col-6"]
if (order === "even") {
projectClass.push("lg-flex-reverse")
imgClass.push("xl-ml3", "lg-ml2")
// infoClass.push("xl-mr3")
} else {
imgClass.push("xl-mr3", "lg-mr2")
// infoClass.push("xl-ml3")
}
return (
<div className={projectClass.join(" ")}>
{/* <Img
fluid={node.frontmatter.featuredImage.childImageSharp.fluid}
style={{ flex: '1', marginLeft: '-6rem'}}
/> */}
<img
className={`${styles.project__featuredImg} xl-col-7 lg-col-10 ${
index % 2 === 0 ? `xl-mln6` : `xl-mrn6`
}`}
src={node.frontmatter.gif.publicURL}
alt="Blah"
/>
<div
className={`${styles.project__info} xl-col-6 xl-mt0 mtn6 xl-mx0 xl-p2 p1 z4 border border-thick relative mx2`}
>
<h3 className={styles.project__name}>{node.frontmatter.title}</h3>
<p className={styles.project__desc}>
{node.frontmatter.description}
</p>
<img
className={`${styles.project__featuredImg} ${imgClass.join(
" "
)}`}
src={node.frontmatter.gif.publicURL}
alt={node.frontmatter.title}
/>
<div className={`${styles.project__info} ${infoClass.join(" ")}`}>
<h3 className={styles.project__name}>
{node.frontmatter.title}
</h3>
<p className={styles.project__desc}>
{node.frontmatter.description}
</p>
</div>
</div>
</div>
))}
)
})}
</div>
)}
/>
Expand Down
8 changes: 0 additions & 8 deletions src/components/portfolio-select.module.scss
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
@include var.media(">xlWidth") {
.project {
display: flex;
&:nth-child(2n + 1) {
flex-direction: row-reverse;
}
}
}
.project__info {
background-color: var.$white;
box-shadow: 8px 8px 8px 4px rgba(0, 0, 0, 0.25);
Expand Down
38 changes: 0 additions & 38 deletions src/html.js

This file was deleted.

8 changes: 4 additions & 4 deletions src/pages/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react"
import Layout from "../components/Layout"
import Intro from "../components/intro"
import ArticleList from "../components/article-list-homepage"
import FeaturedArticles from "../components/FeaturedArticles"
import Portfolio from "../components/portfolio-select"

export default () => (
Expand All @@ -15,11 +15,11 @@ export default () => (
</h2>
<Portfolio />
</section>
<section className="hp-tertiary pt3 mb4 mx-auto">
<section className="hp-tertiary width-full mx-auto">
<h2 className="center section-title">
<span className="honeydew">Recently I've Learned</span>
<span className="honeydew">Useful Read</span>
</h2>
<ArticleList />
<FeaturedArticles />
</section>
</Layout>
)
Loading

0 comments on commit faa3b1b

Please sign in to comment.