1414 * limitations under the License.
1515 */
1616
17+ import { SvgIcon } from '@/components/Image' ;
1718import { capitalize } from '@/utils' ;
1819
19- import SocialLink from './SocialLink' ;
20-
2120const socialKeyMap = {
2221 github : 'user_github' ,
2322 discord : 'user_discord' ,
@@ -36,18 +35,65 @@ function resolveLinks({ social, web3Bio = [] }) {
3635 return web3Bio . reduce ( ( p , c ) => [ ] . concat ( p , filterExistsInOpenBuild ( c . links , social ) ) , [ ] ) ;
3736}
3837
38+ function socialsConfig ( type ) {
39+ switch ( type ) {
40+ case 'farcaster' :
41+ return {
42+ icon : 'farcaster-purple' ,
43+ color : '#8A63D21A' ,
44+ } ;
45+ case 'lens' :
46+ return {
47+ icon : 'lens-green' ,
48+ color : '#6BC6741A' ,
49+ } ;
50+ case 'basenames' :
51+ return {
52+ icon : 'basenames-blue' ,
53+ color : '#0052FF1A' ,
54+ } ;
55+ default :
56+ return {
57+ icon : 'link' ,
58+ color : '#1A1A1A1A' ,
59+ } ;
60+ }
61+ }
62+
3963function Web3BioProfile ( { data } ) {
4064 const links = resolveLinks ( data ) ;
4165
42- return links . length > 0 && (
43- < >
44- < p className = "mt-6 uppercase text-xs opacity-60 font-bold" > More from < a className = "underline" href = { `https://web3.bio/${ data . social . user_wallet } ` } target = "_blank" rel = "noreferrer" > web3.bio</ a > </ p >
45- < div className = "border border-gray-600 rounded overflow-hidden mt-2" >
46- { links . map ( ( [ k , profile ] ) => (
47- < SocialLink key = { `web3bio-social-${ k } ` } icon = "link" url = { profile . link } > { specialTextMap [ k ] || capitalize ( k ) } </ SocialLink >
48- ) ) }
49- </ div >
50- </ >
66+ return (
67+ links . length > 0 && (
68+ < >
69+ < div className = "mt-6 text-xs flex gap-1" >
70+ < p className = "uppercase opacity-60 font-bold flex-1" > Onchain Identities</ p >
71+ < div className = "opacity-40" > Built with</ div >
72+ < a className = "" href = { `https://web3.bio/${ data . social . user_wallet } ` } target = "_blank" rel = "noreferrer" >
73+ web3.bio
74+ </ a >
75+ </ div >
76+
77+ < div className = "mt-3 flex gap-2 flex-wrap" >
78+ { links . map ( ( [ k , profile ] ) => (
79+ < a
80+ key = { `web3bio-social-${ k } ` }
81+ className = "flex gap-1 rounded-[6px] px-1 h-7 text-sm border items-center"
82+ style = { {
83+ borderColor : socialsConfig ( k ) . color ,
84+ backgroundColor : socialsConfig ( k ) . color ,
85+ } }
86+ href = { profile . link }
87+ target = "_blank"
88+ rel = "noreferrer"
89+ >
90+ < SvgIcon name = { socialsConfig ( k ) . icon } size = { 16 } />
91+ { specialTextMap [ k ] || capitalize ( k ) }
92+ </ a >
93+ ) ) }
94+ </ div >
95+ </ >
96+ )
5197 ) ;
5298}
5399
0 commit comments