Skip to content

Commit

Permalink
language feature added.
Browse files Browse the repository at this point in the history
  • Loading branch information
receptiryaki committed Apr 17, 2020
1 parent c186b1c commit ec79b3f
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/app/containers/HomePage/Features.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ import { Title } from 'app/containers/HomePage/components/Title';
import { Lead } from './components/Lead';
import { ReactComponent as StateIcon } from './assets/state.svg';
import { ReactComponent as CSSIcon } from './assets/css.svg';
import { ReactComponent as INTLIcon } from './assets/intl.svg';
import { SubTitle } from 'app/containers/HomePage/components/SubTitle';
import { P } from './components/P';
import { A } from 'app/components/A';
import { GithubRepoForm } from 'app/containers/GithubRepoForm';
import { ThemeSwitch } from 'app/containers/ThemeSwitch';
import { LanguageSwitch } from '../LanguageSwitch';

export function Features() {
return (
Expand Down Expand Up @@ -65,6 +67,18 @@ export function Features() {
<ThemeSwitch />
</Content>
</Feature>
<Feature>
<INTLIcon className="feature-icon" />
<Content>
<SubTitle>i18n Internationalization </SubTitle>
<P>
Scalable apps need to support multiple languages, easily add and
support multiple languages. Change the language below to see how
instantly it updates the page without refreshing.
</P>
<LanguageSwitch />
</Content>
</Feature>
</List>
</>
);
Expand Down
51 changes: 51 additions & 0 deletions src/app/containers/LanguageSwitch/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import React from 'react';
import { FormLabel } from 'app/components/FormLabel';
import { Radio } from 'app/components/Radio';
import styled from 'styled-components/macro';

export function LanguageSwitch() {
const handleLanguageChange = (event: React.ChangeEvent<HTMLInputElement>) => {
console.log(event.target.value);
};

return (
<Wrapper>
<FormLabel>Select Language</FormLabel>
<Languages>
<Radio
id="en"
label="English"
className="radio"
name="language"
onChange={handleLanguageChange}
value="en"
/* isSelected={lang === 'en'} */
/>
<Radio
id="tr"
label="Deutsch"
className="radio"
name="language"
onChange={handleLanguageChange}
value="de"
/* isSelected={lang === 'de'} */
/>
</Languages>
</Wrapper>
);
}

const Wrapper = styled.div`
display: flex;
flex-direction: column;
${FormLabel} {
margin-bottom: 0.625rem;
}
`;
const Languages = styled.div`
display: flex;
.radio {
margin-right: 1.5rem;
}
`;

0 comments on commit ec79b3f

Please sign in to comment.