-
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.
feat(web app): add language-selection page
- Loading branch information
1 parent
d3a436d
commit 2e2def2
Showing
3 changed files
with
32 additions
and
1 deletion.
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
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,29 @@ | ||
import { JSX } from 'preact'; | ||
|
||
import { Language } from '../catechism/source/types/types.ts'; | ||
import { getNativeLanguageText, getSupportedLanguages } from '../catechism/source/utils/language.ts'; | ||
|
||
export default function SelectLanguage(): JSX.Element { | ||
return ( | ||
<div class='min-h-screen bg-white flex flex-col items-center'> | ||
<h1 class='mt-[15vh] font-serif text-3xl text-center'>Select your language:</h1> | ||
<div class='flex flex-col gap-8 items-center mt-16'> | ||
{getLanguages().map((languageData) => ( | ||
<a | ||
href={`/${languageData.language}`} | ||
class='w-48 bg-tan-50 text-lg font-bold text-center py-8 shadow-lg hover:shadow-xl' | ||
> | ||
{languageData.text} | ||
</a> | ||
))} | ||
</div> | ||
<a href='/' class='mt-16 mb-8 text-lg hover:underline'>Return to the Introduction</a> | ||
</div> | ||
); | ||
} | ||
|
||
function getLanguages(): Array<{ language: Language; text: string }> { | ||
return getSupportedLanguages() | ||
.map(([_text, language]) => ({ language, text: getNativeLanguageText(language) })) | ||
.sort((a, b) => a.text.localeCompare(b.text)); | ||
} |