1
0
Fork 0

everything passes lint

This commit is contained in:
Enoch Riese 2022-12-03 11:25:02 -06:00
parent e28ca4ea86
commit 477a4d93f5
24 changed files with 304 additions and 303 deletions

View file

@ -7,45 +7,56 @@ import { strapiImage } from 'shared/utils'
import { useTranslation } from 'next-i18next'
import { serverSideTranslations } from 'next-i18next/serverSideTranslations'
const strapi = "https://posts.freesewing.org"
const strapi = 'https://posts.freesewing.org'
const textShadow = {
style: {
textShadow: "1px 1px 1px #000000, -1px -1px 1px #000000, 1px -1px 1px #000000, -1px 1px 1px #000000, 2px 2px 1px #000000"
}
textShadow:
'1px 1px 1px #000000, -1px -1px 1px #000000, 1px -1px 1px #000000, -1px 1px 1px #000000, 2px 2px 1px #000000',
},
}
const Preview = ({ app, post }) => (
const Preview = ({ post }) => (
<div className="shadow rounded-lg">
<Link href={`/blog/${post.slug}`}>
<a title={post.title} className="hover:underline">
<div className="bg-base-100 w-full aspect-video shadow flex flex-column items-end rounded-lg" style={{
backgroundImage: `url(${strapi}${post.image.sizes.medium.url})`,
backgroundSize: 'cover',
}}>
<div
className="bg-base-100 w-full aspect-video shadow flex flex-column items-end rounded-lg"
style={{
backgroundImage: `url(${strapi}${post.image.sizes.medium.url})`,
backgroundSize: 'cover',
}}
>
<div className="grow"></div>
<div className="text-right mb-3 lg:mb-8">
<div className={`
<div
className={`
bg-neutral text-neutral-content bg-opacity-40 text-right
px-4 py-1
lg:px-8 lg:py-4
`}>
<h5 className={`
`}
>
<h5
className={`
text-neutral-content
text-xl font-bold
md:text-2xl md:font-normal
xl:text-3xl
`} {...textShadow}
`}
{...textShadow}
>
{post.title}
</h5>
<p className={`
<p
className={`
hidden md:block
m-0 p-1 -mt-2
text-neutral-content
leading-normal text-sm font-normal
opacity-70
`}{ ...textShadow}>
`}
{...textShadow}
>
<TimeAgo date={post.date} /> by <strong>{post.author}</strong>
</p>
</div>
@ -61,10 +72,11 @@ const BlogIndexPage = (props) => {
const { t } = useTranslation()
return (
<Page app={app} title={t('blog')} slug='blog'>
<Page app={app} title={t('blog')} slug="blog">
<div className="grid grid-cols-1 gap-4 lg:grid-cols-2 max-w-7xl">
{props.posts.map(post => <Preview app={app} post={post} key={post.slug}/>)
}
{props.posts.map((post) => (
<Preview app={app} post={post} key={post.slug} />
))}
</div>
</Page>
)
@ -82,18 +94,15 @@ export default BlogIndexPage
*
* To learn more, see: https://nextjs.org/docs/basic-features/data-fetching
*/
export async function getStaticProps({ params, locale }) {
const posts = await fetch(
`${strapiHost}/blogposts?_locale=${locale}&_sort=date:DESC&dev_ne=true`
)
.then(response => response.json())
.then(data => data)
.catch(err => console.log(err))
export async function getStaticProps({ locale }) {
const posts = await fetch(`${strapiHost}/blogposts?_locale=${locale}&_sort=date:DESC&dev_ne=true`)
.then((response) => response.json())
.then((data) => data)
.catch((err) => console.log(err))
return {
props: {
posts: posts.map(post => ({
posts: posts.map((post) => ({
slug: post.slug,
title: post.title,
date: post.date,
@ -101,7 +110,6 @@ export async function getStaticProps({ params, locale }) {
image: strapiImage(post.image, ['medium']),
})),
...(await serverSideTranslations(locale)),
}
},
}
}