-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat: enhance the top bar and show the grafana link (#622)
* Feat: enhance the top bar and show the grafana link Signed-off-by: barnettZQG <[email protected]> * Fix: mark the experimental addon Signed-off-by: barnettZQG <[email protected]> Signed-off-by: barnettZQG <[email protected]>
- Loading branch information
1 parent
348d9ac
commit cd550ab
Showing
9 changed files
with
130 additions
and
75 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
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import React, { useState } from 'react'; | ||
import './index.less'; | ||
import { Dropdown, Menu } from '@alifd/next'; | ||
import { useTranslation } from 'react-i18next'; | ||
import { getLanguage } from '../../utils/common'; | ||
|
||
import { TbLanguage } from 'react-icons/tb'; | ||
|
||
const SwitchLanguage = () => { | ||
const { i18n } = useTranslation(); | ||
const _isEnglish = getLanguage() === 'en'; | ||
const [isEnglish, setIsEnglish] = useState(_isEnglish); | ||
return ( | ||
<Dropdown trigger={<TbLanguage size="18" />}> | ||
<Menu> | ||
<Menu.Item | ||
onClick={() => { | ||
i18n.changeLanguage('en'); | ||
localStorage.setItem('lang', 'en'); | ||
setIsEnglish(true); | ||
}} | ||
> | ||
English {isEnglish ? '(Now)' : ''} | ||
</Menu.Item> | ||
<Menu.Item | ||
onClick={() => { | ||
i18n.changeLanguage('zh'); | ||
localStorage.setItem('lang', 'zh'); | ||
setIsEnglish(false); | ||
}} | ||
> | ||
中文{!isEnglish ? '(当前)' : ''} | ||
</Menu.Item> | ||
</Menu> | ||
</Dropdown> | ||
); | ||
}; | ||
export default SwitchLanguage; |
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
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