-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding index page and blogs to projects
- Loading branch information
1 parent
d8d7b9d
commit fe647a9
Showing
7 changed files
with
133 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
--- | ||
import type { CollectionEntry } from "astro:content"; | ||
import { formatDistance, format, parse } from "date-fns"; | ||
interface Props { | ||
blogPost: CollectionEntry<"blogs">; | ||
} | ||
const { blogPost } = Astro.props; | ||
--- | ||
|
||
<div | ||
class="group relative rounded-lg block md:flex items-center bg-gray-100 shadow-xl" | ||
style="min-height: 19rem;" | ||
> | ||
<div | ||
class="relative w-full md:w-2/5 h-full overflow-hidden rounded-t-lg md:rounded-t-none md:rounded-l-lg" | ||
style="min-height: 19rem;" | ||
> | ||
{ | ||
blogPost.data.image ? ( | ||
<img | ||
class="absolute inset-0 w-full h-full object-cover object-center" | ||
src={blogPost.data.image.url} | ||
alt={blogPost.data.image.alt} | ||
/> | ||
) : ( | ||
<div class="absolute inset-0 w-full h-full object-cover object-center bg-gradient-to-tr from-red-200 to-red-500 " /> | ||
) | ||
} | ||
<div | ||
class="absolute flex flex-column items-center justify-center inset-0 w-full h-full bg-slate-900 bg-opacity-75 group-hover:bg-opacity-0 transition" | ||
> | ||
<h1 class="text-white text-2xl">{blogPost.data.title}</h1> | ||
</div> | ||
</div> | ||
<div class="w-full md:w-3/5 h-full flex items-center bg-gray-100 rounded-lg"> | ||
<div class="p-12 md:pr-24 md:pl-16 md:py-12"> | ||
<span class="text-gray-400" | ||
>{new Intl.DateTimeFormat().format(blogPost.data.publish_date)}</span | ||
> | ||
<p class="text-gray-600">{blogPost.data.summary}</p> | ||
<a | ||
class="flex items-baseline mt-3 text-indigo-600 hover:text-indigo-900 focus:text-indigo-900" | ||
href={`/blog/${blogPost.slug}`} | ||
> | ||
<span>Read</span> | ||
<span class="text-xs ml-1">➜</span> | ||
</a> | ||
</div> | ||
<svg | ||
class="hidden md:block absolute inset-y-0 h-full w-24 fill-current text-gray-100 -ml-12" | ||
viewBox="0 0 100 100" | ||
preserveAspectRatio="none" | ||
> | ||
<polygon points="50,0 100,0 50,100 0,100"></polygon> | ||
</svg> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
--- | ||
import { getCollection, getEntry, getEntries } from "astro:content"; | ||
import Base from "../../layouts/Base.astro"; | ||
import PersonLink from "../../components/PersonLink.astro"; | ||
import BlogCard from "../../components/BlogCard.astro"; | ||
const blogs = (await getCollection("blogs")) | ||
.filter((b) => !b.data.draft) | ||
.sort((a, b) => (a.data.publish_date > b.data.publish_date ? 1 : -1)); | ||
const people = await getCollection("people"); | ||
--- | ||
|
||
<Base> | ||
<section class="wrapper style1"> | ||
<div class="container"> | ||
<div class="row gtr-200"> | ||
<div class="col-12 col-12-narrower imp-narrower"> | ||
<div id="content"> | ||
<article> | ||
<header> | ||
<h2>Blogs</h2> | ||
</header> | ||
<section> | ||
<ul> | ||
{blogs.map((b) => <BlogCard blogPost={b} />)} | ||
</ul> | ||
</section> | ||
</article> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</section> | ||
</Base> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters