IMPROVED - Fix dock bar height jump, enlarge icons, refine active state

This commit is contained in:
moh
2026-09-20 19:01:42 +02:00
parent 6c213699a2
commit 6543ccada3
2 changed files with 20 additions and 21 deletions
+19 -20
View File
@@ -186,13 +186,13 @@ export function SiteDock({
> >
<Dock <Dock
direction="bottom" direction="bottom"
iconSize={44} iconSize={50}
iconMagnification={74} iconMagnification={86}
iconDistance={150} iconDistance={160}
className="pointer-events-auto border-border/60 bg-background/70 shadow-panel" className="pointer-events-auto h-[68px] gap-2.5 border-border/60 bg-background/70 shadow-panel"
> >
{/* Logo — first icon in the dock */} {/* Logo — first icon in the dock */}
<DockIcon className="group relative overflow-visible rounded-[30%] border border-border/60 bg-foreground/[0.04]"> <DockIcon className="group relative overflow-visible rounded-[28%] border border-border/60 bg-white shadow-[inset_0_1px_0_rgba(255,255,255,0.5)]">
<Link <Link
href={homeHref} href={homeHref}
aria-label="mohfarawati — Home" aria-label="mohfarawati — Home"
@@ -201,9 +201,9 @@ export function SiteDock({
<Image <Image
src={logoSrc} src={logoSrc}
alt="mohfarawati" alt="mohfarawati"
width={80} width={96}
height={80} height={96}
sizes="80px" sizes="96px"
priority priority
className={cn( className={cn(
"h-full w-full rounded-full object-contain transition-opacity duration-300", "h-full w-full rounded-full object-contain transition-opacity duration-300",
@@ -214,7 +214,7 @@ export function SiteDock({
<DockTip label="mohfarawati" /> <DockTip label="mohfarawati" />
</DockIcon> </DockIcon>
<div className="mx-1 h-8 w-px self-center bg-border/70" aria-hidden /> <div className="mx-0.5 h-9 w-px self-center bg-border/70" aria-hidden />
{navItems.map(({ key, path, Icon, disabled }) => { {navItems.map(({ key, path, Icon, disabled }) => {
const itemPath = path || "/"; const itemPath = path || "/";
@@ -223,7 +223,7 @@ export function SiteDock({
const inner = ( const inner = (
<span className="flex h-full w-full items-center justify-center rounded-[inherit]"> <span className="flex h-full w-full items-center justify-center rounded-[inherit]">
<Icon className="h-[55%] w-[55%]" /> <Icon className="h-[72%] w-[72%]" strokeWidth={1.9} />
</span> </span>
); );
@@ -231,14 +231,20 @@ export function SiteDock({
<DockIcon <DockIcon
key={key} key={key}
className={cn( className={cn(
"group relative overflow-visible rounded-[30%] border transition-colors", "group relative overflow-visible rounded-[28%] border transition-all duration-200",
"shadow-[inset_0_1px_0_rgba(255,255,255,0.12)]",
isActive isActive
? "border-primary/60 bg-primary/10 text-primary" ? "border-primary/50 bg-primary/15 text-primary shadow-[inset_0_1px_0_rgba(255,255,255,0.15),0_0_0_1px_hsl(var(--primary)/0.35),0_10px_24px_-8px_hsl(var(--primary)/0.6)]"
: disabled : disabled
? "border-border/50 bg-foreground/[0.03] text-foreground/35" ? "border-border/50 bg-foreground/[0.03] text-foreground/35"
: "border-border/60 bg-foreground/[0.04] text-foreground/80 hover:text-foreground", : "border-border/60 bg-foreground/[0.05] text-foreground/75 hover:border-border hover:bg-foreground/[0.09] hover:text-foreground",
)} )}
> >
{/* top gloss */}
<span
aria-hidden
className="pointer-events-none absolute inset-0 rounded-[inherit] bg-gradient-to-b from-white/10 to-transparent"
/>
{disabled ? ( {disabled ? (
<span aria-disabled="true" className="flex h-full w-full cursor-not-allowed items-center justify-center"> <span aria-disabled="true" className="flex h-full w-full cursor-not-allowed items-center justify-center">
{inner} {inner}
@@ -255,13 +261,6 @@ export function SiteDock({
)} )}
<DockTip label={label} soon={disabled ? t("soon") : undefined} /> <DockTip label={label} soon={disabled ? t("soon") : undefined} />
{isActive ? (
<span
aria-hidden
className="absolute -bottom-1.5 left-1/2 h-1 w-1 -translate-x-1/2 rounded-full bg-primary"
/>
) : null}
</DockIcon> </DockIcon>
); );
})} })}
+1 -1
View File
@@ -107,7 +107,7 @@ const DockIcon = ({
...props ...props
}: DockIconProps) => { }: DockIconProps) => {
const ref = useRef<HTMLDivElement>(null); const ref = useRef<HTMLDivElement>(null);
const padding = Math.max(6, size * 0.2); const padding = Math.max(4, size * 0.12);
const defaultMouseX = useMotionValue(Infinity); const defaultMouseX = useMotionValue(Infinity);
const distanceCalc = useTransform(mouseX ?? defaultMouseX, (val: number) => { const distanceCalc = useTransform(mouseX ?? defaultMouseX, (val: number) => {