File tree Expand file tree Collapse file tree
apps/app/src/app/(app)/[orgId]/referrals/components Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11'use client' ;
22
3+ import { Skeleton } from '@comp/ui/skeleton' ;
34import { DubEmbed } from '@dub/embed-react' ;
5+ import { useTheme } from 'next-themes' ;
46import { useEffect , useState } from 'react' ;
57
68export const DubReferral = ( ) => {
79 const [ publicToken , setPublicToken ] = useState ( '' ) ;
810 const [ error , setError ] = useState < string | null > ( null ) ;
911 const [ isLoading , setIsLoading ] = useState ( true ) ;
12+ const { theme } = useTheme ( ) ;
1013
1114 useEffect ( ( ) => {
1215 const fetchPublicToken = async ( ) => {
@@ -39,7 +42,11 @@ export const DubReferral = () => {
3942 } , [ ] ) ;
4043
4144 if ( isLoading ) {
42- return < div > Loading...</ div > ;
45+ return (
46+ < div className = "flex items-center justify-center" >
47+ < Skeleton className = "h-[100vh] w-full max-w-[1024px] rounded-none" />
48+ </ div >
49+ ) ;
4350 }
4451
4552 if ( error ) {
@@ -75,5 +82,15 @@ export const DubReferral = () => {
7582 ) ;
7683 }
7784
78- return < DubEmbed data = "referrals" token = { publicToken } /> ;
85+ const dubTheme = theme === 'dark' ? 'dark' : 'light' ;
86+
87+ return (
88+ < DubEmbed
89+ data = "referrals"
90+ token = { publicToken }
91+ options = { {
92+ theme : dubTheme ,
93+ } }
94+ />
95+ ) ;
7996} ;
You can’t perform that action at this time.
0 commit comments