Skip to content

Commit

Permalink
updated use client exports
Browse files Browse the repository at this point in the history
  • Loading branch information
Royal-lobster committed Sep 2, 2024
1 parent a52759c commit 2cd7cba
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 44 deletions.
2 changes: 0 additions & 2 deletions src/components/CustomAvatar.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use client'

import BoringAvatar from 'boring-avatars'
import type { AvatarComponent } from '@rainbow-me/rainbowkit'

Expand Down
54 changes: 26 additions & 28 deletions src/components/Login.tsx
Original file line number Diff line number Diff line change
@@ -1,33 +1,31 @@
'use client'

import { ConnectButton } from '@rainbow-me/rainbowkit'
import { SignTokenButton } from './SignTokenButton'
import { ConnectButton } from "@rainbow-me/rainbowkit";
import { SignTokenButton } from "./SignTokenButton";

interface LoginProps {
title: string
description: string
handleRedirect: () => void
title: string;
description: string;
handleRedirect?: () => void;
}

export const Login = ({ title, description, handleRedirect }: LoginProps) => {
return (
<div className="grid min-h-[calc(100vh-250px)] place-items-center py-4 md:p-4">
<div className="max-w-xl text-center">
<h1 className="mb-4 text-4xl font-bold">{title}</h1>
<p className="mb-8 text-lg text-gray-500 dark:text-alpha-900">
{description}
</p>
<div className="mt-8 rounded-md border bg-gray-100 dark:border-gray-500 dark:bg-gray-700">
<div className="flex flex-col items-center p-4">
<h2 className="mb-4 text-xl">Step 1: Connect your wallet</h2>
<ConnectButton />
</div>
<div className="flex flex-col items-center border-t p-4 dark:border-gray-500">
<h2 className="mb-4 text-xl">Step 2: Authenticate your wallet</h2>
<SignTokenButton handleRedirect={handleRedirect} />
</div>
</div>
</div>
</div>
)
}
return (
<div className="grid min-h-[calc(100vh-250px)] place-items-center py-4 md:p-4">
<div className="max-w-xl text-center">
<h1 className="mb-4 text-4xl font-bold">{title}</h1>
<p className="mb-8 text-lg text-gray-500 dark:text-alpha-900">
{description}
</p>
<div className="mt-8 rounded-md border bg-gray-100 dark:border-gray-500 dark:bg-gray-700">
<div className="flex flex-col items-center p-4">
<h2 className="mb-4 text-xl">Step 1: Connect your wallet</h2>
<ConnectButton />
</div>
<div className="flex flex-col items-center border-t p-4 dark:border-gray-500">
<h2 className="mb-4 text-xl">Step 2: Authenticate your wallet</h2>
<SignTokenButton handleRedirect={() => handleRedirect?.()} />
</div>
</div>
</div>
</div>
);
};
6 changes: 1 addition & 5 deletions src/components/RainbowKitClientProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use client'

import type React from 'react'
import { iqTestnet } from '../lib/data/iqTestnet'
import { iqWikiTheme } from '../lib/data/rainbowKitTheme'
Expand Down Expand Up @@ -55,9 +53,7 @@ export function RainbowKitClientProvider({
return (
<WagmiProvider config={defaultConfig} initialState={initialStates}>
<QueryClientProvider client={queryClient}>
<RainbowKitProvider avatar={CustomAvatar} theme={iqWikiTheme}>
{children}
</RainbowKitProvider>
<RainbowKitProvider theme={iqWikiTheme}>{children}</RainbowKitProvider>
</QueryClientProvider>
</WagmiProvider>
)
Expand Down
2 changes: 0 additions & 2 deletions src/components/SignTokenButton.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use client'

import { useAccount } from 'wagmi'
import { useEffect } from 'react'
import { useAuth } from '../lib/hooks/useAuth'
Expand Down
16 changes: 9 additions & 7 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
'use client'

// Components
export * from './components/CustomAvatar'
export * from './components/RainbowKitClientProvider'
export * from './components/Login'
export * from './components/SignTokenButton'
export { CustomAvatar } from './components/CustomAvatar'
export { RainbowKitClientProvider } from './components/RainbowKitClientProvider'
export { Login } from './components/Login'
export { SignTokenButton } from './components/SignTokenButton'

// Data
export * from './lib/data/iqTestnet'
export * from './lib/data/rainbowKitTheme'
export { iqTestnet } from './lib/data/iqTestnet'
export { iqWikiTheme } from './lib/data/rainbowKitTheme'

// Integrations
export * from './lib/integrations/web3-auth-connector'
export { rainbowWeb3AuthConnector } from './lib/integrations/web3-auth-connector'

0 comments on commit 2cd7cba

Please sign in to comment.