forked from piotrkulpinski/openalternative
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update styles and finish blog templates
- Loading branch information
1 parent
e747e72
commit 5d18be2
Showing
10 changed files
with
172 additions
and
53 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
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 |
---|---|---|
@@ -1,6 +1,24 @@ | ||
import type { HTMLAttributes } from "react" | ||
import { cx } from "~/utils/cva" | ||
import { cva, cx, VariantProps } from "~/utils/cva" | ||
|
||
export const Grid = ({ className, ...props }: HTMLAttributes<HTMLElement>) => { | ||
return <div className={cx("grid-auto-fill-md grid gap-5", className)} {...props} /> | ||
const gridVariants = cva({ | ||
base: "grid gap-5", | ||
|
||
variants: { | ||
size: { | ||
sm: "grid-auto-fill-sm", | ||
md: "grid-auto-fill-md", | ||
lg: "grid-auto-fill-lg", | ||
}, | ||
}, | ||
|
||
defaultVariants: { | ||
size: "md", | ||
}, | ||
}) | ||
|
||
type GridProps = Omit<HTMLAttributes<HTMLElement>, "size"> & VariantProps<typeof gridVariants> | ||
|
||
export const Grid = ({ className, size, ...props }: GridProps) => { | ||
return <div className={cx(gridVariants({ size, className }))} {...props} /> | ||
} |
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,56 @@ | ||
import { Link, unstable_useViewTransitionState } from "@remix-run/react" | ||
import type { HTMLAttributes } from "react" | ||
import { Card } from "../Card" | ||
import { H4 } from "../Heading" | ||
import { Post } from "content-collections" | ||
import { formatDate } from "@curiousleaf/utils" | ||
|
||
type PostRecordProps = HTMLAttributes<HTMLElement> & { | ||
post: Post | ||
} | ||
|
||
export const PostRecord = ({ className, post, ...props }: PostRecordProps) => { | ||
const to = `/blog/${post._meta.path}` | ||
const vt = unstable_useViewTransitionState(to) | ||
|
||
return ( | ||
<Card style={{ viewTransitionName: vt ? `post-${post._meta.path}` : undefined }} asChild> | ||
<Link to={to} prefetch="intent" unstable_viewTransition {...props}> | ||
<Card.Header> | ||
<H4 | ||
as="h3" | ||
className="!leading-snug" | ||
style={{ viewTransitionName: vt ? `post-${post._meta.path}-title` : undefined }} | ||
> | ||
{post.title} | ||
</H4> | ||
</Card.Header> | ||
|
||
{post.description && ( | ||
<Card.Description | ||
style={{ viewTransitionName: vt ? `post-${post._meta.path}-description` : undefined }} | ||
> | ||
{post.description} | ||
</Card.Description> | ||
)} | ||
|
||
{post.datePublished && ( | ||
<Card.Footer | ||
style={{ viewTransitionName: vt ? `post-${post._meta.path}-date` : undefined }} | ||
> | ||
<time dateTime={post.datePublished}>{formatDate(new Date(post.datePublished))}</time> | ||
</Card.Footer> | ||
)} | ||
|
||
{post.image && ( | ||
<img | ||
src={post.image} | ||
alt="" | ||
className="-m-5 mt-0 w-[calc(100%+2.5rem)] max-w-none" | ||
style={{ viewTransitionName: vt ? `post-${post._meta.path}-image` : undefined }} | ||
/> | ||
)} | ||
</Link> | ||
</Card> | ||
) | ||
} |
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