Skip to content

Commit 19eb211

Browse files
committed
refactor: replace old banner image with new asset and update credit information for improved attribution
1 parent 1796094 commit 19eb211

5 files changed

Lines changed: 39 additions & 22 deletions

File tree

src/assets/banner/banner.webp

282 KB
Loading

src/assets/banner/banner_01.webp

-310 KB
Binary file not shown.

src/components/Banner.astro

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -75,24 +75,6 @@ if (!isExternal && src) {
7575
/>
7676
)}
7777

78-
<!-- 版權信息 -->
79-
{showCredit && BANNER_CONFIG.credit.text && (
80-
<a
81-
href={BANNER_CONFIG.credit.url}
82-
id="banner-credit"
83-
target="_blank"
84-
rel="noopener"
85-
aria-label="Visit image source"
86-
class="group absolute flex justify-center items-center rounded-full px-3 right-4 -bottom-[3.25rem] bg-black/60 hover:bg-black/70 h-9 transition-all"
87-
>
88-
<div class="text-white/75 text-xs">{BANNER_CONFIG.credit.text}</div>
89-
{BANNER_CONFIG.credit.url && (
90-
<svg class="ml-1 w-3 h-3 text-white/75 opacity-0 group-hover:opacity-100 transition-opacity" fill="currentColor" viewBox="0 0 24 24">
91-
<path d="M14,3V5H17.59L7.76,14.83L9.17,16.24L19,6.41V10H21V3M19,19H5V5H12V3H5C3.89,3 3,3.9 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V12H19V19Z" />
92-
</svg>
93-
)}
94-
</a>
95-
)}
9678
</div>
9779
</div>
9880
)}

src/config/banner.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export const MAIN_PANEL_OVERLAPS_BANNER_HEIGHT: number = BANNER_HEIGHTS.overlaps
1919
// Banner main configuration
2020
export const BANNER_CONFIG = {
2121
enable: true,
22-
src: "/banner/banner_01.webp",
22+
src: "/banner/banner.webp",
2323
position: "center" as const,
2424
showOnHomePage: true,
2525
showOnOtherPages: true,
@@ -30,8 +30,8 @@ export const BANNER_CONFIG = {
3030
other: BANNER_HEIGHT
3131
},
3232
credit: {
33-
enable: false,
34-
text: "",
35-
url: ""
33+
enable: true,
34+
text: "夏生(なつお)@nathuo101102",
35+
url: "https://x.com/nathuo101102"
3636
}
3737
} as const;

src/layouts/Layout.astro

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,34 @@ const bannerOffset = (() => {
117117
<div class="absolute w-full z-30 pointer-events-none" style={`top: var(--main-panel-top)`}>
118118
<div id="main-grid" class="w-full px-0 grid grid-rows-[1fr_auto] min-h-[calc(100vh-var(--main-panel-top))]">
119119
<div class="relative max-w-[var(--page-width)] mx-auto pointer-events-auto w-full">
120+
121+
<!-- Banner credit -->
122+
{BANNER_CONFIG.enable && BANNER_CONFIG.credit.enable && BANNER_CONFIG.credit.text && (
123+
<a
124+
href={BANNER_CONFIG.credit.url || undefined}
125+
id="banner-credit"
126+
target="_blank"
127+
rel="noopener"
128+
aria-label="Visit image source"
129+
class:list={[
130+
"group onload-animation transition-all absolute flex justify-center items-center rounded-full",
131+
"px-3 right-4 -top-[3.25rem] bg-black/60 hover:bg-black/70 h-9 z-10 pointer-events-auto",
132+
{ "hover:pr-9 active:bg-black/80": !!BANNER_CONFIG.credit.url }
133+
]}
134+
>
135+
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="text-white/75 mr-1 shrink-0">
136+
<circle cx="12" cy="12" r="10"/>
137+
<path d="M14.83 14.83a4 4 0 1 1 0-5.66"/>
138+
</svg>
139+
<div class="text-white/75 text-xs whitespace-nowrap">{BANNER_CONFIG.credit.text}</div>
140+
{BANNER_CONFIG.credit.url && (
141+
<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="currentColor" class="transition absolute right-4 opacity-0 group-hover:opacity-100 text-white/75">
142+
<path d="M14,3V5H17.59L7.76,14.83L9.17,16.24L19,6.41V10H21V3M19,19H5V5H12V3H5C3.89,3 3,3.9 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V12H19V19Z"/>
143+
</svg>
144+
)}
145+
</a>
146+
)}
147+
120148
{hasSidebar ? (
121149
<div class="w-full grid grid-cols-[17.5rem_auto] grid-rows-[auto_1fr_auto] lg:grid-rows-[auto] mx-auto gap-4">
122150
<Aside />
@@ -166,6 +194,9 @@ const bannerOffset = (() => {
166194

167195
.enable-banner #banner {
168196
height: 100%;
197+
transform: translateY(var(--banner-offset));
198+
will-change: transform;
199+
transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
169200
}
170201

171202
#main-grid {
@@ -201,6 +232,10 @@ const bannerOffset = (() => {
201232
transform: translateY(var(--banner-height-extend));
202233
}
203234

235+
body.is-home.enable-banner #banner {
236+
transform: translateY(0);
237+
}
238+
204239
body.is-home.enable-banner #main-grid {
205240
transform: translateY(var(--banner-height-extend));
206241
}

0 commit comments

Comments
 (0)