mirror of
https://github.com/m1ngsama/FUJI.git
synced 2025-12-24 10:51:27 +00:00
fix cover
This commit is contained in:
parent
2e17ae669f
commit
bd17ed0102
4 changed files with 76 additions and 49 deletions
|
|
@ -182,7 +182,7 @@ export default defineConfig({
|
|||
markdown: {
|
||||
rehypePlugins: pipeline(),
|
||||
syntaxHighlight: "prism",
|
||||
},
|
||||
},
|
||||
integrations: [
|
||||
vue(),
|
||||
tailwind(),
|
||||
|
|
|
|||
|
|
@ -5,32 +5,36 @@ const { title, href, cover, tags, date } = Astro.props
|
|||
const dateFormatted = formatDate(date)
|
||||
const type = tags?.[0] ?? "默认"
|
||||
|
||||
const image = cover ? cover : "https://oss.nbtca.space/CA-logo.svg"
|
||||
let image: string
|
||||
= cover?.url ?? cover ?? "https://oss.nbtca.space/CA-logo.svg"
|
||||
if (image.startsWith("./")) {
|
||||
image = `./${href}${image.slice(1)}`
|
||||
}
|
||||
|
||||
const label = `${title} - ${type} - 发表时间 ${dateFormatted}`
|
||||
const label = `${title} - ${type} - 发表时间 ${dateFormatted}`;
|
||||
---
|
||||
|
||||
<li
|
||||
role="listitem"
|
||||
class="tile-item item-list nr-scroll-animation"
|
||||
style="--nr-animation-transform-y:20%;"
|
||||
<li
|
||||
role="listitem"
|
||||
class="tile-item item-list nr-scroll-animation"
|
||||
style="--nr-animation-transform-y:20%;"
|
||||
>
|
||||
<a
|
||||
href={href}
|
||||
class="tile tile-list medium-load small-load large-load"
|
||||
aria-label={label}
|
||||
>
|
||||
<a
|
||||
href={href}
|
||||
class="tile tile-list medium-load small-load large-load"
|
||||
aria-label={label}
|
||||
>
|
||||
<div class="tile__media" aria-hidden="true">
|
||||
<img class="cover image" src={image} alt="lt" />
|
||||
<div class="tile__media" aria-hidden="true">
|
||||
<img class="cover image" src={image} alt="lt" />
|
||||
</div>
|
||||
<div class="tile__description" aria-hidden="true">
|
||||
<div class="tile__head">
|
||||
<div class="tile__category">{type}</div>
|
||||
<div class="tile__headline">{title}</div>
|
||||
</div>
|
||||
<div class="tile__description" aria-hidden="true">
|
||||
<div class="tile__head">
|
||||
<div class="tile__category">{type}</div>
|
||||
<div class="tile__headline">{title}</div>
|
||||
</div>
|
||||
<div class="tile__timestamp icon-hide icon icon-before icon-clock">
|
||||
{dateFormatted}
|
||||
</div>
|
||||
<div class="tile__timestamp icon-hide icon icon-before icon-clock">
|
||||
{dateFormatted}
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
|
|
|
|||
|
|
@ -4,32 +4,54 @@ const { title, href, cover, tags, date, level } = Astro.props
|
|||
|
||||
const dateFormatted = formatDate(date)
|
||||
const type = tags[0]
|
||||
const label = `${title} - ${type} - 发表时间 ${dateFormatted}`;
|
||||
const label = `${title} - ${type} - 发表时间 ${dateFormatted}`
|
||||
const image = cover?.url ?? cover ?? "https://oss.nbtca.space/CA-logo.svg";
|
||||
|
||||
// level 1: hero
|
||||
// level 2: 2up
|
||||
// level 3: 3up
|
||||
---
|
||||
|
||||
<li
|
||||
role="listitem"
|
||||
class:list={["tile-item", "nr-scroll-animation", { "item-hero": level === "1", "item-2up": level === "2", "item-3up": level === "3" }]}
|
||||
style="--nr-animation-transform-y:20%;"
|
||||
<li
|
||||
role="listitem"
|
||||
class:list={[
|
||||
"tile-item",
|
||||
"nr-scroll-animation",
|
||||
{
|
||||
"item-hero": level === "1",
|
||||
"item-2up": level === "2",
|
||||
"item-3up": level === "3",
|
||||
},
|
||||
]}
|
||||
style="--nr-animation-transform-y:20%;"
|
||||
>
|
||||
<a
|
||||
href={href}
|
||||
class:list={[
|
||||
"tile",
|
||||
"large-load",
|
||||
"medium-load",
|
||||
"small-load",
|
||||
{
|
||||
"tile-hero": level === "1",
|
||||
"tile-2up": level === "2",
|
||||
"tile-3up": level === "3",
|
||||
},
|
||||
]}
|
||||
aria-label={label}
|
||||
>
|
||||
<a
|
||||
href={href}
|
||||
class:list={["tile", "large-load", "medium-load", "small-load", { "tile-hero": level === "1", "tile-2up": level === "2", "tile-3up": level === "3" }]}
|
||||
aria-label={label}
|
||||
>
|
||||
<div class="tile__media" aria-hidden="true">
|
||||
<img class="cover image" src={cover} alt="lt" />
|
||||
</div>
|
||||
<div class="tile__media" aria-hidden="true">
|
||||
<img class="cover image" src={image} alt="lt" />
|
||||
</div>
|
||||
|
||||
<div class="tile__description" aria-hidden="true">
|
||||
<div class="tile__head">
|
||||
<div class="tile__category">{type}</div>
|
||||
<div class="tile__headline">{title}</div>
|
||||
</div>
|
||||
<div class="tile__timestamp icon-hide icon icon-before icon-clock">{dateFormatted}</div>
|
||||
<div class="tile__description" aria-hidden="true">
|
||||
<div class="tile__head">
|
||||
<div class="tile__category">{type}</div>
|
||||
<div class="tile__headline">{title}</div>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
<div class="tile__timestamp icon-hide icon icon-before icon-clock">
|
||||
{dateFormatted}
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ Blogs.sort(
|
|||
href={post.url}
|
||||
date={post.frontmatter.pubDate}
|
||||
tags={post.frontmatter.tags}
|
||||
cover={post.frontmatter.cover.url}
|
||||
cover={post.frontmatter.cover}
|
||||
level="1"
|
||||
/>
|
||||
)
|
||||
|
|
@ -44,7 +44,7 @@ Blogs.sort(
|
|||
href={post.url}
|
||||
date={post.frontmatter.pubDate}
|
||||
tags={post.frontmatter.tags}
|
||||
cover={post.frontmatter.cover.url}
|
||||
cover={post.frontmatter.cover}
|
||||
level="2"
|
||||
/>
|
||||
)
|
||||
|
|
@ -60,7 +60,7 @@ Blogs.sort(
|
|||
href={post.url}
|
||||
date={post.frontmatter.pubDate}
|
||||
tags={post.frontmatter.tags}
|
||||
cover={post.frontmatter.cover.url}
|
||||
cover={post.frontmatter.cover}
|
||||
level="3"
|
||||
/>
|
||||
)
|
||||
|
|
@ -84,7 +84,7 @@ Blogs.sort(
|
|||
href={post.url}
|
||||
date={post.frontmatter.pubDate}
|
||||
tags={post.frontmatter.tags}
|
||||
cover={post.frontmatter.cover.url}
|
||||
cover={post.frontmatter.cover}
|
||||
/>
|
||||
)
|
||||
})
|
||||
|
|
@ -97,6 +97,7 @@ Blogs.sort(
|
|||
href={post.url}
|
||||
date={post.frontmatter.pubDate}
|
||||
tags={post.frontmatter.tags}
|
||||
cover={post.frontmatter.cover}
|
||||
/>
|
||||
)
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in a new issue