-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
98 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,21 @@ | ||
import { Searchbox } from '@/components/searchbox'; | ||
import { useTranslations } from 'next-intl'; | ||
import { Badge, Button } from '@clinia-ui/react'; | ||
|
||
export default function Home() { | ||
const t = useTranslations(); | ||
return ( | ||
<div className="flex justify-center"> | ||
<div className="w-[570px]"> | ||
<div className="grid justify-items-center"> | ||
<div className="w-[570px] py-80"> | ||
<Searchbox /> | ||
</div> | ||
<div className="flex flex-col gap-4"> | ||
<h1 className="pb-4 text-center text-base font-medium text-foreground"> | ||
{t('home.questions.title')} | ||
</h1> | ||
<Button>How long to recover from ACL tear?</Button> | ||
<Button>How reliable are COVID tests?</Button> | ||
</div> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { Searchbox } from '@/components/searchbox'; | ||
|
||
export default function Search() { | ||
return ( | ||
<div> | ||
<Searchbox /> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,28 @@ | ||
import {notFound} from 'next/navigation'; | ||
import {getRequestConfig} from 'next-intl/server'; | ||
import { getRequestConfig } from 'next-intl/server'; | ||
import { notFound } from 'next/navigation'; | ||
|
||
// Can be imported from a shared config | ||
const locales = ['en', 'de']; | ||
export default getRequestConfig(async ({locale}) => { | ||
|
||
export default getRequestConfig(async ({ locale }) => { | ||
// Validate that the incoming `locale` parameter is valid | ||
if (!locales.includes(locale as any)) notFound(); | ||
|
||
return { | ||
messages: (await import(`../messages/${locale}.json`)).default | ||
messages: (await import(`../messages/${locale}.json`)).default, | ||
}; | ||
}); | ||
}); | ||
|
||
const messages = { | ||
en: (): Record<string, any> => | ||
import('../messages/en.json').then((module) => module.default), | ||
fr: (): Record<string, any> => | ||
import('../messages/fr.json').then((module) => module.default), | ||
}; | ||
|
||
type Locales = keyof typeof messages; | ||
|
||
export const getMessages = async (locale: string) => { | ||
const key = locale as Locales; | ||
return messages[key](); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { useParams, useRouter } from 'next/navigation'; | ||
|
||
export const useI18nRouter = (): ReturnType<typeof useRouter> => { | ||
const { locale } = useParams(); | ||
const router = useRouter(); | ||
|
||
return { | ||
push: (url: string) => router.push(`/${locale}${url}`), | ||
forward: () => router.forward(), | ||
back: () => router.back(), | ||
replace: (url: string) => router.replace(`/${locale}${url}`), | ||
refresh: () => router.refresh(), | ||
prefetch: (url: string) => router.prefetch(`/${locale}${url}`), | ||
}; | ||
}; |