Skip to content

Commit 7d25f19

Browse files
authored
Refactor some CSS and Layout (#381)
* refactor CSS and Layout * remove unused @tailwindcss/cli
1 parent aec130a commit 7d25f19

8 files changed

Lines changed: 24 additions & 75 deletions

File tree

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
"@iconify-json/simple-icons": "^1.2.69",
4444
"@iconify/svelte": "^4.2.0",
4545
"@swup/astro": "^1.7.0",
46-
"@tailwindcss/cli": "^4.2.0",
4746
"@tailwindcss/typography": "^0.5.19",
4847
"@tailwindcss/vite": "^4.2.0",
4948
"astro": "5.17.1",

pnpm-lock.yaml

Lines changed: 3 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/control/ButtonLink.astro

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ const { badge, url, label } = Astro.props;
3030
</div>
3131
{ badge !== undefined && badge !== null && badge !== '' &&
3232
<div class="transition px-2 h-7 ml-4 min-w-8 rounded-lg text-sm font-bold
33-
text-(--btn-content) dark:!text-(--deep-text)
34-
bg-(--btn-plain-bg-hover) dark:!bg-(--primary)
33+
text-(--btn-content) dark:text-(--deep-text)!
34+
bg-(--btn-plain-bg-hover) dark:bg-(--primary)!
3535
flex items-center justify-center">
3636
{ badge }
3737
</div>

src/components/misc/SharePoster.svelte

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -410,10 +410,10 @@ function portal(node: HTMLElement) {
410410
</button>
411411

412412
{#if showModal}
413-
<div use:portal class="fixed inset-0 z-[9999] flex items-center justify-center bg-black/60 backdrop-blur-sm p-4 transition-opacity" on:click={closeModal}>
414-
<div class="bg-[var(--card-bg)] rounded-2xl max-w-sm w-full max-h-[90vh] overflow-y-auto flex flex-col shadow-2xl transform transition-all" on:click|stopPropagation>
413+
<div use:portal class="fixed inset-0 z-9999 flex items-center justify-center bg-black/60 backdrop-blur-sm p-4 transition-opacity" on:click={closeModal}>
414+
<div class="bg-(--card-bg) rounded-2xl max-w-sm w-full max-h-[90vh] overflow-y-auto flex flex-col shadow-2xl transform transition-all" on:click|stopPropagation>
415415

416-
<div class="p-6 flex justify-center bg-[var(--btn-plain-bg-hover)] min-h-[200px] items-center">
416+
<div class="p-6 flex justify-center bg-(--btn-plain-bg-hover) min-h-[200px] items-center">
417417
{#if posterImage}
418418
<img src={posterImage} alt="Poster" class="max-w-full h-auto shadow-lg rounded-lg" />
419419
{:else}
@@ -426,7 +426,7 @@ function portal(node: HTMLElement) {
426426

427427
<div class="p-4 border-t border-black/5 dark:border-white/10 grid grid-cols-2 gap-3">
428428
<button
429-
class="py-3 bg-[var(--btn-plain-bg-hover)] text-75 rounded-xl font-medium hover:bg-[var(--btn-plain-bg-active)] active:scale-[0.98] transition-all flex items-center justify-center gap-2"
429+
class="py-3 bg-(--btn-plain-bg-hover) text-75 rounded-xl font-medium hover:bg-(--btn-plain-bg-active) active:scale-[0.98] transition-all flex items-center justify-center gap-2"
430430
on:click={copyLink}
431431
>
432432
{#if copied}

src/components/widget/DropdownMenu.astro

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,17 @@ const hasChildren = children.length > 0;
5151
data-dropdown-trigger
5252
>
5353
{link.icon && (
54-
<Icon name={link.icon} class="text-[1.1rem] lg:mr-2 flex-shrink-0" />
54+
<Icon name={link.icon} class="text-[1.1rem] lg:mr-2 shrink-0" />
5555
)}
5656
<span class="truncate hidden lg:inline">{getLocalizedName(link.name)}</span>
5757
<Icon
5858
name="material-symbols:keyboard-arrow-down-rounded"
59-
class="text-[1.25rem] transition-transform duration-200 dropdown-arrow ml-1 flex-shrink-0 hidden lg:inline"
59+
class="text-[1.25rem] transition-transform duration-200 dropdown-arrow ml-1 shrink-0 hidden lg:inline"
6060
/>
6161
</button>
6262

6363
<div class="dropdown-menu" data-dropdown-menu>
64-
<div class="dropdown-content bg-[var(--float-panel-bg)] rounded-[var(--radius-large)] shadow-xl dark:shadow-none border border-black/5 dark:border-white/10 p-2 min-w-[12rem]">
64+
<div class="dropdown-content bg-(--float-panel-bg) rounded-(--radius-large) shadow-xl dark:shadow-none border border-black/5 dark:border-white/10 p-2 min-w-48">
6565
{children.map((child) => (
6666
<a
6767
href={
@@ -73,7 +73,7 @@ const hasChildren = children.length > 0;
7373
? "noopener noreferrer"
7474
: null
7575
}
76-
class="dropdown-item flex items-center justify-between px-4 py-2.5 hover:text-[var(--primary)] hover:bg-[var(--btn-plain-bg-hover)] transition-colors duration-150 font-medium rounded-lg"
76+
class="dropdown-item flex items-center justify-between px-4 py-2.5 hover:text-(--primary) hover:bg-(--btn-plain-bg-hover) transition-colors duration-150 font-medium rounded-lg"
7777
aria-label={child.name}
7878
>
7979
<div class="flex items-center">
@@ -105,13 +105,13 @@ const hasChildren = children.length > 0;
105105
class="btn-plain scale-animation rounded-lg h-11 font-bold w-11 lg:w-auto lg:px-5 active:scale-95 flex items-center justify-center lg:justify-start whitespace-nowrap"
106106
>
107107
{link.icon && (
108-
<Icon name={link.icon} class="text-[1.1rem] lg:mr-2 flex-shrink-0" />
108+
<Icon name={link.icon} class="text-[1.1rem] lg:mr-2 shrink-0" />
109109
)}
110110
<span class="truncate hidden lg:inline">{getLocalizedName(link.name)}</span>
111111
{link.external && (
112112
<Icon
113113
name="fa7-solid:arrow-up-right-from-square"
114-
class="text-[0.875rem] transition -translate-y-[1px] ml-1 text-black/[0.2] dark:text-white/[0.2] flex-shrink-0 hidden lg:inline"
114+
class="text-[0.875rem] transition -translate-y-px ml-1 text-black/20 dark:text-white/20 shrink-0 hidden lg:inline"
115115
/>
116116
)}
117117
</a>

src/layouts/Layout.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ if (siteConfig.font) {
415415
"banner-height": `${BANNER_HEIGHT}vh`,
416416
}}
417417
>
418-
@import "tailwindcss";
418+
@reference "../styles/main.css";
419419

420420
@layer components {
421421
.enable-banner.is-home #banner-wrapper {

src/styles/main.css

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -28,27 +28,8 @@
2828

2929
/* Migrated css */
3030
@utility expand-animation {
31-
position: relative;
32-
z-index: 0;
33-
&::before {
34-
content: '';
35-
position: absolute;
36-
inset: 0;
37-
border-radius: inherit;
38-
scale: 0.85;
39-
z-index: -10;
40-
transition: all 0.15s ease-out;
41-
}
42-
&:hover::before {
43-
background-color: var(--btn-plain-bg-hover);
44-
scale: 1;
45-
}
46-
&:active::before {
47-
background-color: var(--btn-plain-bg-active);
48-
}
49-
&:active {
50-
background: none;
51-
}
31+
@apply relative before:ease-out before:duration-75 before:transition-all active:bg-none hover:before:bg-(--btn-plain-bg-hover) active:before:bg-(--btn-plain-bg-active) z-0
32+
before:absolute before:rounded-[inherit] before:inset-0 before:scale-[0.85] hover:before:scale-100 before:-z-10;
5233
}
5334

5435
/* 导入 ZenMaruGothic-Medium 字体 */

src/styles/photoswipe.css

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,15 @@
22

33
/* PhotoSwipe 按钮样式 */
44
.pswp__button {
5-
transition: all 0.2s ease !important;
6-
background-color: rgba(0, 0, 0, 0.4) !important;
7-
display: flex !important;
8-
align-items: center !important;
9-
justify-content: center !important;
10-
margin-right: 0 !important;
11-
width: 3rem !important;
12-
height: 3rem !important;
5+
@apply transition! bg-black/40! hover:bg-black/50! active:bg-black/60! flex! items-center! justify-center! mr-0! w-12! h-12!;
136
}
14-
.pswp__button:hover {
15-
background-color: rgba(0, 0, 0, 0.5) !important;
16-
}
17-
.pswp__button:active {
18-
background-color: rgba(0, 0, 0, 0.6) !important;
19-
}
20-
.pswp__button--zoom, .pswp__button--close {
21-
margin-top: 1rem !important;
22-
border-radius: 0.75rem !important;
23-
}
24-
.pswp__button--zoom:active, .pswp__button--close:active {
25-
transform: scale(0.9) !important;
7+
.pswp__button--zoom,
8+
.pswp__button--close {
9+
@apply mt-4! rounded-xl! active:scale-90!;
2610
}
2711
.pswp__button--zoom {
28-
margin-right: 0.625rem !important;
12+
@apply mr-2.5!;
2913
}
3014
.pswp__button--close {
31-
margin-right: 1rem !important;
15+
@apply mr-4!;
3216
}

0 commit comments

Comments
 (0)