Skip to content

Commit

Permalink
added CSS to selectbox
Browse files Browse the repository at this point in the history
  • Loading branch information
AmasiaNalbandian committed Mar 9, 2022
1 parent 703df7c commit af02252
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/web/src/components/LanguageSelector.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { createContext, ChangeEvent, useState } from 'react';
import { FormControl, Grid, InputLabel, MenuItem, Select } from '@material-ui/core';
import { makeStyles } from '@material-ui/core/styles';

import { setLang, getLang } from '../translations/i18n';

Expand All @@ -16,7 +17,18 @@ const languages: Array<{ name: string; code: string }> = [
{ name: 'Español', code: 'es' },
];

const useStyles = makeStyles((theme) => {
return {
selectBox: {
width: '10rem',
fontFamily: 'sans-serif',
},
};
});

const LanguageSelector = () => {
const classes = useStyles();

// sets the state to use the current i18 language. i18 remembers the language for the page,
// and is not effected by rendering.
const [language, setLanguage] = useState(getLang());
Expand All @@ -33,7 +45,12 @@ const LanguageSelector = () => {
<Grid container>
<FormControl>
<InputLabel>Language</InputLabel>
<Select value={language} label="Language" onChange={changeLanguage}>
<Select
className={classes.selectBox}
value={language}
label="Language"
onChange={changeLanguage}
>
{languages.map((lang) => {
return (
<MenuItem key={lang.code} value={lang.code}>
Expand Down

0 comments on commit af02252

Please sign in to comment.