-
-
Notifications
You must be signed in to change notification settings - Fork 215
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Credits component to blog post layout
- Loading branch information
1 parent
f85c152
commit 55828f5
Showing
2 changed files
with
34 additions
and
3 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 |
---|---|---|
@@ -1,27 +1,56 @@ | ||
import { component$, Slot } from '@builder.io/qwik'; | ||
import { useDocumentHead } from '@builder.io/qwik-city'; | ||
import { PostCover, PostMeta } from '~/components'; | ||
import { useDocumentHead, useLocation } from '@builder.io/qwik-city'; | ||
import { Credits, IconButton, PostCover, PostMeta } from '~/components'; | ||
import { PenIcon } from '~/icons'; | ||
|
||
export default component$(() => { | ||
// Use document head and location | ||
const head = useDocumentHead(); | ||
const location = useLocation(); | ||
|
||
return ( | ||
<main class="flex flex-1 justify-center py-12 md:py-20 lg:py-32"> | ||
<main class="flex flex-1 flex-col items-center py-12 md:py-20 lg:py-32"> | ||
{/* Article */} | ||
<article class="flex w-full max-w-screen-xl flex-col space-y-12 md:space-y-20 lg:space-y-24"> | ||
<div class="mx-8 flex max-w-screen-md flex-col space-y-5 md:items-center md:space-y-7 md:self-center lg:mx-10 lg:space-y-9"> | ||
{/* Title */} | ||
<h1 class="text-2xl font-medium leading-normal text-slate-900 md:text-center md:text-3xl md:leading-normal lg:text-4xl lg:leading-normal dark:text-slate-200"> | ||
{head.title} | ||
</h1> | ||
|
||
{/* Meta */} | ||
<PostMeta | ||
variant="post" | ||
authors={head.frontmatter.authors} | ||
published={head.frontmatter.published} | ||
/> | ||
</div> | ||
|
||
{/* Cover */} | ||
<PostCover variant="post" label={head.frontmatter.cover} /> | ||
|
||
{/* Content */} | ||
<div class="mdx flex w-full max-w-screen-lg flex-col lg:self-center"> | ||
<Slot /> | ||
|
||
{/* Edit page buttton */} | ||
<IconButton | ||
class="mx-8 lg:mx-10" | ||
variant="secondary" | ||
type="link" | ||
href={`https://github.com/fabian-hiller/valibot/blob/main/website/src/routes/blog/(posts)${location.url.pathname.slice(5)}index.mdx`} | ||
target="_blank" | ||
label="Edit page" | ||
> | ||
<PenIcon class="h-[18px]" /> | ||
</IconButton> | ||
</div> | ||
</article> | ||
|
||
{/* Credits */} | ||
<div class="w-full max-w-screen-lg"> | ||
<Credits /> | ||
</div> | ||
</main> | ||
); | ||
}); |
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