22
33import { AddressInput , BaseInput } from "@scaffold-ui/components" ;
44import { useAddressInput } from "@scaffold-ui/hooks" ;
5- import { useState } from "react" ;
5+ import { useTheme } from "next-themes" ;
6+ import { CSSProperties , useState } from "react" ;
67import { Address } from "viem" ;
78
89export const UseAddressInputExample = ( ) => {
910 const [ value , setValue ] = useState < string > ( "" ) ;
11+ const { theme } = useTheme ( ) ;
12+ const isDark = theme === "dark" ;
1013
1114 const [ manualImplementationValue , setManualImplementationValue ] = useState < string > ( "" ) ;
1215 const { ensAddress, ensName, ensAvatar, isEnsAddressLoading, isEnsNameLoading, isEnsAvatarLoading } = useAddressInput (
@@ -22,7 +25,9 @@ export const UseAddressInputExample = () => {
2225 < div className = "space-y-8" >
2326 { /* AddressInput Component Examples */ }
2427 < div className = "space-y-4" >
25- < h2 className = "text-xl font-semibold text-gray-200" > AddressInput Component Examples</ h2 >
28+ < h2 className = "text-xl font-semibold text-[var(--color-sui-primary-content)]" >
29+ AddressInput Component Examples
30+ </ h2 >
2631
2732 < div className = "space-y-4" >
2833 < div className = "flex flex-col" >
@@ -45,21 +50,41 @@ export const UseAddressInputExample = () => {
4550 < AddressInput
4651 value = { value }
4752 onChange = { setValue }
48- colors = { {
49- border : "#22c55e" ,
50- background : "#dcfce7" ,
51- text : "#166534" ,
52- } }
53+ style = {
54+ {
55+ "--color-sui-input-border" : isDark ? "#4ade80" : "#22c55e" ,
56+ "--color-sui-input-background" : isDark ? "#14532d" : "#dcfce7" ,
57+ "--color-sui-input-text" : isDark ? "#dcfce7" : "#166534" ,
58+ } as CSSProperties
59+ }
5360 />
5461 </ div >
62+
63+ < div
64+ className = "flex flex-col"
65+ style = {
66+ {
67+ "--color-sui-input-border" : isDark ? "#f87171" : "#ff6b6b" ,
68+ "--color-sui-input-background" : isDark ? "#7f1d1d" : "#fff5f5" ,
69+ "--color-sui-input-text" : isDark ? "#fecaca" : "#d63031" ,
70+ } as React . CSSProperties
71+ }
72+ >
73+ < span className = "text-sm text-gray-500 mb-1" > Custom colors using CSS variables</ span >
74+ < AddressInput value = { value } onChange = { setValue } placeholder = "Enter an address" />
75+ </ div >
5576 </ div >
5677 </ div >
5778
5879 { /* Manual Implementation using useAddress hook */ }
5980 < div className = "space-y-4 border-t border-gray-700 pt-6" >
60- < h2 className = "text-xl font-semibold text-gray-200" > Manual Implementation (useAddressInput Hook)</ h2 >
81+ < h2 className = "text-xl font-semibold text-[var(--color-sui-primary-content)]" >
82+ Manual Implementation (useAddressInput Hook)
83+ </ h2 >
6184
62- < h3 className = "text-lg font-semibold text-gray-200" > Shows address when ENS is entered and vice versa</ h3 >
85+ < h3 className = "text-lg font-semibold text-[var(--color-sui-primary-content)]" >
86+ Shows address when ENS is entered and vice versa
87+ </ h3 >
6388
6489 { ensAddress ? < div className = "bg-[#dae8ff] items-center" > Address: { ensAddress } </ div > : null }
6590 { ensName ? (
@@ -73,7 +98,7 @@ export const UseAddressInputExample = () => {
7398 }
7499 </ span >
75100 ) : null }
76- < span className = "text-accent px-2" > { ensName } </ span >
101+ < span className = "text-sui-primary px-2" > { ensName } </ span >
77102 </ div >
78103 ) : (
79104 ( isEnsNameLoading || isEnsAddressLoading ) && (
0 commit comments