feat: build IPTEK company website with full bilingual support
- Complete Next.js 16 app with App Router: Home, About, Products, Contact, Privacy pages - Product detail pages: ZappCare, Unified TMS, EMR Clinic - Bilingual support (Indonesian/English) via LanguageContext + translations.ts - Language switcher pill button (🇮🇩 ID / 🇬🇧 EN) in Navbar with localStorage persistence - Navbar with logo, responsive mobile menu, translated nav links - Contact form with captcha, server action email sending, translated labels - Material Design 3 color tokens, Manrope + Inter fonts, Material Symbols icons - Local product image assets and company logo Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
32
context/LanguageContext.tsx
Normal file
32
context/LanguageContext.tsx
Normal file
@ -0,0 +1,32 @@
|
||||
"use client";
|
||||
|
||||
import { createContext, useContext, useState, useEffect } from "react";
|
||||
|
||||
export type Lang = "id" | "en";
|
||||
|
||||
const LanguageContext = createContext<{
|
||||
lang: Lang;
|
||||
setLang: (l: Lang) => void;
|
||||
}>({ lang: "id", setLang: () => {} });
|
||||
|
||||
export function LanguageProvider({ children }: { children: React.ReactNode }) {
|
||||
const [lang, setLangState] = useState<Lang>("id");
|
||||
|
||||
useEffect(() => {
|
||||
const stored = localStorage.getItem("iptek-lang") as Lang | null;
|
||||
if (stored === "id" || stored === "en") setLangState(stored);
|
||||
}, []);
|
||||
|
||||
const setLang = (l: Lang) => {
|
||||
setLangState(l);
|
||||
localStorage.setItem("iptek-lang", l);
|
||||
};
|
||||
|
||||
return (
|
||||
<LanguageContext.Provider value={{ lang, setLang }}>
|
||||
{children}
|
||||
</LanguageContext.Provider>
|
||||
);
|
||||
}
|
||||
|
||||
export const useLang = () => useContext(LanguageContext);
|
||||
Reference in New Issue
Block a user