Skip to content

Commit

Permalink
added follow me and tried to fix import issue on build
Browse files Browse the repository at this point in the history
  • Loading branch information
ajelinek committed Nov 7, 2023
1 parent 512a11d commit 7e7be29
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/components/MediumBlogsDynamic/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default function MediumBlogsDynamic(props: Props) {
<>
<div class={s.header}>
<h2 >Published Blogs</h2>
<input class={s.search} type="search" value={filter()} onInput={(e) => setFilter(e.currentTarget.value)} />
<input class={s.search} type="search" placeholder="filter" value={filter()} onInput={(e) => setFilter(e.currentTarget.value)} />
</div>
{
filteredBlogs().map(post => <Post post={post} />)
Expand Down
10 changes: 7 additions & 3 deletions src/pages/blogs.astro
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
---
import Layout from '@/layouts/Layout.astro'
import { Image } from 'astro:assets'
import GorillaWriting from '@/images/gorilla-writing.jpg'
import MediumBlogs from '@/components/MediumBlogs.astro'
import Layout from '@/layouts/Layout.astro'
---

<Layout title='Blogs'>
Expand All @@ -18,6 +16,12 @@ import MediumBlogs from '@/components/MediumBlogs.astro'
</p>
</div>
</div>
<p>
Don't let your FOMO get the best of you! <a href='https://medium.com/@shadetreeit' target='_blank' class='button'
>Follow me on Medium</a
> and never miss an entry.
</p>

<MediumBlogs />
</Layout>

Expand Down
3 changes: 2 additions & 1 deletion src/store/blogs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
import rss from 'rss-to-json'
//@ts-ignore
const { parse } = rss
// import { parse } from 'rss-to-json'
import dayjs from 'dayjs'
import { sort } from 'fast-sort'
const paragraph = /<p[^>]*>(.*?)<\/p>/i
const imageUrl = /<img[^>]+src="([^">]+)"/i

export async function fetchBlogPosts(): Promise<BlogPost[]> {
const rssJson = await parse('https://medium.com/feed/@shadetreeit')
const posts: BlogPost[] = rssJson.items.map(item => {
const posts: BlogPost[] = rssJson.items.map((item: any) => {
const firstParagraph = item.content.match(paragraph)?.[1]
return {
title: item.title,
Expand Down
1 change: 0 additions & 1 deletion src/types/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

type BlogPost = {
title: string
link: string
Expand Down

0 comments on commit 7e7be29

Please sign in to comment.