Skip to content

Commit 425c39b

Browse files
committed
refactor(ui): Simplify header layout and repo info display
1 parent 06ce3ac commit 425c39b

1 file changed

Lines changed: 10 additions & 28 deletions

File tree

src/layout/components/Header.tsx

Lines changed: 10 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,22 @@ import {LogoIcon} from '@/components/LogoIcon'
55
import {SettingButton} from '@/components/SettingButton'
66

77
import {useRepoStore} from '@/stores/repoStore'
8-
import {cn} from '@/utils'
98

109
function HomeButton() {
1110
return (
12-
<NavLink
13-
to="/"
14-
aria-label="Home"
15-
className="flex items-center gap-1 h-full w-fit text-2xl select-none">
16-
<LogoIcon strokeWidth={3} className="size-8 min-w-8" />
17-
<span className="font-bold">Github</span>
18-
<span className="text-card-foreground">resource</span>
11+
<NavLink to="/" aria-label="Home Button" className="select-none">
12+
<LogoIcon className="size-8" />
1913
</NavLink>
2014
)
2115
}
2216

23-
function RepoInfo({className}: {className?: string}) {
17+
function RepoInfo(props: React.ComponentProps<'div'>) {
2418
const repo = useRepoStore(state => state.repo)
2519

2620
if (!repo.owner) return null
2721

2822
return (
29-
<div className={className}>
23+
<div {...props}>
3024
<a
3125
href={repo.url}
3226
target="_blank"
@@ -38,30 +32,18 @@ function RepoInfo({className}: {className?: string}) {
3832
)
3933
}
4034

41-
export default function Header(
42-
props: Omit<React.ComponentProps<'header'>, 'ref' | 'className'>,
43-
) {
35+
export default function Header(props: React.ComponentProps<'header'>) {
4436
return (
4537
<FloatingHeader
4638
data-slot="header"
4739
className="w-full border-b border-border/40 bg-background/80 backdrop-blur-lg"
4840
{...props}>
49-
<div
50-
data-slot="header"
51-
className={cn(
52-
'flex flex-col',
53-
'w-full max-w-7xl group-[wide]:max-w-full h-full mx-auto py-2 px-4 sm:px-6',
54-
)}>
55-
<div className="flex items-center justify-between min-h-10">
56-
<div data-slot="header-title" className="flex-1 items-center">
57-
<HomeButton />
58-
</div>
59-
<div data-slot="header-side" className="flex items-center gap-4">
60-
<RepoInfo className="hidden md:block" />
61-
<SettingButton />
62-
</div>
41+
<div className="flex flex-row justify-between w-full max-w-7xl min-h-10 mx-auto py-2 px-4 sm:px-6">
42+
<div className="flex-1 flex flex-row flex-wrap justify-between items-center gap-2 mr-2">
43+
<HomeButton />
44+
<RepoInfo />
6345
</div>
64-
<RepoInfo className="md:hidden pb-1" />
46+
<SettingButton />
6547
</div>
6648
</FloatingHeader>
6749
)

0 commit comments

Comments
 (0)