Skip to content

Commit

Permalink
added new theme field
Browse files Browse the repository at this point in the history
  • Loading branch information
SamueleA committed Nov 21, 2023
1 parent f2e919c commit 0b84fab
Show file tree
Hide file tree
Showing 8 changed files with 1,643 additions and 1,127 deletions.
2 changes: 1 addition & 1 deletion examples/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"homepage": "kit",
"dependencies": {
"0xsequence": "^1.4.5",
"@0xsequence/design-system": "^1.0.20",
"@0xsequence/design-system": "^1.1.0",
"@0xsequence/kit": "workspace:*",
"@0xsequence/kit-checkout": "workspace:*",
"@0xsequence/kit-connectors": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion examples/react/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function App() {
})

const kitConfig: KitConfig = {
// projectAccessKey: '80DNYhTnQl6TEXyrvX6MEFHAAAAAAAAA',
projectAccessKey: 'iK0DPkHRt0IFo8o4M3fZIIOAAAAAAAAAA',
defaultTheme: THEMES.dark,
signIn: {
projectName: 'Skyweaver',
Expand Down
4 changes: 2 additions & 2 deletions packages/checkout/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"@paperxyz/react-client-sdk": "^1.1.3"
},
"peerDependencies": {
"@0xsequence/design-system": ">=1.0.20",
"@0xsequence/design-system": ">=1.1.0",
"@vanilla-extract/css": ">=1.9.3",
"@vanilla-extract/recipes": ">=0.3.0",
"ethers": ">=5.7.2",
Expand All @@ -34,7 +34,7 @@
"@0xsequence/kit": "workspace:*"
},
"devDependencies": {
"@0xsequence/design-system": "^1.0.20",
"@0xsequence/design-system": "^1.1.0",
"@types/react-copy-to-clipboard": "^5.0.4",
"@vanilla-extract/css": "^1.9.3",
"@vanilla-extract/recipes": "^0.3.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/connectors/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
"@0xsequence/wagmi-connector": "^2.1.4"
},
"devDependencies": {
"@0xsequence/design-system": "^1.0.20",
"@0xsequence/design-system": "^1.1.0",
"@0xsequence/kit": "workspace:*"
},
"peerDependencies": {
"0xsequence": ">=1.4.5",
"ethers": ">=5.7.2",
"@0xsequence/design-system": ">=1.0.20",
"@0xsequence/design-system": ">=1.1.0",
"react": ">=17",
"react-dom": ">=17",
"viem": ">=1.4.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/kit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"@0xsequence/indexer": "^1.4.5",
"@0xsequence/metadata": "^1.4.5",
"@0xsequence/network": "^1.4.5",
"@0xsequence/design-system": "^1.0.20",
"@0xsequence/design-system": "^1.1.0",
"@0xsequence/ethauth": "^0.8.1",
"@0xsequence/kit-connectors": "workspace:*",
"@0xsequence/utils": "1.4.5",
Expand Down
12 changes: 9 additions & 3 deletions packages/kit/src/components/KitProvider/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { useState, useEffect } from 'react'
import type { ComponentProps } from "react";

import {
Box,
Expand All @@ -23,7 +24,7 @@ import '@0xsequence/design-system/styles.css'
import * as sharedStyles from '../styles.css'

export declare const THEME: readonly ["dark", "light"];
export declare type Theme = typeof THEME[number];
export declare type Theme = ComponentProps<typeof ThemeProvider>['theme'];
export const THEMES = {
dark: 'dark' as Theme,
light: 'light' as Theme
Expand Down Expand Up @@ -83,7 +84,7 @@ export const KitProvider = (props: KitConnectProviderProps) => {

const { projectName } = signIn
const [openConnectModal, setOpenConnectModal] = useState<boolean>(false)
const [theme, setTheme] = useState<Theme>(defaultTheme || THEMES.dark)
const [theme, setTheme] = useState<Exclude<Theme, undefined>>(defaultTheme || THEMES.dark)
const [modalPosition, setModalPosition] = useState<ModalPosition>(position)
const [displayedAssets, setDisplayedAssets] = useState<DisplayedAsset[]>(displayedAssetsSetting)

Expand Down Expand Up @@ -114,7 +115,12 @@ export const KitProvider = (props: KitConnectProviderProps) => {
// Write data in local storage for retrieval in connectors
useEffect(() => {
// Theme
localStorage.setItem(LocalStorageKey.Theme, theme)
// TODO: set the sequence theme once it is added to connect options
if (typeof theme === 'object') {
// localStorage.setItem(LocalStorageKey.Theme, JSON.stringify(theme))
} else {
localStorage.setItem(LocalStorageKey.Theme, theme)
}
// EthAuth
// note: keep an eye out for potential race-conditions, though they shouldn't occur.
// If there are race conditions, the settings could be a function executed prior to being passed to wagmi
Expand Down
4 changes: 2 additions & 2 deletions packages/wallet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"react-copy-to-clipboard": "^5.1.0"
},
"peerDependencies": {
"@0xsequence/design-system": ">=1.0.20",
"@0xsequence/design-system": ">=1.1.0",
"@0xsequence/kit": "workspace:*",
"@vanilla-extract/css": ">=1.9.3",
"@vanilla-extract/recipes": ">=0.3.0",
Expand All @@ -39,7 +39,7 @@
"wagmi": ">=1.3.9"
},
"devDependencies": {
"@0xsequence/design-system": "^1.0.20",
"@0xsequence/design-system": "^1.1.0",
"@0xsequence/kit": "workspace:*",
"@types/lodash": "^4.14.196",
"@types/react-copy-to-clipboard": "^5.0.4",
Expand Down
Loading

0 comments on commit 0b84fab

Please sign in to comment.