Skip to content
This repository was archived by the owner on Jul 23, 2024. It is now read-only.

Commit 0ee1c58

Browse files
committed
created simpler moon/sun icons
1 parent 702dd4f commit 0ee1c58

File tree

4 files changed

+30
-4
lines changed

4 files changed

+30
-4
lines changed

frontend/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@
8080
},
8181
"dependencies": {
8282
"@apollo/client": "3.5.4",
83+
"@chakra-ui/icons": "^2.1.1",
8384
"@chakra-ui/react": "^2.8.1",
8485
"@diamondlightsource/ui-components": "^1.0.2",
8586
"@emotion/react": "^11.11.1",

frontend/src/App.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { ChakraProvider, Alert, AlertIcon, AlertTitle, AlertDescription, Button,
77
import { Table } from "./components/Table";
88
import {Helmet} from 'react-helmet';
99
import { DarkModeSwitch } from 'react-toggle-dark-mode';
10+
import { DarkModeButton } from "./components/DarkModeButton";
1011

1112
const GET_INFO = gql(`
1213
query pinInfo ($after: String) {
@@ -90,11 +91,13 @@ function DisplayPinInfo(): React.JSX.Element {
9091
return (
9192
<>
9293
<div>
93-
<DarkModeSwitch
94+
<DarkModeButton
95+
aria-label='Search database'
9496
style={{ marginBottom: '1rem', marginLeft: '.25rem', marginTop: '.25rem', position: 'relative', left: '1875px'}}
95-
checked={colorMode === 'dark'}
96-
onChange={toggleColorMode}
97-
size={30}
97+
isDark={colorMode === 'dark'}
98+
onClick={toggleColorMode}
99+
variant={'unstyled'}
100+
colorScheme={colorMode === 'dark' ? '#a3a3a3' : 'white'}
98101
/>
99102
<Helmet>
100103
<style>{`body { background-color: ${bgColour} }`}</style>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { IconButton, IconButtonProps} from '@chakra-ui/react'
2+
import React from 'react'
3+
import { SunIcon, MoonIcon } from '@chakra-ui/icons'
4+
5+
export interface DarkModeButtonProps extends IconButtonProps {
6+
isDark: boolean
7+
}
8+
9+
const DarkModeButton = ({isDark, ...props}: DarkModeButtonProps) => {
10+
return (
11+
<IconButton icon={isDark ? <MoonIcon color='white'/> : <SunIcon color='#2b2b2b'/>} {...props}/>
12+
)
13+
}
14+
15+
export {DarkModeButton}

frontend/yarn.lock

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1468,6 +1468,13 @@
14681468
dependencies:
14691469
"@chakra-ui/shared-utils" "2.0.5"
14701470

1471+
"@chakra-ui/icons@^2.1.1":
1472+
version "2.1.1"
1473+
resolved "https://registry.yarnpkg.com/@chakra-ui/icons/-/icons-2.1.1.tgz#58ff0f9e703f2f4f89debd600ce4e438f43f9c9a"
1474+
integrity sha512-3p30hdo4LlRZTT5CwoAJq3G9fHI0wDc0pBaMHj4SUn0yomO+RcDRlzhdXqdr5cVnzax44sqXJVnf3oQG0eI+4g==
1475+
dependencies:
1476+
"@chakra-ui/icon" "3.2.0"
1477+
14711478
"@chakra-ui/image@2.1.0":
14721479
version "2.1.0"
14731480
resolved "https://registry.yarnpkg.com/@chakra-ui/image/-/image-2.1.0.tgz#6c205f1ca148e3bf58345b0b5d4eb3d959eb9f87"

0 commit comments

Comments
 (0)