This repository has been archived by the owner on Nov 24, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 188
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dm portal speical week and i18n (#480)
- Loading branch information
Showing
32 changed files
with
522 additions
and
156 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
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
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
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,43 @@ | ||
import React, { useState } from 'react' | ||
import { Radio } from 'antd' | ||
import styled from 'styled-components' | ||
|
||
import { IntlProvider } from 'react-intl' | ||
import getMessages from '../locales' | ||
|
||
const Container = styled.div` | ||
padding-top: 60px; | ||
.change-locale { | ||
position: fixed; | ||
right: 12px; | ||
top: 12px; | ||
} | ||
` | ||
|
||
const DmLayout: React.FC = ({ children }) => { | ||
const [locale, setLocale] = useState('en') | ||
|
||
return ( | ||
<Container> | ||
<div className="change-locale"> | ||
<Radio.Group | ||
value={locale} | ||
onChange={(e: any) => setLocale(e.target.value)} | ||
> | ||
<Radio.Button key="en" value={'en'}> | ||
English | ||
</Radio.Button> | ||
<Radio.Button key="zh" value={'zh'}> | ||
中文 | ||
</Radio.Button> | ||
</Radio.Group> | ||
</div> | ||
<IntlProvider locale={locale} messages={getMessages(locale)}> | ||
{children} | ||
</IntlProvider> | ||
</Container> | ||
) | ||
} | ||
|
||
export default DmLayout |
Oops, something went wrong.