feat: add language switcher to showcase view using i18n hook
This commit is contained in:
@@ -23,6 +23,8 @@ import {
|
|||||||
Paper,
|
Paper,
|
||||||
} from '@repo/ui/components';
|
} from '@repo/ui/components';
|
||||||
import { ShieldCheck, Database, Lock, Layout, Activity, Printer, FileText } from 'lucide-react';
|
import { ShieldCheck, Database, Lock, Layout, Activity, Printer, FileText } from 'lucide-react';
|
||||||
|
import { Globe } from 'lucide-react';
|
||||||
|
import { useTranslation } from '@repo/core-i18n';
|
||||||
import PrinterList from './printer-list';
|
import PrinterList from './printer-list';
|
||||||
import ExamplePage from './example/example.page';
|
import ExamplePage from './example/example.page';
|
||||||
import EventsDemoPage from './events-demo';
|
import EventsDemoPage from './events-demo';
|
||||||
@@ -38,6 +40,7 @@ interface ShowcaseViewProps {
|
|||||||
|
|
||||||
export default function ShowcaseView({ colorScheme, setColorScheme, density, setDensity }: ShowcaseViewProps) {
|
export default function ShowcaseView({ colorScheme, setColorScheme, density, setDensity }: ShowcaseViewProps) {
|
||||||
const [activeTab, setActiveTab] = useState<string | null>('ui-components');
|
const [activeTab, setActiveTab] = useState<string | null>('ui-components');
|
||||||
|
const { i18n } = useTranslation();
|
||||||
|
|
||||||
// Mock data for the table
|
// Mock data for the table
|
||||||
const tableData = [
|
const tableData = [
|
||||||
@@ -144,6 +147,18 @@ export default function ShowcaseView({ colorScheme, setColorScheme, density, set
|
|||||||
{getSubtitle()}
|
{getSubtitle()}
|
||||||
</Text>
|
</Text>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
<Select
|
||||||
|
w={180}
|
||||||
|
size="sm"
|
||||||
|
variant="filled"
|
||||||
|
leftSection={<Globe size={16} />}
|
||||||
|
data={[
|
||||||
|
{ value: 'en', label: 'English' },
|
||||||
|
{ value: 'id', label: 'Bahasa Indonesia' },
|
||||||
|
]}
|
||||||
|
value={i18n.resolvedLanguage || i18n.language}
|
||||||
|
onChange={(val) => val && i18n.changeLanguage(val)}
|
||||||
|
/>
|
||||||
</Group>
|
</Group>
|
||||||
</Paper>
|
</Paper>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user