File tree Expand file tree Collapse file tree 3 files changed +22
-7
lines changed Expand file tree Collapse file tree 3 files changed +22
-7
lines changed Original file line number Diff line number Diff line change 1+ import React from 'react'
2+ import { Button as AntdButton , Tooltip } from 'antd'
3+ import styled from '@emotion/styled'
4+
5+ const Button = styled ( AntdButton ) `
6+ width: 32px;
7+ padding: 0;
8+ `
9+
10+ const DarkModeButton = ( { isDarkMode, ...props } ) => {
11+ return (
12+ < Tooltip placement = "bottomLeft" title = "Toggle Light/Dark Mode" >
13+ < Button { ...props } > { isDarkMode ? '🌙' : '☀️' } </ Button >
14+ </ Tooltip >
15+ )
16+ }
17+
18+ export { DarkModeButton }
Original file line number Diff line number Diff line change @@ -31,8 +31,6 @@ const Settings = ({
3131 packageName,
3232 language,
3333 onChangePackageNameAndLanguage,
34- isDarkMode,
35- toggleDarkMode,
3634} ) => {
3735 const [ popoverVisibility , setVisibility ] = useState ( false )
3836 const [ newPackageName , setNewPackageName ] = useState ( packageName )
@@ -104,10 +102,6 @@ const Settings = ({
104102 </ PackagesGroupContainer >
105103 </ Radio . Group >
106104 </ PlatformsContainer >
107- < h5 > Theme:</ h5 >
108- < Button onClick = { toggleDarkMode } >
109- { isDarkMode ? 'Dark' : 'Light' }
110- </ Button >
111105 </ >
112106 }
113107 trigger = "click"
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ import {
1818 PACKAGE_NAMES ,
1919} from '../../constants'
2020import { TroubleshootingGuidesButton } from '../common/TroubleshootingGuidesButton'
21+ import { DarkModeButton } from '../common/DarkModeButton'
2122import { updateURL } from '../../utils/update-url'
2223import { deviceSizes } from '../../utils/device-sizes'
2324import { lightTheme , darkTheme } from '../../theme'
@@ -243,8 +244,10 @@ const Home = () => {
243244 handlePackageNameAndLanguageChange
244245 }
245246 language = { language }
247+ />
248+ < DarkModeButton
246249 isDarkMode = { isDarkMode }
247- toggleDarkMode = { toggleDarkMode }
250+ onClick = { toggleDarkMode }
248251 />
249252 </ SettingsContainer >
250253 </ HeaderContainer >
You can’t perform that action at this time.
0 commit comments