Skip to content

Commit

Permalink
Add blog page (orcasound#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrickcalvin authored Feb 23, 2022
1 parent b55409e commit 4d4b650
Show file tree
Hide file tree
Showing 5 changed files with 166 additions and 4 deletions.
Binary file added public/images/srkw2-36.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
70 changes: 70 additions & 0 deletions src/components/BlogItem.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import { styled, Typography } from '@mui/material'
import Image from 'next/image'

import Link from './Link'

interface BlogItemProps {
image: string
title?: string
summary?: string
datePublished?: string
author?: string
}

const BlogItemContainer = styled('div')({
width: '48%',
display: 'flex',
flexDirection: 'row',
alignItems: 'center',
margin: '20px 0',
'@media(max-width: 785px)': {
width: '68%',
flexWrap: 'wrap',
},
})

const BlogItemBody = styled('div')({
display: 'flex',
flexDirection: 'column',
margin: '0 20px',
'@media(max-width: 785px)': {
margin: 0,
marginTop: 20,
},
})

const BlogItem = ({
image,
title,
summary,
datePublished,
author,
}: BlogItemProps) => {
return (
<BlogItemContainer>
<Image src={image} alt={title} width="300%" height="240%" />
<BlogItemBody>
<Typography variant="h3" sx={{ fontSize: 20, fontWeight: 550 }}>
{title}
</Typography>
<Typography
paragraph
sx={{
fontSize: 13,
fontWeight: 600,
color: '#999999',
textTransform: 'uppercase',
}}
>
Posted on {datePublished} By {author}
</Typography>
<Typography paragraph sx={{ fontSize: 16, fontWeight: 450 }}>
{summary}
</Typography>
<Link href="/blog">Read More...</Link>
</BlogItemBody>
</BlogItemContainer>
)
}

export default BlogItem
90 changes: 90 additions & 0 deletions src/pages/blog.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
import KeyboardDoubleArrowDownRoundedIcon from '@mui/icons-material/KeyboardDoubleArrowDownRounded'
import { Typography } from '@mui/material'
import { styled } from '@mui/system'

import frequency1 from '../../public/images/frequency.png'
import BlogItem from '../components/BlogItem'
import blogStyles from '../styles/blog.module.css'

// TODO: replace CSS module with MUI styled()
// should use next/image instead of backgroundImage
// eslint-disable-next-line no-unused-vars
const Banner = styled('div')({
// backgroundImage: "url('../../public/images/frequency.png')",
backgroundSize: 'cover',
backgroundRepeat: 'no-repeat',
backgroundPosition: '50% 55%',
})

const Overlay = styled('div')({
height: '88vh',
display: 'flex',
flexDirection: 'column',
justifyContent: 'center',
alignItems: 'center',
backgroundColor: 'rgba(5, 28, 90, 0.3)',
})

const BlogItemList = styled('section')({
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
})

const Blog = () => {
const data = [
{
image: frequency1,
title: 'Lone first to hear j+K pods entering Puget Sound at Bush Point',
summary:
'This morning at around 8:30, Lon Brocklehurst texted that he was hearing orcas on the Bush Point. Though it ...',
date: '2020-11-11',
author: 'Scott Veirs',
},
{
image: frequency1,
title: 'Election Night humpback calls at Orcasound',
summary:
'For about a half hour 20:00 this evening (Tues, 3 Nov 2020), Humpback calls were recorded at Orcasound',
date: '2020-11-04',
author: 'Scott Veirs',
},
]

return (
<>
<div className={blogStyles.banner}>
<Overlay>
<Typography
variant="h1"
sx={{ fontSize: 160, color: '#fff', fontWeight: 450 }}
>
Blog
</Typography>
<KeyboardDoubleArrowDownRoundedIcon
sx={{
fontSize: 100,
color: '#fff',
position: 'absolute',
bottom: 1,
}}
/>
</Overlay>
</div>
<BlogItemList>
{data.map((item, id) => (
<BlogItem
key={id}
image={item.image}
title={item.title}
summary={item.summary}
author={item.author}
datePublished={item.date}
/>
))}
</BlogItemList>
</>
)
}

export default Blog
6 changes: 6 additions & 0 deletions src/styles/blog.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.banner {
background: url('../../public/images/srkw2-36.jpg');
background-size: cover;
background-repeat: no-repeat;
background-position: 50% 55%;
}
4 changes: 0 additions & 4 deletions src/styles/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ const theme = createTheme({
error: {
main: red.A400,
},
text: {
primary: '#ffffff',
secondary: '#007bff',
},
},
})

Expand Down

0 comments on commit 4d4b650

Please sign in to comment.