Skip to content

Commit 8b04a32

Browse files
committed
feat: add dark theme to contract pages
1 parent f3aa32d commit 8b04a32

File tree

11 files changed

+50
-19
lines changed

11 files changed

+50
-19
lines changed

templates/chain-template/components/common/Drawer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export const Drawer = ({
7575
left={direction === 'right' ? 'auto' : '0'}
7676
right={direction === 'left' ? 'auto' : '0'}
7777
ref={contentRef}
78-
bg="white"
78+
bg="$background"
7979
overflowY="auto"
8080
overflowX="hidden"
8181
transform={getTransform()}

templates/chain-template/components/common/Radio/Radio.module.css

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,15 @@
2626
left: 50%;
2727
transform: translate(-50%, -50%);
2828
}
29+
30+
.radioDark {
31+
border: 1px solid #343c44;
32+
}
33+
34+
.radioDark:checked {
35+
border: 1px solid #ab6fff;
36+
}
37+
38+
.radioDark:checked::before {
39+
background: #ab6fff;
40+
}

templates/chain-template/components/common/Radio/Radio.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Box } from '@interchain-ui/react';
1+
import { Box, useTheme } from '@interchain-ui/react';
22
import styles from './Radio.module.css';
33

44
type RadioProps = {
@@ -16,6 +16,8 @@ export const Radio = ({
1616
name,
1717
onChange,
1818
}: RadioProps) => {
19+
const { theme } = useTheme();
20+
1921
return (
2022
<Box
2123
as="label"
@@ -34,7 +36,9 @@ export const Radio = ({
3436
value={value}
3537
checked={checked}
3638
onChange={onChange}
37-
className={styles.radio}
39+
className={`${styles.radio} ${
40+
theme === 'dark' ? styles.radioDark : ''
41+
}`}
3842
/>
3943
{children}
4044
</Box>

templates/chain-template/components/common/Table.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Box, BoxProps } from '@interchain-ui/react';
1+
import { Box, BoxProps, useColorModeValue } from '@interchain-ui/react';
22

33
const Table = (props: BoxProps) => {
44
return <Box as="table" rawCSS={{ borderSpacing: '0 20px' }} {...props} />;
@@ -16,14 +16,16 @@ const TableRow = ({
1616
hasHover = false,
1717
...props
1818
}: BoxProps & { hasHover?: boolean }) => {
19+
const bgHoverColor = useColorModeValue('$blackAlpha100', '$whiteAlpha100');
20+
1921
return (
2022
<Box
2123
as="tr"
2224
height="38px"
2325
cursor={hasHover ? 'pointer' : undefined}
2426
backgroundColor={{
25-
base: '$background',
26-
hover: hasHover ? '$blackAlpha100' : '$background',
27+
base: 'transparent',
28+
hover: hasHover ? bgHoverColor : 'transparent',
2729
}}
2830
{...props}
2931
/>

templates/chain-template/components/contract/FileUpload.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useCallback } from 'react';
2-
import { Box, Text } from '@interchain-ui/react';
2+
import { Box, Text, useColorModeValue } from '@interchain-ui/react';
33
import { HiOutlineTrash, HiOutlineUpload } from 'react-icons/hi';
44
import { useDropzone } from 'react-dropzone';
55

@@ -28,6 +28,8 @@ export const FileUpload = ({ file, setFile }: FileUploadProps) => {
2828
maxSize: MAX_FILE_SIZE,
2929
});
3030

31+
const textColor = useColorModeValue('$purple600', '$purple400');
32+
3133
if (file) {
3234
return (
3335
<Box
@@ -92,7 +94,7 @@ export const FileUpload = ({ file, setFile }: FileUploadProps) => {
9294
>
9395
<Text
9496
as="span"
95-
color="$purple600"
97+
color={textColor}
9698
fontSize="16px"
9799
fontWeight="600"
98100
attributes={{
@@ -127,7 +129,7 @@ export const UploadIcon = () => (
127129
height="40px"
128130
borderRadius="$full"
129131
bg="$purple100"
130-
color="$purple600"
132+
color={useColorModeValue('$purple600', '$purple400')}
131133
>
132134
<HiOutlineUpload size="20px" />
133135
</Box>

templates/chain-template/components/contract/MyContractsTab.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export const MyContractsTab = ({ show, switchTab }: MyContractsTabProps) => {
3333
{!address ? (
3434
<EmptyState text="Connect wallet to see your previously instantiated contracts." />
3535
) : isLoading ? (
36-
<Spinner size="$6xl" />
36+
<Spinner size="$6xl" color="$blackAlpha600" />
3737
) : myContracts.length === 0 ? (
3838
<EmptyState text="No contracts found" />
3939
) : (

templates/chain-template/components/contract/PermissionTag.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Box, Text } from '@interchain-ui/react';
1+
import { Box, Text, useColorModeValue } from '@interchain-ui/react';
22
import { AccessType } from 'interchain-query/cosmwasm/wasm/v1/types';
33

44
type PermissionTagProps = {
@@ -29,7 +29,11 @@ export const PermissionTag = ({ permission }: PermissionTagProps) => {
2929
bg="$purple200"
3030
width="$fit"
3131
>
32-
<Text color="$purple600" fontSize="12px" fontWeight="500">
32+
<Text
33+
color={useColorModeValue('$purple600', '$purple300')}
34+
fontSize="12px"
35+
fontWeight="500"
36+
>
3337
{renderText()}
3438
</Text>
3539
</Box>

templates/chain-template/components/contract/SelectCodeField.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,9 @@ const FillCodeId = ({
228228
/>
229229
{codeId.length > 0 && (
230230
<Box position="absolute" top="10px" right="10px">
231-
{status.state === 'loading' && <Spinner size="$xl" />}
231+
{status.state === 'loading' && (
232+
<Spinner size="$xl" color="$blackAlpha600" />
233+
)}
232234
{status.state === 'success' && (
233235
<Icon name="checkboxCircle" color="$green600" size="$xl" />
234236
)}

templates/chain-template/components/contract/SelectCodeModal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ export const SelectCodeModal = ({
9797
{!address ? (
9898
<EmptyState text="Connect wallet to see your previously stored codes." />
9999
) : isLoading ? (
100-
<Spinner size="$6xl" />
100+
<Spinner size="$6xl" color="$blackAlpha600" />
101101
) : storedCodes.length === 0 ? (
102102
<EmptyState text="No codes found" />
103103
) : filteredCodes.length === 0 ? (

templates/chain-template/components/contract/StoredCodesFilter.tsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import {
77
SelectButton,
88
Text,
99
TextField,
10+
useColorModeValue,
11+
useTheme,
1012
} from '@interchain-ui/react';
1113

1214
import { useDetectBreakpoints } from '@/hooks';
@@ -49,6 +51,7 @@ export const StoredCodesFilter = ({
4951
const [elemRef, setElemRef] = useState<HTMLDivElement>();
5052
const [isPopoverOpen, setIsPopoverOpen] = useState(false);
5153

54+
const { theme } = useTheme();
5255
const { isMobile } = useDetectBreakpoints();
5356

5457
const permissionOption = permissionOptions.find(
@@ -95,9 +98,11 @@ export const StoredCodesFilter = ({
9598
flexDirection="column"
9699
width={`${elemRef?.offsetWidth}px`}
97100
py="10px"
98-
bg="$white"
101+
bg="$background"
99102
borderRadius="4px"
100-
boxShadow="0px 4px 20px 0px rgba(0, 0, 0, 0.1)"
103+
boxShadow={`0px 4px 20px 0px rgba(${
104+
theme === 'light' ? '0,0,0' : '128,128,128'
105+
}, 0.1)`}
101106
maxHeight="220px"
102107
overflowY="auto"
103108
>
@@ -136,8 +141,8 @@ const CustomOption = ({
136141
px="20px"
137142
cursor="pointer"
138143
bg={{
139-
hover: '$blackAlpha100',
140-
base: '$white',
144+
hover: useColorModeValue('$blackAlpha100', '$whiteAlpha100'),
145+
base: '$background',
141146
}}
142147
attributes={{ onClick }}
143148
>

0 commit comments

Comments
 (0)