Skip to content

Commit

Permalink
sync kit theme and app theme
Browse files Browse the repository at this point in the history
  • Loading branch information
SamueleA committed Nov 8, 2023
1 parent 074cf7b commit 3b28cce
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion examples/react/src/components/Homepage.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import qs from 'query-string'
import { useOpenConnectModal, signEthAuthProof, validateEthProof } from '@0xsequence/kit'
import { useOpenConnectModal, signEthAuthProof, validateEthProof, useTheme as useKitTheme } from '@0xsequence/kit'
import { useOpenWalletModal } from '@0xsequence/kit-wallet'
import { useCheckoutModal } from '@0xsequence/kit-checkout'
import { useDisconnect, useAccount, useWalletClient, usePublicClient } from 'wagmi'
Expand All @@ -23,6 +23,7 @@ import { formatAddress, getCheckoutSettings } from '../utils'

function Homepage() {
const { theme, setTheme } = useTheme()
const { setTheme: setKitTheme } = useKitTheme()
const { address, connector, isConnected } = useAccount()
const { setOpenConnectModal } = useOpenConnectModal()
const { setOpenWalletModal } = useOpenWalletModal()
Expand Down Expand Up @@ -81,7 +82,10 @@ function Homepage() {
}

const onClickChangeTheme = () => {
// Change theme at the app level
setTheme(theme === 'dark' ? 'light' : 'dark')
// Change the theme in kit. Theme can also be changed in the settings for kit only
setKitTheme(theme === 'dark' ? 'light' : 'dark')
}


Expand Down

0 comments on commit 3b28cce

Please sign in to comment.