feat: enhanced cover image

This commit is contained in:
DIYgod
2023-06-08 23:01:57 +01:00
parent 07c4f1d2fa
commit f5f5aca51d
6 changed files with 24 additions and 21 deletions
+3 -3
View File
@@ -45,16 +45,17 @@ const PostCard = ({
target="_blank"
href={`/api/redirection?characterId=${post.characterId}&noteId=${post.noteId}`}
className={cn(
"xlog-post sm:hover:bg-hover transition-all p-4 ml-10 sm:rounded-xl flex flex-col sm:flex-row items-center hover:opacity-100",
"xlog-post sm:hover:bg-hover transition-all p-4 ml-10 sm:rounded-xl flex flex-col sm:flex-row items-center hover:opacity-100 group",
simple && "opacity-90",
isComment ? "bg-zinc-50" : "bg-white",
)}
prefetch={false}
>
{!simple && <PostCover cover={post.metadata?.content.cover} />}
<div className="flex-1 flex justify-center flex-col w-full min-w-0">
<h3
className={cn(
"xlog-post-title font-bold text-zinc-700",
"xlog-post-title font-bold text-zinc-700 line-clamp-2",
simple ? "text-xl" : "text-2xl",
)}
>
@@ -113,7 +114,6 @@ const PostCard = ({
{post.metadata?.content?.summary && "..."}
</div>
</div>
{!simple && <PostCover cover={post.metadata?.content.cover} />}
</Link>
)
}
+8 -8
View File
@@ -5,22 +5,22 @@ export default function PostMeta({ cover }: { cover?: string }) {
return (
<>
<div className="xlog-post-cover hidden sm:flex items-center relative w-28 h-28 ml-4 mt-0">
<div className="xlog-post-cover rounded-2xl overflow-hidden hidden sm:flex items-center relative h-36 aspect-video mr-8 mt-0">
<Image
className="object-cover rounded"
className="object-cover group-hover:scale-105 transition-transform duration-400 ease-in-out"
alt="cover"
src={cover}
width={192}
height={192}
width={256}
height={256}
></Image>
</div>
<div className="xlog-post-cover flex sm:hidden items-center relative w-full h-40 mt-2 sm:ml-4 sm:mt-0">
<div className="xlog-post-cover rounded-2xl overflow-hidden flex sm:hidden items-center relative w-full aspect-video mb-4">
<Image
className="object-cover rounded"
className="object-cover"
alt="cover"
src={cover}
width={350}
height={160}
width={480}
height={270}
></Image>
</div>
</>
+4 -4
View File
@@ -165,7 +165,7 @@ export const SiteHeader = ({ handle }: { handle: string }) => {
<div className="flex py-12 w-full">
<div
className={cn(
"xlog-site-info flex space-x-6 items-center w-full",
"xlog-site-info flex space-x-6 sm:space-x-8 items-center w-full",
site.data?.metadata?.content?.banners?.[0]?.address
? "bg-white bg-opacity-50 backdrop-blur-sm rounded-xl p-4 sm:p-8 z-[1] border"
: "",
@@ -173,15 +173,15 @@ export const SiteHeader = ({ handle }: { handle: string }) => {
>
{site.data?.metadata?.content?.avatars?.[0] && (
<Avatar
className="xlog-site-icon max-w-[80px] max-h-[80px] sm:max-w-none sm:max-h-none"
className="xlog-site-icon max-w-[100px] max-h-[100px] sm:max-w-none sm:max-h-none"
images={site.data?.metadata?.content?.avatars}
size={120}
size={150}
name={site.data?.metadata?.content?.name}
/>
)}
<div className="flex-1 min-w-0 relative">
<div className="flex items-center justify-between">
<h1 className="xlog-site-name text-2xl sm:text-3xl font-bold text-zinc-900 leading-snug break-words min-w-0">
<h1 className="xlog-site-name text-3xl sm:text-4xl font-bold text-zinc-900 leading-snug break-words min-w-0">
{site.data?.metadata?.content?.site_name ||
site.data?.metadata?.content?.name}
</h1>
+3 -3
View File
@@ -50,12 +50,13 @@ export default function SiteHome({ handle }: { handle: string }) {
role="article"
key={post.transactionHash}
href={getSlugUrl(`/${post.metadata?.content?.slug}`)}
className="xlog-post focus-visible:outline focus-visible:outline-accent sm:hover:bg-hover bg-white transition-colors px-5 py-7 -mx-5 first:-mt-5 sm:rounded-xl flex flex-col sm:flex-row items-center"
className="xlog-post focus-visible:outline focus-visible:outline-accent bg-white transition-colors px-5 py-7 -mx-5 first:-mt-5 sm:rounded-xl flex flex-col sm:flex-row items-center group"
suppressHydrationWarning
aria-label={post.metadata?.content?.title}
>
<PostCover cover={post.metadata?.content?.cover} />
<div className="flex-1 flex justify-center flex-col w-full min-w-0">
<h3 className="xlog-post-title text-2xl font-bold text-zinc-700">
<h3 className="xlog-post-title text-2xl font-bold text-zinc-700 line-clamp-2">
{post.metadata?.content?.title}
</h3>
<div className="xlog-post-meta text-sm text-zinc-400 mt-1 space-x-4 flex items-center mr-8">
@@ -113,7 +114,6 @@ export default function SiteHome({ handle }: { handle: string }) {
{post.metadata?.content?.summary && "..."}
</div>
</div>
<PostCover cover={post.metadata?.content?.cover} />
</Link>
)
}),
+3 -3
View File
@@ -52,10 +52,11 @@ export const SiteSearch = () => {
<Link
key={post.noteId}
href={`/${post.metadata.content.slug}`}
className="xlog-post sm:hover:bg-hover bg-white transition-all px-5 py-7 -mx-5 first:-mt-5 sm:rounded-xl flex flex-col sm:flex-row items-center"
className="xlog-post sm:hover:bg-hover bg-white transition-all px-5 py-7 -mx-5 first:-mt-5 sm:rounded-xl flex flex-col sm:flex-row items-center group"
>
<PostCover cover={post.metadata?.content.cover} />
<div className="flex-1 flex justify-center flex-col w-full min-w-0">
<h3 className="xlog-post-title text-2xl font-bold text-zinc-700">
<h3 className="xlog-post-title text-2xl font-bold text-zinc-700 line-clamp-2">
{post.metadata.content.title}
</h3>
<div className="xlog-post-meta text-sm text-zinc-400 mt-1 space-x-4 flex items-center mr-8">
@@ -118,7 +119,6 @@ export const SiteSearch = () => {
{post.metadata.content.summary && "..."}
</div>
</div>
<PostCover cover={post.metadata?.content.cover} />
</Link>
)
}),
+3
View File
@@ -69,6 +69,9 @@ const config: Config = {
animation: {
"buzz-out": "buzz-out .75s linear 1",
},
transitionDuration: {
"400": "400ms",
},
},
},
variants: {},