1+ import { ProfileHeaderPlaceholder } from '~/components/placeholders/ProfileHeader'
2+ import { readexPro } from '~/elements/fonts'
3+ import { BannerImage , CompositeImage , Engagements , DynamicIcon , SimpleAvatar , Community , Animation , Author , People , Tags , LargeAvatar } from '~/elements' ;
4+ import { getImageUrl } from '~/utils/main' ;
5+ import Image from 'next/image' ;
6+
7+ const MAX_TITLE = 80
8+ const MAX_INTRO = 120
9+
10+ export const HomeItemCard = ( {
11+ onPress,
12+ isLoading,
13+ title,
14+ banner,
15+ avatar,
16+ username,
17+ intro,
18+ highlight,
19+ wide,
20+ actionTitle,
21+ section,
22+ authorImage,
23+ community,
24+ author,
25+ project,
26+ comments,
27+ upVotes,
28+ followers,
29+ projectImage,
30+ communityImage,
31+ downVotes,
32+ noAction,
33+ members,
34+ tags,
35+ shortIntro
36+ } : any ) => {
37+
38+ if ( isLoading ) {
39+ return < ProfileHeaderPlaceholder />
40+ }
41+
42+ const Username = ( ) => {
43+ if ( ! username ) {
44+ return < div />
45+ }
46+
47+ let fol = followers ? followers . length : 0
48+
49+ return < div className = { `relative z-10 z-10` } >
50+ < h1 className = { `${ readexPro . className } lg:text-2xl text-2xl text-primary` } >
51+ { isLoading ? '' : '@' + username . toLowerCase ( ) }
52+ </ h1 >
53+ { /* <div className='flex flex-row'>
54+ <div className='text-white font-bold mr-1'>
55+ { fol > 0 ? fol : '' }
56+ </div>
57+ <div className='text-gray-400 mt-2'>
58+ { fol === 0 ? 'No followers yet' : fol === 1 ? `follower` : `${fol} followers` }
59+ </div>
60+ </div> */ }
61+ </ div >
62+ }
63+
64+ const CardAuthor = ( ) => {
65+ if ( ! author ) {
66+ if ( community ) {
67+ return < div className = 'flex flex-row mt-2' >
68+ < Community
69+ image = { getImageUrl ( community ) }
70+ username = { community } />
71+ </ div >
72+ }
73+ return < div />
74+ }
75+
76+ return < div className = 'flex flex-row mt-2' >
77+ < Author
78+ image = { getImageUrl ( project || author || '' ) }
79+ community = { community }
80+ username = { project || author } />
81+ </ div >
82+ }
83+
84+ return < div onClick = { onPress } className = { `cursor-pointer flex flex-col justify-start` } >
85+ < LargeAvatar src = { getImageUrl ( username ) } />
86+ < div className = { `${ readexPro . className } mt-1 text-sm text-center` } >
87+ { title }
88+ </ div >
89+ </ div >
90+ }
91+
92+ // { banner && <BannerImage onPress={onPress} wide={wide} isLoading={isLoading} banner={banner} avatar={avatar} section={section} username={username}/> }
93+ // <div onClick={onPress} className="flex flex-col p-4 leading-normal text-left w-full">
94+ // <h4 className={`${readexPro.className} ${wide ? 'text-3xl lg:text-3xl' : 'text-xl lg:text-xl'} tracking-tight dark:text-white ${shortIntro ? 'line-clamp-2' : ''}`}>
95+ // <div className={`${highlight ? '' : 'hidden'} badge badge-success badge-xs animate-pulse text-[#8BC34A] mr-2`}/>
96+ // { title }
97+ // </h4>
98+ // <Username/>
99+ // <CardAuthor/>
100+ // { tags && <Tags tags={tags || []} containerClass="mt-4" /> }
101+ // <p className={`${readexPro.className} text-md font-thin text-gray-400 2xl:w-5/6 mt-4 ${shortIntro ? 'line-clamp-2' : ''}`}>
102+ // { intro }
103+ // </p>
104+ // <div className='flex flex-col items-start pb-10 w-full'>
105+ // {/* { <Engagements comments={comments} upVotes={upVotes} downVotes={downVotes}/> } */ }
106+ // { members && <People size={3} all={members}/> }
107+ // {/* { noAction || <ActionButton highlight={highlight} title={actionTitle} onPress={onPress}/> } */ }
108+ // </div>
109+ // </div>
0 commit comments