Skip to content

Commit e0a9a58

Browse files
committed
🦄 refactor: 移除不必要组件
1 parent f49e820 commit e0a9a58

File tree

18 files changed

+347
-359
lines changed

18 files changed

+347
-359
lines changed

bun.lockb

-38.4 KB
Binary file not shown.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
"tailwind-merge": "^3.0.2"
1616
},
1717
"devDependencies": {
18-
"@tailwindcss/typography": "^0.5.13",
1918
"@tailwindcss/vite": "^4.0.15",
2019
"@types/node": "^22.13.11",
2120
"daisyui": "^5.0.9",

src/app.tsx

Lines changed: 22 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,14 @@ import {
1212
useLocation,
1313
} from '@solidjs/router';
1414
import { createEffect, For, lazy, Suspense } from 'solid-js';
15-
import { Link } from './components/article';
16-
import { Btn } from './components/button';
15+
import { Btn, Link } from './components/button';
1716
import { Icon } from './components/icon';
1817
import { Links } from './ts/enum';
1918
import { hasOwn, locales, setStore, store, t } from './ts/util';
2019
import { map } from './ts/util';
2120
import { navs } from './ts/nav';
2221

23-
function NavToggler() {
22+
function MiniNav() {
2423
return (
2524
<Btn
2625
type="dropdown"
@@ -36,7 +35,11 @@ function NavToggler() {
3635
<For each={e.items}>
3736
{(e) => (
3837
<li>
39-
<Link path={e.path}>{e.text}</Link>
38+
<Link
39+
class="no-underline"
40+
path={e.path}
41+
children={e.text}
42+
/>
4043
</li>
4144
)}
4245
</For>
@@ -47,7 +50,7 @@ function NavToggler() {
4750
</Btn>
4851
);
4952
}
50-
function NavBtns() {
53+
function TopNav() {
5154
return (
5255
<div class="hidden md:flex">
5356
<For each={navs}>
@@ -56,7 +59,7 @@ function NavBtns() {
5659
<For each={e.items}>
5760
{(e) => (
5861
<li>
59-
<Link class="justify-between" path={e.path}>
62+
<Link class="no-underline justify-between" path={e.path}>
6063
<section>
6164
<h2 class="font-bold">{e.text}</h2>
6265
<p>{e.desc}</p>
@@ -74,18 +77,14 @@ function NavBtns() {
7477
</div>
7578
);
7679
}
77-
function NavLinks() {
80+
function FooterNav() {
7881
return (
7982
<For each={navs}>
8083
{(e) => (
81-
<nav>
84+
<nav class="">
8285
<h6 class="footer-title">{e.text}</h6>
8386
<For each={e.items}>
84-
{(e) => (
85-
<A class="link link-hover" href={e.path}>
86-
{e.text}
87-
</A>
88-
)}
87+
{(e) => <Link class="link-hover" path={e.path} children={e.text} />}
8988
</For>
9089
</nav>
9190
)}
@@ -100,16 +99,16 @@ function App(p: RouteSectionProps) {
10099
});
101100
return (
102101
<div class="flex flex-col h-screen">
103-
<nav class="navbar shadow-md">
102+
<nav class="navbar absolute z-1">
104103
<div class="navbar-start">
105-
<NavToggler />
104+
<MiniNav />
106105
<Btn
107106
type="link"
108107
path="/"
109-
class="font-title text-base-content text-lg md:text-2xl"
108+
class="font-title text-lg md:text-2xl"
110109
text={t('logo:bluebones')}
111110
/>
112-
<NavBtns />
111+
<TopNav />
113112
</div>
114113
<div class="navbar-end">
115114
<Btn type="link" path={Links.donate.path}>
@@ -123,12 +122,11 @@ function App(p: RouteSectionProps) {
123122
icon={Links.GitHub.icon}
124123
/>
125124
<Btn type="swap" class="btn-square">
126-
{/*TODO: use store.theme to replace theme controller */}
127125
<input
128126
type="checkbox"
129127
class="theme-controller"
130-
value="dark"
131-
checked={import.meta.env.DEV ? true : store.theme === 'dark'}
128+
value="night"
129+
checked={import.meta.env.DEV ? true : store.theme === 'night'}
132130
/>
133131
<Icon class="swap-on" children={mdiWeatherSunny} />
134132
<Icon class="swap-off" children={mdiWeatherNight} />
@@ -157,19 +155,16 @@ function App(p: RouteSectionProps) {
157155
<main class="flex-1">
158156
<Suspense fallback={<p>Loading...</p>} children={p.children} />
159157
</main>
160-
<footer class="footer sm:footer-horizontal bg-neutral text-neutral-content p-10">
158+
<footer class="footer footer-horizontal sm:footer-vertical footer-center bg-neutral text-neutral-content p-10">
159+
<FooterNav />
161160
<aside>
162161
<Icon
163162
class="invert brightness-0"
164163
size={48}
165164
children="/icon/favicon.ico"
166165
/>
167-
<p>©{new Date().getFullYear()} Bluebones Team</p>
168-
<a href="http://beian.miit.gov.cn/" target="_blank">
169-
赣ICP备2024021771号
170-
</a>
166+
<p>© {new Date().getFullYear()} Bluebones Team</p>
171167
</aside>
172-
<NavLinks />
173168
</footer>
174169
</div>
175170
);
@@ -209,5 +204,5 @@ import.meta.env.DEV
209204
*=+++++%
210205
`,
211206
'color:#03a9f4;',
212-
`\n都来这了,不考虑加入我们吗${window.location.origin}/join`,
207+
`\n都来这了,不考虑加入吗${window.location.origin}/join`,
213208
);

src/components/article.tsx

Lines changed: 0 additions & 58 deletions
This file was deleted.

src/components/block.tsx

Lines changed: 0 additions & 44 deletions
This file was deleted.

src/components/button.tsx

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,22 @@
1-
import { createMemo, JSX } from 'solid-js';
1+
import { A } from '@solidjs/router';
2+
import { createMemo, For, JSX } from 'solid-js';
23
import { twMerge } from 'tailwind-merge';
3-
import { Link } from './article';
44
import { Icon } from './icon';
55

6-
type CommonProps = {
7-
class: string;
8-
text: string;
9-
icon: string;
10-
onClick: (e: MouseEvent) => void;
11-
children: JSX.Element;
12-
};
6+
export function Link(p: {
7+
path: string;
8+
class?: string;
9+
children?: JSX.Element;
10+
}) {
11+
return (
12+
<A
13+
class={twMerge('link', p.class)}
14+
href={p.path}
15+
target={p.path.startsWith('http') ? '_blank' : '_self'}
16+
children={p.children}
17+
/>
18+
);
19+
}
1320
export function Btn<
1421
T extends 'button' | 'link' | 'swap' | 'dropdown' = 'button',
1522
>(
@@ -18,11 +25,17 @@ export function Btn<
1825
type: T;
1926
path: T extends 'link' ? string : never;
2027
dropdownClass: T extends 'dropdown' ? string : never;
21-
} & CommonProps
28+
} & {
29+
class: string;
30+
text: string;
31+
icon: string;
32+
onClick: (e: MouseEvent) => void;
33+
children: JSX.Element;
34+
}
2235
>,
2336
) {
2437
const shared = createMemo(() => ({
25-
class: twMerge('btn btn-ghost', p.class),
38+
class: twMerge('btn btn-ghost no-underline', p.class),
2639
onClick: p.onClick,
2740
}));
2841
const children = () => [p.icon && <Icon children={p.icon} />, p.text];
@@ -71,3 +84,10 @@ export function Btn<
7184
}
7285
return `unsupported button type: ${p.type}`;
7386
}
87+
export function BtnGroup(p: { items: Props<typeof Btn>[] }) {
88+
return (
89+
<div class="flex justify-center md:justify-start gap-3">
90+
<For each={p.items}>{(e) => <Btn {...e} />}</For>
91+
</div>
92+
);
93+
}

src/components/multi-lines.tsx

Lines changed: 0 additions & 14 deletions
This file was deleted.

src/components/redirect.tsx

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)