@@ -15,7 +15,8 @@ import usePosthog from "../../utils/use-posthog"
1515import packageInfo from "../../../package.json"
1616import useEventCallback from "use-event-callback"
1717import DownloadIcon from "@material-ui/icons/GetApp"
18-
18+ import Box from "@material-ui/core/Box"
19+ import Select from "react-select"
1920import { useTranslation } from "react-i18next"
2021
2122const useStyles = makeStyles ( {
@@ -37,6 +38,11 @@ const useStyles = makeStyles({
3738 marginLeft : - 6 ,
3839 color : colors . grey [ 700 ] ,
3940 } ,
41+ languageSelectionWrapper : {
42+ display : "flex" ,
43+ flexDirection : "column" ,
44+ textAlign : "center" ,
45+ } ,
4046} )
4147
4248const ContentContainer = styled ( "div" ) ( ( { theme } ) => ( {
@@ -65,6 +71,25 @@ const Title = styled("div")({
6571 color : colors . grey [ 300 ] ,
6672} )
6773
74+ const languageSelectionFormStyle = {
75+ control : ( base , state ) => ( {
76+ ...base ,
77+ border : "1px solid #9e9e9e" ,
78+ background : "transparent" ,
79+ color : "#e0e0e0" ,
80+ } ) ,
81+ menuList : ( base ) => ( {
82+ ...base ,
83+ padding : 0 ,
84+ margin : 0 ,
85+ color : "black" ,
86+ } ) ,
87+ singleValue : ( base ) => ( {
88+ ...base ,
89+ color : "white" ,
90+ } ) ,
91+ }
92+
6893const Subtitle = styled ( "div" ) ( {
6994 fontSize : 18 ,
7095 // fontWeight: "bold",
@@ -97,8 +122,15 @@ const Actionless = styled("div")({
97122 color : colors . grey [ 600 ] ,
98123 paddingTop : 16 ,
99124} )
125+
100126const BottomSpacer = styled ( "div" ) ( { height : 100 } )
101127
128+ const languageOptions = [
129+ { label : "English" , value : "en" } ,
130+ { label : "French" , value : "fr" } ,
131+ { label : "Chinese" , value : "cn" } ,
132+ ]
133+
102134export default ( {
103135 onFileDrop,
104136 onOpenTemplate,
@@ -111,7 +143,7 @@ export default ({
111143 const posthog = usePosthog ( )
112144
113145 // internalization hook
114- const { t } = useTranslation ( )
146+ const { t, i18n } = useTranslation ( )
115147
116148 //const isDesktop = useIsDesktop()
117149 const [ newVersionAvailable , changeNewVersionAvailable ] = useState ( false )
@@ -137,6 +169,10 @@ export default ({
137169 onFileDrop ( acceptedFiles [ 0 ] )
138170 } )
139171
172+ const changeLanguage = ( language ) => {
173+ i18n . changeLanguage ( language )
174+ }
175+
140176 let { getRootProps, getInputProps } = useDropzone ( { onDrop } )
141177
142178 return (
@@ -185,10 +221,22 @@ export default ({
185221 < ContentContainer >
186222 < Content >
187223 < Grid container >
188- < Grid xs = { 12 } item >
224+ < Grid xs = { 6 } item >
189225 < Title > Universal Data Tool</ Title >
190226 < Subtitle > { t ( "universaldatatool-description" ) } </ Subtitle >
191227 </ Grid >
228+ < Grid xs = { 3 } />
229+ < Grid xs = { 3 } >
230+ < Box padding = { 3 } className = { c . languageSelectionWrapper } >
231+ < ActionTitle > Select Language</ ActionTitle >
232+ < Select
233+ styles = { languageSelectionFormStyle }
234+ defaultValue = { languageOptions [ 0 ] }
235+ options = { languageOptions }
236+ onChange = { ( { value } ) => changeLanguage ( value ) }
237+ />
238+ </ Box >
239+ </ Grid >
192240 < Grid xs = { 6 } item >
193241 < ActionList >
194242 < ActionTitle > Start</ ActionTitle >
0 commit comments