feat(nav): mobile bottom tab bar and ≥44px logo tap target
Build and Push Docker Images / Build Backend (FastAPI) (push) Successful in 49s
Build and Push Docker Images / Build Frontend (Next.js) (push) Successful in 56s
Build and Push Docker Images / Build Pipeline (Meltano + dbt + Airflow) (push) Successful in 2m6s
Build and Push Docker Images / Trigger Portainer Update (push) Successful in 0s
Build and Push Docker Images / Build Backend (FastAPI) (push) Successful in 49s
Build and Push Docker Images / Build Frontend (Next.js) (push) Successful in 56s
Build and Push Docker Images / Build Pipeline (Meltano + dbt + Airflow) (push) Successful in 2m6s
Build and Push Docker Images / Trigger Portainer Update (push) Successful in 0s
MOB-01: At ≤640px the top inline nav is hidden and replaced by a fixed bottom tab bar (Search / Compare / Rankings / Admissions) with icon + label, 56px tap targets, env(safe-area-inset-bottom) padding, and the Compare count rendered as a badge on the icon. Eliminates horizontal page overflow on every route (docW was 401–429 at vw 390; now docW === vw). MOB-02: Logo link gains a padded hit area so the touch target is ≥44×44 (was 36×36), without resizing the visual mark. ComparisonToast lifted above the new bottom bar on mobile so the two do not stack on top of each other. body gets a bottom padding equal to the bar height + safe-area inset so page content is never hidden. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -95,6 +95,13 @@ body {
|
|||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Reserve space for the fixed mobile bottom tab bar (56px + safe-area inset). */
|
||||||
|
@media (max-width: 640px) {
|
||||||
|
body {
|
||||||
|
padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Skip link — visible only on focus for keyboard users */
|
/* Skip link — visible only on focus for keyboard users */
|
||||||
.skip-link {
|
.skip-link {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|||||||
@@ -169,8 +169,9 @@
|
|||||||
|
|
||||||
@media (max-width: 640px) {
|
@media (max-width: 640px) {
|
||||||
.toastContainer {
|
.toastContainer {
|
||||||
bottom: 1.5rem;
|
/* Sit above the fixed bottom tab bar (56px + safe-area inset) */
|
||||||
width: calc(100% - 3rem);
|
bottom: calc(56px + env(safe-area-inset-bottom, 0px) + 0.75rem);
|
||||||
|
width: calc(100% - 2rem);
|
||||||
}
|
}
|
||||||
|
|
||||||
.toastContent {
|
.toastContent {
|
||||||
|
|||||||
@@ -21,11 +21,15 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 0.75rem;
|
gap: 0.75rem;
|
||||||
|
/* Padded hit area so the logo link is ≥44×44 on touch */
|
||||||
|
margin: -0.375rem -0.5rem;
|
||||||
|
padding: 0.375rem 0.5rem;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
color: var(--text-primary, #1a1612);
|
color: var(--text-primary, #1a1612);
|
||||||
font-size: 1.25rem;
|
font-size: 1.25rem;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
transition: color 0.2s ease;
|
transition: color 0.2s ease;
|
||||||
|
-webkit-tap-highlight-color: transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
.logo:hover {
|
.logo:hover {
|
||||||
@@ -33,11 +37,17 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.logoIcon {
|
.logoIcon {
|
||||||
|
display: inline-flex;
|
||||||
width: 36px;
|
width: 36px;
|
||||||
height: 36px;
|
height: 36px;
|
||||||
color: var(--accent-coral, #e07256);
|
color: var(--accent-coral, #e07256);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.logoIcon svg {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
.logoText {
|
.logoText {
|
||||||
font-family: var(--font-playfair), 'Playfair Display', serif;
|
font-family: var(--font-playfair), 'Playfair Display', serif;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
@@ -126,21 +136,102 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 640px) {
|
/* ─── Bottom tab bar (mobile only) ──────────────────────────────── */
|
||||||
.container {
|
|
||||||
padding: 0 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.logoText {
|
.bottomBar {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.nav {
|
.tab {
|
||||||
gap: 0.25rem;
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 0.2rem;
|
||||||
|
flex: 1;
|
||||||
|
min-height: 56px;
|
||||||
|
padding: 0.375rem 0.25rem;
|
||||||
|
color: var(--text-secondary, #5c564d);
|
||||||
|
text-decoration: none;
|
||||||
|
font-size: 0.6875rem;
|
||||||
|
font-weight: 500;
|
||||||
|
letter-spacing: 0.01em;
|
||||||
|
transition: color 0.15s ease, background-color 0.15s ease;
|
||||||
|
-webkit-tap-highlight-color: transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
.navLink {
|
.tab:active {
|
||||||
padding: 0.5rem 0.75rem;
|
background: var(--bg-secondary, #f3ede4);
|
||||||
font-size: 0.875rem;
|
}
|
||||||
|
|
||||||
|
.tabActive {
|
||||||
|
color: var(--accent-coral, #e07256);
|
||||||
|
}
|
||||||
|
|
||||||
|
.tabIconWrap {
|
||||||
|
position: relative;
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 24px;
|
||||||
|
height: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tabIcon {
|
||||||
|
width: 22px;
|
||||||
|
height: 22px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tabLabel {
|
||||||
|
line-height: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tabBadge {
|
||||||
|
position: absolute;
|
||||||
|
top: -6px;
|
||||||
|
right: -10px;
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
min-width: 18px;
|
||||||
|
height: 18px;
|
||||||
|
padding: 0 5px;
|
||||||
|
font-size: 0.6875rem;
|
||||||
|
font-weight: 700;
|
||||||
|
color: white;
|
||||||
|
background: var(--accent-coral, #e07256);
|
||||||
|
border: 2px solid var(--bg-card, white);
|
||||||
|
border-radius: 9999px;
|
||||||
|
animation: badgePop 0.3s ease-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 640px) {
|
||||||
|
.container {
|
||||||
|
padding: 0 1rem;
|
||||||
|
height: 56px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Hide the top text nav; the bottom bar takes over */
|
||||||
|
.nav {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.logoIcon {
|
||||||
|
width: 32px;
|
||||||
|
height: 32px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bottomBar {
|
||||||
|
display: flex;
|
||||||
|
position: fixed;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
z-index: 1000;
|
||||||
|
background: var(--bg-card, white);
|
||||||
|
border-top: 1px solid var(--border-color, #e5dfd5);
|
||||||
|
box-shadow: 0 -2px 12px rgba(26, 22, 18, 0.06);
|
||||||
|
/* Respect iPhone home-indicator inset */
|
||||||
|
padding-bottom: env(safe-area-inset-bottom, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Navigation Component
|
* Navigation Component
|
||||||
* Main navigation header with active link highlighting
|
* Top header nav for desktop; bottom tab bar for mobile (≤640px).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'use client';
|
'use client';
|
||||||
@@ -10,63 +10,116 @@ import { usePathname } from 'next/navigation';
|
|||||||
import { useComparison } from '@/hooks/useComparison';
|
import { useComparison } from '@/hooks/useComparison';
|
||||||
import styles from './Navigation.module.css';
|
import styles from './Navigation.module.css';
|
||||||
|
|
||||||
|
type IconProps = { className?: string };
|
||||||
|
|
||||||
|
const SearchIcon = ({ className }: IconProps) => (
|
||||||
|
<svg className={className} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
|
||||||
|
<circle cx="11" cy="11" r="7" />
|
||||||
|
<path d="m20 20-3.5-3.5" />
|
||||||
|
</svg>
|
||||||
|
);
|
||||||
|
|
||||||
|
const CompareIcon = ({ className }: IconProps) => (
|
||||||
|
<svg className={className} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
|
||||||
|
<path d="M4 7h13l-3-3" />
|
||||||
|
<path d="M20 17H7l3 3" />
|
||||||
|
</svg>
|
||||||
|
);
|
||||||
|
|
||||||
|
const RankingsIcon = ({ className }: IconProps) => (
|
||||||
|
<svg className={className} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
|
||||||
|
<path d="M7 21V11" />
|
||||||
|
<path d="M12 21V4" />
|
||||||
|
<path d="M17 21v-7" />
|
||||||
|
</svg>
|
||||||
|
);
|
||||||
|
|
||||||
|
const AdmissionsIcon = ({ className }: IconProps) => (
|
||||||
|
<svg className={className} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
|
||||||
|
<rect x="3" y="5" width="18" height="16" rx="2" />
|
||||||
|
<path d="M3 10h18M8 3v4M16 3v4" />
|
||||||
|
</svg>
|
||||||
|
);
|
||||||
|
|
||||||
export function Navigation() {
|
export function Navigation() {
|
||||||
const pathname = usePathname();
|
const pathname = usePathname();
|
||||||
const { selectedSchools } = useComparison();
|
const { selectedSchools } = useComparison();
|
||||||
|
|
||||||
const isActive = (path: string) => {
|
const isActive = (path: string) => {
|
||||||
if (path === '/') {
|
if (path === '/') return pathname === '/';
|
||||||
return pathname === '/';
|
|
||||||
}
|
|
||||||
return pathname.startsWith(path);
|
return pathname.startsWith(path);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const items = [
|
||||||
|
{ href: '/', label: 'Search', Icon: SearchIcon },
|
||||||
|
{ href: '/compare', label: 'Compare', Icon: CompareIcon },
|
||||||
|
{ href: '/rankings', label: 'Rankings', Icon: RankingsIcon },
|
||||||
|
{ href: '/admissions', label: 'Admissions', Icon: AdmissionsIcon },
|
||||||
|
] as const;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
<>
|
||||||
<header className={styles.header}>
|
<header className={styles.header}>
|
||||||
<div className={styles.container}>
|
<div className={styles.container}>
|
||||||
<Link href="/" className={styles.logo}>
|
<Link href="/" className={styles.logo} aria-label="SchoolCompare home">
|
||||||
<div className={styles.logoIcon}>
|
<span className={styles.logoIcon}>
|
||||||
<svg viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
|
<svg viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
|
||||||
<circle cx="20" cy="20" r="18" stroke="currentColor" strokeWidth="2" />
|
<circle cx="20" cy="20" r="18" stroke="currentColor" strokeWidth="2" />
|
||||||
<path d="M20 6L20 34M8 14L32 14M6 20L34 20M8 26L32 26" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" />
|
<path d="M20 6L20 34M8 14L32 14M6 20L34 20M8 26L32 26" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" />
|
||||||
<circle cx="20" cy="20" r="3" fill="currentColor" />
|
<circle cx="20" cy="20" r="3" fill="currentColor" />
|
||||||
</svg>
|
</svg>
|
||||||
</div>
|
</span>
|
||||||
<span className={styles.logoText}>SchoolCompare</span>
|
<span className={styles.logoText}>SchoolCompare</span>
|
||||||
</Link>
|
</Link>
|
||||||
|
|
||||||
<nav className={styles.nav} aria-label="Main navigation">
|
<nav className={styles.nav} aria-label="Main navigation">
|
||||||
|
{items.map(({ href, label }) => {
|
||||||
|
const active = isActive(href);
|
||||||
|
const showBadge = href === '/compare' && selectedSchools.length > 0;
|
||||||
|
return (
|
||||||
<Link
|
<Link
|
||||||
href="/"
|
key={href}
|
||||||
className={isActive('/') ? `${styles.navLink} ${styles.active}` : styles.navLink}
|
href={href}
|
||||||
|
className={active ? `${styles.navLink} ${styles.active}` : styles.navLink}
|
||||||
|
aria-current={active ? 'page' : undefined}
|
||||||
>
|
>
|
||||||
Search
|
{label}
|
||||||
</Link>
|
{showBadge && (
|
||||||
<Link
|
|
||||||
href="/compare"
|
|
||||||
className={isActive('/compare') ? `${styles.navLink} ${styles.active}` : styles.navLink}
|
|
||||||
>
|
|
||||||
Compare
|
|
||||||
{selectedSchools.length > 0 && (
|
|
||||||
<span key={selectedSchools.length} className={styles.badge}>
|
<span key={selectedSchools.length} className={styles.badge}>
|
||||||
{selectedSchools.length}
|
{selectedSchools.length}
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
</Link>
|
</Link>
|
||||||
<Link
|
);
|
||||||
href="/rankings"
|
})}
|
||||||
className={isActive('/rankings') ? `${styles.navLink} ${styles.active}` : styles.navLink}
|
|
||||||
>
|
|
||||||
Rankings
|
|
||||||
</Link>
|
|
||||||
<Link
|
|
||||||
href="/admissions"
|
|
||||||
className={isActive('/admissions') ? `${styles.navLink} ${styles.active}` : styles.navLink}
|
|
||||||
>
|
|
||||||
Admissions
|
|
||||||
</Link>
|
|
||||||
</nav>
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
|
<nav className={styles.bottomBar} aria-label="Main navigation">
|
||||||
|
{items.map(({ href, label, Icon }) => {
|
||||||
|
const active = isActive(href);
|
||||||
|
const showBadge = href === '/compare' && selectedSchools.length > 0;
|
||||||
|
return (
|
||||||
|
<Link
|
||||||
|
key={href}
|
||||||
|
href={href}
|
||||||
|
className={active ? `${styles.tab} ${styles.tabActive}` : styles.tab}
|
||||||
|
aria-current={active ? 'page' : undefined}
|
||||||
|
>
|
||||||
|
<span className={styles.tabIconWrap}>
|
||||||
|
<Icon className={styles.tabIcon} />
|
||||||
|
{showBadge && (
|
||||||
|
<span key={selectedSchools.length} className={styles.tabBadge} aria-label={`${selectedSchools.length} selected`}>
|
||||||
|
{selectedSchools.length}
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
</span>
|
||||||
|
<span className={styles.tabLabel}>{label}</span>
|
||||||
|
</Link>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</nav>
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user