-
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.
Merge pull request #2 from bocabitlabs/fix_language_aut
Update mantine to version 7.x
- Loading branch information
Showing
25 changed files
with
682 additions
and
1,892 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
Large diffs are not rendered by default.
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
This file was deleted.
Oops, something went wrong.
52 changes: 52 additions & 0 deletions
52
client/src/components/LanguageSelector/LanguageSelector.tsx
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,52 @@ | ||
import { useState } from "react"; | ||
import { Combobox, Input, InputBase, useCombobox } from "@mantine/core"; | ||
import i18n from "i18n"; | ||
|
||
const languages = ["es", "en"]; | ||
|
||
export default function LanguageSelector() { | ||
const changeLanguage = (lng: string) => { | ||
console.log("Change language to", lng); | ||
i18n.changeLanguage(lng); | ||
}; | ||
|
||
const combobox = useCombobox({ | ||
onDropdownClose: () => combobox.resetSelectedOption(), | ||
}); | ||
|
||
const [value, setValue] = useState<string | null>(null); | ||
|
||
const options = languages.map((item) => ( | ||
<Combobox.Option value={item} key={item}> | ||
{item} | ||
</Combobox.Option> | ||
)); | ||
|
||
return ( | ||
<Combobox | ||
store={combobox} | ||
onOptionSubmit={(val) => { | ||
setValue(val); | ||
combobox.closeDropdown(); | ||
changeLanguage(val); | ||
}} | ||
> | ||
<Combobox.Target> | ||
<InputBase | ||
component="button" | ||
type="button" | ||
pointer | ||
rightSection={<Combobox.Chevron />} | ||
rightSectionPointerEvents="none" | ||
onClick={() => combobox.toggleDropdown()} | ||
> | ||
{value || <Input.Placeholder>{i18n.language}</Input.Placeholder>} | ||
</InputBase> | ||
</Combobox.Target> | ||
|
||
<Combobox.Dropdown> | ||
<Combobox.Options>{options}</Combobox.Options> | ||
</Combobox.Dropdown> | ||
</Combobox> | ||
); | ||
} |
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,12 +1,18 @@ | ||
import { Group, ColorScheme, Text, Image } from "@mantine/core"; | ||
import { Group, Image, Title } from "@mantine/core"; | ||
|
||
export default function Logo({ colorScheme }: { colorScheme: ColorScheme }) { | ||
export default function Logo() { | ||
return ( | ||
<Group> | ||
<Image src="/icons/favicon-192.png" width={40} height={40} /> | ||
<Text color={colorScheme === "dark" ? "#fff" : "#000"}> | ||
<strong>Cociplan</strong>{" "} | ||
</Text> | ||
<Image | ||
fit="contain" | ||
src="/icons/favicon-192.png" | ||
width="auto" | ||
height={40} | ||
style={{ width: "auto" }} | ||
/> | ||
<Title order={1} size="1.5rem"> | ||
Cociplan | ||
</Title> | ||
</Group> | ||
); | ||
} |
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
Oops, something went wrong.