Skip to content

Commit

Permalink
Add eslint-plugin-prettier and remove extra utils dir
Browse files Browse the repository at this point in the history
  • Loading branch information
mojib2014 committed Jan 28, 2022
1 parent 8fad9d5 commit bd82939
Show file tree
Hide file tree
Showing 8 changed files with 107 additions and 86 deletions.
31 changes: 21 additions & 10 deletions layouts/blogLayout.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import Link from "next/link";
import Layout from "@/components/Layout";
import SectionContainer from "@/components/SectionContainer";
import Card from "@/components/common/Card";
Expand All @@ -13,25 +12,37 @@ export default function BlogLayout({
onChange,
onSubmit,
}) {
const filteredBlogPosts = posts.filter((frontMatter) => {
const searchContent =
frontMatter.title + frontMatter.summary + frontMatter.tags.join(" ");
return searchContent.toLowerCase().includes(query.toLowerCase());
});

// If initialDisplayPosts exist, display it if no searchValue is specified
const displayPosts =
initialDisplayPosts.length > 0 && !query
? initialDisplayPosts
: filteredBlogPosts;

return (
<Layout>
<article className="divide-y pt-90">
<SectionContainer>
<SectionContainer>
<article className="divide-y pt-90 mt-90">
<h1 className="text-3xl font-extrabold leading-9 tracking-tight text-gray-900 dark:text-gray-100 sm:text-4xl sm:leading-10 md:text-6xl md:leading-14">
All Posts
</h1>
<div className="space-x-2 md:space-x-5">
<div className="max-w-">
{posts.map((post) => (
<div className="space-x-2 md:space-x-5 space-y-2 md:space-y-5 lg:grid lg:grid-cols-4 lg:space-y-0 lg:items-baseline">
<div className="space-y-3 xl:col-span-3">
{displayPosts.map((post) => (
<Card key={post.title} item={post} />
))}
</div>
<div className="max-w-md flex flex-col items-center border border-gray p-4">
<dl className="flex flex-col items-center border border-gray p-4">
<Search value={query} onChange={onChange} onSubmit={onSubmit} />
</div>
</dl>
</div>
</SectionContainer>
</article>
</article>
</SectionContainer>
</Layout>
);
}
3 changes: 1 addition & 2 deletions lib/markdownToHtml.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { remark } from "remark";
import html from "remark-html";
import prism from "remark-prism";

export default async function markdownToHtml(markdown) {
const result = await remark().use(html).use(prism).process(markdown);
const result = await remark().use(html).use().process(markdown);
return result.toString();
}
32 changes: 0 additions & 32 deletions lib/utils/files.js

This file was deleted.

14 changes: 0 additions & 14 deletions lib/utils/formatDate.js

This file was deleted.

23 changes: 0 additions & 23 deletions lib/utils/htmlEscaper.js

This file was deleted.

5 changes: 0 additions & 5 deletions lib/utils/kebabCase.js

This file was deleted.

84 changes: 84 additions & 0 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"autoprefixer": "^10.4.2",
"eslint": "8.7.0",
"eslint-config-next": "12.0.8",
"eslint-plugin-prettier": "^4.0.0",
"postcss": "^8.4.5",
"postcss-preset-env": "^7.2.3",
"tailwindcss": "^3.0.17"
Expand Down

1 comment on commit bd82939

@vercel
Copy link

@vercel vercel bot commented on bd82939 Jan 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.