Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: home community ui & hot community quantity #631

Merged
merged 1 commit into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 15 additions & 11 deletions apps/u3/src/components/explore/posts/ImgPostCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,11 @@ function FirstCard({ data, ...wrapperProps }: Props) {
</AuthorDisplayName>
</UserNameWrapper>
</div>
{!isMobile && <RecReason>{recReason}</RecReason>}
<div className="flex items-center gap-[10px]">
{platformIconUrl && <PlatformIcon src={platformIconUrl} />}
<RecReason>{recReason}</RecReason>
</div>
</div>

{platformIconUrl && <PlatformIcon src={platformIconUrl} />}
</div>
</CardBody>
</CardWrapper>
Expand Down Expand Up @@ -139,9 +140,11 @@ function RightCard({ idx, data, ...wrapperProps }: Props) {
{authorDisplayName} {authorHandle && `@${authorHandle}`}
</AuthorDisplayName>
</UserNameWrapper>
{!isMobile && <RecReason>{recReason}</RecReason>}
<div className="flex items-center gap-[10px]">
{platformIconUrl && <PlatformIcon src={platformIconUrl} />}
<RecReason>{recReason}</RecReason>
</div>
</div>
{platformIconUrl && <PlatformIcon src={platformIconUrl} />}
</div>
</div>
</CardBody>
Expand Down Expand Up @@ -194,9 +197,11 @@ function BottomCard({ idx, data, ...wrapperProps }: Props) {
{authorDisplayName} {authorHandle && `@${authorHandle}`}
</AuthorDisplayName>
</UserNameWrapper>
{!isMobile && <RecReason>{recReason}</RecReason>}
<div className="flex items-center gap-[10px]">
{platformIconUrl && <PlatformIcon src={platformIconUrl} />}
<RecReason>{recReason}</RecReason>
</div>
</div>
{platformIconUrl && <PlatformIcon src={platformIconUrl} />}
</div>
</div>
</CardBody>
Expand All @@ -223,7 +228,7 @@ function CardBody({ className, ...props }: ComponentPropsWithRef<'div'>) {
<div
className={cn(
'w-full h-full [transition:all_0.3s] flex gap-[20px] relative',
isMobile ? 'flex-col gap-[10px]' : '',
'max-sm:flex-col max-sm:gap-[10px]',
className || ''
)}
{...props}
Expand All @@ -236,7 +241,7 @@ function Title({ className, ...props }: ComponentPropsWithRef<'span'>) {
<span
className={cn(
'font-bold text-[18px] leading-[19px] text-[#ffffff]',
isMobile ? 'text-[16px] leading-[19px] font-medium' : '',
'max-sm:text-[16px] max-sm:leading-[19px] max-sm:font-medium',
className || ''
)}
{...props}
Expand Down Expand Up @@ -311,8 +316,7 @@ function PlatformIcon({ className, ...props }: ComponentPropsWithRef<'img'>) {
return (
<img
className={cn(
'w-[30px] h-[30px] rounded-[50%] object-cover flex-shrink-0',
isMobile ? 'w-[14px] h-[14px]' : '',
'w-[14px] h-[14px] rounded-[50%] object-cover flex-shrink-0',
className || ''
)}
alt=""
Expand Down
33 changes: 18 additions & 15 deletions apps/u3/src/components/explore/posts/PostCard.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import styled, { StyledComponentPropsWithRef } from 'styled-components';

import { isMobile } from 'react-device-detect';
import { ComponentPropsWithRef } from 'react';
import CardBase from '../../common/card/CardBase';
import EllipsisText from '../../common/text/EllipsisText';
import { HeartIcon3 } from '../../common/icons/HeartIcon';
import { cn } from '@/lib/utils';

export type PostCardData = {
title: string;
Expand Down Expand Up @@ -43,10 +45,11 @@ export default function PostCard({ data, ...wrapperProps }: Props) {
{authorDisplayName} {authorHandle && `@${authorHandle}`}
</AuthorDisplayName>
</UserWrapper>
{!isMobile && <RecReason>{recReason}</RecReason>}
<div className="flex items-center gap-[10px]">
{platformIconUrl && <PlatformIcon src={platformIconUrl} />}
<RecReason>{recReason}</RecReason>
</div>
</BottomLeft>

{platformIconUrl && <PlatformIcon src={platformIconUrl} />}
</BottomWrapper>
</CardBody>
</CardWrapper>
Expand Down Expand Up @@ -234,15 +237,15 @@ const RecReason = styled.div`
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
`;
const PlatformIcon = styled.img`
width: 30px;
height: 30px;
border-radius: 50%;
object-fit: cover;
flex-shrink: 0;
${isMobile &&
`
width: 14px;
height: 14px;
`}
`;
function PlatformIcon({ className, ...props }: ComponentPropsWithRef<'img'>) {
return (
<img
className={cn(
'w-[14px] h-[14px] rounded-[50%] object-cover flex-shrink-0',
className || ''
)}
alt=""
{...props}
/>
);
}
2 changes: 1 addition & 1 deletion apps/u3/src/container/explore/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ export default function Home() {
});

fetchTrendingCommunities({
pageSize: 3,
pageSize: 6,
pageNumber: 1,
})
.then((res) => {
Expand Down