mirror of
https://github.com/Snigdha-OS/Snigdha-OS.github.io.git
synced 2025-09-16 17:45:01 +02:00
🛠️ build(static): change from astro to gatsby
This commit is contained in:
32
src/pages/404.js
Normal file
32
src/pages/404.js
Normal file
@@ -0,0 +1,32 @@
|
||||
import React from 'react'
|
||||
import styled from 'styled-components'
|
||||
|
||||
import Head from '../components/defaults/head'
|
||||
import Layout from '../components/defaults/layout'
|
||||
import Header from '../components/header'
|
||||
|
||||
const Container = styled.div`
|
||||
margin: 100px auto auto;
|
||||
text-align: center;
|
||||
`
|
||||
const Title = styled.h1`
|
||||
margin: 50px 0;
|
||||
`
|
||||
const Description = styled.p``
|
||||
|
||||
const NotFoundPage = () => (
|
||||
<Layout>
|
||||
<Head title="404 Not Found" />
|
||||
<Header />
|
||||
<Container className="container container--secondary">
|
||||
<div className="container container--primary">
|
||||
<Title>NOT FOUND</Title>
|
||||
<Description>
|
||||
You just hit a route that doesn't exist... the sadness.
|
||||
</Description>
|
||||
</div>
|
||||
</Container>
|
||||
</Layout>
|
||||
)
|
||||
|
||||
export default NotFoundPage
|
123
src/pages/blog.js
Normal file
123
src/pages/blog.js
Normal file
@@ -0,0 +1,123 @@
|
||||
import React from 'react'
|
||||
import styled from 'styled-components'
|
||||
import { Link, graphql, useStaticQuery } from 'gatsby'
|
||||
|
||||
import Head from '../components/defaults/head'
|
||||
import Layout from '../components/defaults/layout'
|
||||
import Header from '../components/header'
|
||||
|
||||
const Container = styled.div`
|
||||
margin: 100px auto auto;
|
||||
text-align: center;
|
||||
|
||||
h1 {
|
||||
margin: 50px 0;
|
||||
}
|
||||
|
||||
.blog {
|
||||
&__container {
|
||||
align-items: flex-end;
|
||||
}
|
||||
&__desc {
|
||||
text-align: center;
|
||||
margin: 50px 0;
|
||||
color: #bdbdbd;
|
||||
}
|
||||
&__wrapper {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, 1fr);
|
||||
grid-gap: 20px;
|
||||
width: 90%;
|
||||
list-style: none;
|
||||
margin: 50px 0;
|
||||
padding: 0;
|
||||
text-align: left;
|
||||
}
|
||||
&__box {
|
||||
background: #111;
|
||||
border-radius: 4px;
|
||||
padding: 15px;
|
||||
transition: 0.4s;
|
||||
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.5);
|
||||
opacity: 0.4;
|
||||
|
||||
&:hover {
|
||||
transform: translateY(-10px);
|
||||
transition: 0.4s;
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
&__img {
|
||||
width: 100%;
|
||||
height: 150px;
|
||||
border-radius: 4px;
|
||||
object-fit: cover;
|
||||
}
|
||||
&__title {
|
||||
font-family: 'JetBrains Mono';
|
||||
direction: ltr;
|
||||
margin: 10px 0 5px;
|
||||
}
|
||||
&__time {
|
||||
font-size: 14px;
|
||||
color: #bdbdbd;
|
||||
direction: ltr;
|
||||
}
|
||||
}
|
||||
`
|
||||
|
||||
const BlogPage = () => {
|
||||
const data = useStaticQuery(graphql`
|
||||
query {
|
||||
allContentfulBlogPost(sort: { fields: publishedDate, order: DESC }) {
|
||||
edges {
|
||||
node {
|
||||
id
|
||||
title
|
||||
slug
|
||||
publishedDate(formatString: "MMMM Do, YYYY")
|
||||
background {
|
||||
file {
|
||||
url
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`)
|
||||
|
||||
const output = data.allContentfulBlogPost.edges.map((element) => {
|
||||
const { id, slug, background, title, publishedDate } = element.node
|
||||
return (
|
||||
<li key={id} className="blog__box">
|
||||
<Link to={`/blog/${slug}`}>
|
||||
<img
|
||||
className="blog__img"
|
||||
src={background.file.url}
|
||||
alt={title}
|
||||
loading="lazy"
|
||||
/>
|
||||
<p className="blog__title">{title}</p>
|
||||
<p className="blog__time">{publishedDate}</p>
|
||||
</Link>
|
||||
</li>
|
||||
)
|
||||
})
|
||||
|
||||
return (
|
||||
<Layout>
|
||||
<Head title="All posts" />
|
||||
<Header />
|
||||
<Container className="container container--secondary">
|
||||
<div className="container container--primary">
|
||||
<h1>All posts</h1>
|
||||
<p>Read now!</p>
|
||||
</div>
|
||||
<ul className="blog__wrapper">{output}</ul>
|
||||
</Container>
|
||||
</Layout>
|
||||
)
|
||||
}
|
||||
|
||||
export default BlogPage
|
21
src/pages/index.js
Normal file
21
src/pages/index.js
Normal file
@@ -0,0 +1,21 @@
|
||||
import React from 'react'
|
||||
import Layout from '../components/defaults/layout'
|
||||
import Head from '../components/defaults/head'
|
||||
import Hero from '../components/hero'
|
||||
import About from '../components/about'
|
||||
import Projects from '../components/projects'
|
||||
import Blog from '../components/blog'
|
||||
import Contact from '../components/contact'
|
||||
|
||||
const IndexPage = () => (
|
||||
<Layout>
|
||||
<Head />
|
||||
<Hero />
|
||||
<About />
|
||||
<Projects />
|
||||
<Blog />
|
||||
<Contact />
|
||||
</Layout>
|
||||
)
|
||||
|
||||
export default IndexPage
|
Reference in New Issue
Block a user