Skip to content

Commit

Permalink
chore(connector-react): move react to peerDependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
Hanssen0 committed Sep 3, 2024
1 parent 35feb50 commit 5e796a5
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
8 changes: 5 additions & 3 deletions packages/connector-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@
},
"dependencies": {
"@ckb-ccc/connector": "workspace:*",
"@lit/react": "^1.0.5",
"react": "^18"
"@lit/react": "^1.0.5"
},
"peerDependencies": {
"react": ">=16"
}
}
}
12 changes: 8 additions & 4 deletions packages/connector-react/src/hooks/useCcc.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import { ccc } from "@ckb-ccc/connector";
import React, {
CSSProperties,
HTMLAttributes,
ReactNode,
createContext,
useCallback,
useContext,
useEffect,
useMemo,
useRef,
Expand Down Expand Up @@ -58,8 +62,8 @@ export function Provider({
defaultClient,
preferredNetworks,
}: {
children: React.ReactNode;
connectorProps?: React.HTMLAttributes<{}>;
children: ReactNode;
connectorProps?: HTMLAttributes<{}>;
name?: string;
icon?: string;
signerFilter?: (
Expand Down Expand Up @@ -146,7 +150,7 @@ export function Provider({
"--btn-secondary-hover": "#ccc",
color: "#1e1e1e",
"--tip-color": "#666",
} as React.CSSProperties),
} as CSSProperties),
},
}}
/>
Expand All @@ -156,7 +160,7 @@ export function Provider({
}

export function useCcc() {
const context = React.useContext(CCC_CONTEXT);
const context = useContext(CCC_CONTEXT);
if (!context) {
throw Error(
"The component which invokes the useCcc hook should be placed in a ccc.Provider.",
Expand Down
2 changes: 1 addition & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5e796a5

Please sign in to comment.