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 = ({
31
31
packageName,
32
32
language,
33
33
onChangePackageNameAndLanguage,
34
- isDarkMode,
35
- toggleDarkMode,
36
34
} ) => {
37
35
const [ popoverVisibility , setVisibility ] = useState ( false )
38
36
const [ newPackageName , setNewPackageName ] = useState ( packageName )
@@ -104,10 +102,6 @@ const Settings = ({
104
102
</ PackagesGroupContainer >
105
103
</ Radio . Group >
106
104
</ PlatformsContainer >
107
- < h5 > Theme:</ h5 >
108
- < Button onClick = { toggleDarkMode } >
109
- { isDarkMode ? 'Dark' : 'Light' }
110
- </ Button >
111
105
</ >
112
106
}
113
107
trigger = "click"
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ import {
18
18
PACKAGE_NAMES ,
19
19
} from '../../constants'
20
20
import { TroubleshootingGuidesButton } from '../common/TroubleshootingGuidesButton'
21
+ import { DarkModeButton } from '../common/DarkModeButton'
21
22
import { updateURL } from '../../utils/update-url'
22
23
import { deviceSizes } from '../../utils/device-sizes'
23
24
import { lightTheme , darkTheme } from '../../theme'
@@ -243,8 +244,10 @@ const Home = () => {
243
244
handlePackageNameAndLanguageChange
244
245
}
245
246
language = { language }
247
+ />
248
+ < DarkModeButton
246
249
isDarkMode = { isDarkMode }
247
- toggleDarkMode = { toggleDarkMode }
250
+ onClick = { toggleDarkMode }
248
251
/>
249
252
</ SettingsContainer >
250
253
</ HeaderContainer >
You can’t perform that action at this time.
0 commit comments