fix(menu-app): replace EN|ΕΛ pill with a compact globe icon + dropdown
The two-segment language pill sat over the header image/logo area and clipped it. Swapped for a small globe icon button tucked closer to the corner, opening a lightweight dropdown with full language names on tap. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -4,7 +4,7 @@ import {
|
|||||||
Search, Leaf, X, Plus, ShoppingBag,
|
Search, Leaf, X, Plus, ShoppingBag,
|
||||||
ChevronLeft, ArrowRight, Send, Loader2, Info,
|
ChevronLeft, ArrowRight, Send, Loader2, Info,
|
||||||
Armchair, Check, SearchX, UtensilsCrossed, AlertCircle,
|
Armchair, Check, SearchX, UtensilsCrossed, AlertCircle,
|
||||||
Soup, Salad, Wheat, IceCream2, Wine,
|
Soup, Salad, Wheat, IceCream2, Wine, Globe,
|
||||||
} from 'lucide-react'
|
} from 'lucide-react'
|
||||||
import { fetchMenu, submitOrder, CLOUD_URL } from '../api'
|
import { fetchMenu, submitOrder, CLOUD_URL } from '../api'
|
||||||
import {
|
import {
|
||||||
@@ -113,6 +113,53 @@ function SheetHandle() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ── Language Switcher ────────────────────────────────────────────────────────
|
||||||
|
const LANGS = [
|
||||||
|
{ code: 'en', label: 'English' },
|
||||||
|
{ code: 'gr', label: 'Ελληνικά' },
|
||||||
|
]
|
||||||
|
|
||||||
|
function LanguageSwitcher({ lang, setLang }) {
|
||||||
|
const [open, setOpen] = useState(false)
|
||||||
|
const ref = useRef(null)
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!open) return
|
||||||
|
const onClickAway = e => { if (ref.current && !ref.current.contains(e.target)) setOpen(false) }
|
||||||
|
document.addEventListener('mousedown', onClickAway)
|
||||||
|
return () => document.removeEventListener('mousedown', onClickAway)
|
||||||
|
}, [open])
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div ref={ref} className="absolute right-3 top-3 z-20">
|
||||||
|
<button
|
||||||
|
onClick={() => setOpen(o => !o)}
|
||||||
|
aria-label="Change language"
|
||||||
|
className="flex h-8 w-8 items-center justify-center rounded-full bg-white/70 text-[#6d6a59] ring-1 ring-[#e3dcc9] backdrop-blur transition active:scale-95"
|
||||||
|
>
|
||||||
|
<Globe className="h-4 w-4" strokeWidth={1.8} />
|
||||||
|
</button>
|
||||||
|
|
||||||
|
{open && (
|
||||||
|
<div className="absolute right-0 top-10 min-w-[140px] overflow-hidden rounded-2xl bg-[#fcfbf7] py-1.5 shadow-card ring-1 ring-[#e7e1d1]">
|
||||||
|
{LANGS.map(({ code, label }) => (
|
||||||
|
<button
|
||||||
|
key={code}
|
||||||
|
onClick={() => { setLang(code); setOpen(false) }}
|
||||||
|
className={`flex w-full items-center justify-between gap-2 px-3.5 py-2 text-left text-[13px] font-medium transition ${
|
||||||
|
lang === code ? 'text-[#2d3b2d]' : 'text-[#8a8266] hover:text-[#2d3b2d]'
|
||||||
|
}`}
|
||||||
|
>
|
||||||
|
{label}
|
||||||
|
{lang === code && <Check className="h-3.5 w-3.5" strokeWidth={2.4} />}
|
||||||
|
</button>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
// ── Hero ──────────────────────────────────────────────────────────────────────
|
// ── Hero ──────────────────────────────────────────────────────────────────────
|
||||||
function Hero({ lang, setLang, restaurant }) {
|
function Hero({ lang, setLang, restaurant }) {
|
||||||
const name = restaurant?.name || RESTAURANT_FALLBACK.name
|
const name = restaurant?.name || RESTAURANT_FALLBACK.name
|
||||||
@@ -123,22 +170,7 @@ function Hero({ lang, setLang, restaurant }) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<header className="relative px-6 pt-7 pb-6 text-center">
|
<header className="relative px-6 pt-7 pb-6 text-center">
|
||||||
{/* Language toggle */}
|
<LanguageSwitcher lang={lang} setLang={setLang} />
|
||||||
<div className="absolute right-5 top-6">
|
|
||||||
<div className="flex items-center rounded-full bg-white/70 p-0.5 text-[11px] font-semibold ring-1 ring-[#e3dcc9] backdrop-blur">
|
|
||||||
{['en', 'gr'].map(l => (
|
|
||||||
<button
|
|
||||||
key={l}
|
|
||||||
onClick={() => setLang(l)}
|
|
||||||
className={`rounded-full px-2.5 py-1 uppercase tracking-wider transition ${
|
|
||||||
lang === l ? 'bg-[#2d3b2d] text-[#f0e9d6]' : 'text-[#8a8266]'
|
|
||||||
}`}
|
|
||||||
>
|
|
||||||
{l === 'en' ? 'EN' : 'ΕΛ'}
|
|
||||||
</button>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{headerImageUrl ? (
|
{headerImageUrl ? (
|
||||||
<img
|
<img
|
||||||
|
|||||||
Reference in New Issue
Block a user