Skip to content

Commit

Permalink
feat: #311 대규모레이아웃변경 이슈로 인해 스켈레톤삭제
Browse files Browse the repository at this point in the history
  • Loading branch information
bomi8489 committed Jul 16, 2024
1 parent b1397c1 commit dc2ede9
Show file tree
Hide file tree
Showing 8 changed files with 73 additions and 191 deletions.
43 changes: 20 additions & 23 deletions src/app/(routes)/space/[spaceId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import Button from '@/components/common/Button/Button'
import DeferredComponent from '@/components/common/DeferedComponent/DeferedComponent'
import useViewLink from '@/components/common/LinkList/hooks/useViewLink'
import Space from '@/components/common/Space/Space'
import SpaceSkeleton from '@/components/common/Space/SpaceSkeleton'
import useGetSpace from '@/components/common/Space/hooks/useGetSpace'
import useGetTags from '@/components/common/Space/hooks/useGetTags'
import Tab from '@/components/common/Tab/Tab'
Expand Down Expand Up @@ -37,29 +36,27 @@ const SpacePage = ({ params }: { params: { spaceId: number } }) => {
})
const { tag, tagIndex, handleTagChange } = useTagParam({ tags })

return (
return isSpaceLoading || isTagsLoading ? (
<DeferredComponent>
<Spinner />
</DeferredComponent>
) : (
<>
{isSpaceLoading ? (
<DeferredComponent>
<SpaceSkeleton />
</DeferredComponent>
) : (
space && (
<Space
type="Header"
userName={space.memberDetailInfos[0].nickname}
spaceId={space.spaceId}
spaceName={space.spaceName}
spaceImage={space.spaceImagePath}
description={space.description}
category={CATEGORIES_RENDER[space.category]}
scrap={space.scrapCount}
favorite={space.favoriteCount}
hasFavorite={space.hasFavorite}
hasScrap={space.hasScrap}
isVisible={space.isVisible}
/>
)
{space && (
<Space
type="Header"
userName={space.memberDetailInfos[0].nickname}
spaceId={space.spaceId}
spaceName={space.spaceName}
spaceImage={space.spaceImagePath}
description={space.description}
category={CATEGORIES_RENDER[space.category]}
scrap={space.scrapCount}
favorite={space.favoriteCount}
hasFavorite={space.hasFavorite}
hasScrap={space.hasScrap}
isVisible={space.isVisible}
/>
)}
{tabList.length > MIN_TAB_NUMBER && (
<Tab>
Expand Down
63 changes: 30 additions & 33 deletions src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { CategoryList, Dropdown, LinkItem, Spinner } from '@/components'
import FloatingButton from '@/components/FloatingButton/FloatingButton'
import { ChipColors } from '@/components/common/Chip/Chip'
import DeferredComponent from '@/components/common/DeferedComponent/DeferedComponent'
import LinkItemSkeleton from '@/components/common/LinkItem/LinkItemSkeleton'
import MainSpaceList from '@/components/common/MainSpaceList/MainSpaceList'
import { useCategoryParam, useSortParam } from '@/hooks'
import useGetPopularLinks from '@/hooks/useGetPopularLinks'
Expand All @@ -22,41 +21,39 @@ export default function Home() {
const { category, categoryIndex, handleCategoryChange } =
useCategoryParam('all')

return (
return isPopularLinksLoading ? (
<DeferredComponent>
<Spinner />
</DeferredComponent>
) : (
<>
<section className="px-4 pb-8">
<h2 className="py-4 font-bold text-gray9">인기있는 링크</h2>
{isPopularLinksLoading ? (
<DeferredComponent>
<LinkItemSkeleton type="card" />
</DeferredComponent>
) : (
links && (
<Swiper
slidesPerView={2.1}
spaceBetween={16}
freeMode={true}
pagination={{
clickable: true,
}}
modules={[FreeMode]}
className="mySwiper">
{links.map((link: PopularLinkResBody) => (
<SwiperSlide key={link.linkId}>
<LinkItem
linkId={link.linkId}
title={link.title}
url={link.url}
tagName={link.tagName}
tagColor={link.tagColor as ChipColors}
isInitLiked={link.isLiked}
likeInitCount={link.likeCount}
type="card"
/>
</SwiperSlide>
))}
</Swiper>
)
{links && (
<Swiper
slidesPerView={2.1}
spaceBetween={16}
freeMode={true}
pagination={{
clickable: true,
}}
modules={[FreeMode]}
className="mySwiper">
{links.map((link: PopularLinkResBody) => (
<SwiperSlide key={link.linkId}>
<LinkItem
linkId={link.linkId}
title={link.title}
url={link.url}
tagName={link.tagName}
tagColor={link.tagColor as ChipColors}
isInitLiked={link.isLiked}
likeInitCount={link.likeCount}
type="card"
/>
</SwiperSlide>
))}
</Swiper>
)}
</section>
<section>
Expand Down
41 changes: 21 additions & 20 deletions src/components/common/FollowList/FollowList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,26 +45,27 @@ const FollowList = ({
</DeferredComponent>
) : (
<ul className="flex flex-col gap-y-2">
{followList?.pages.map((group, i) => (
<Fragment key={i}>
{group.responses?.map((user: FollowUserProps) => (
<li key={user.memberId}>
<User
memberId={user.memberId}
nickname={user.nickname}
profileImagePath={user.profileImagePath}
aboutMe={user.aboutMe}
isFollowing={user.isFollowing}
isAuth={myId === user.memberId}
followingCount={followingCount}
myId={myId}
profileId={memberId}
setFollowingCount={setFollowingCount}
/>
</li>
))}
</Fragment>
))}
{followList &&
followList.pages.map((group, i) => (
<Fragment key={i}>
{group.responses?.map((user: FollowUserProps) => (
<li key={user.memberId}>
<User
memberId={user.memberId}
nickname={user.nickname}
profileImagePath={user.profileImagePath}
aboutMe={user.aboutMe}
isFollowing={user.isFollowing}
isAuth={myId === user.memberId}
followingCount={followingCount}
myId={myId}
profileId={memberId}
setFollowingCount={setFollowingCount}
/>
</li>
))}
</Fragment>
))}
<div ref={target}></div>
</ul>
)
Expand Down
36 changes: 0 additions & 36 deletions src/components/common/LinkItem/LinkItemSkeleton.tsx

This file was deleted.

4 changes: 2 additions & 2 deletions src/components/common/MainSpaceList/MainSpaceList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import useInfiniteScroll from '@/hooks/useInfiniteScroll'
import { SearchSpaceReqBody, SpaceResBody } from '@/types'
import DeferredComponent from '../DeferedComponent/DeferedComponent'
import Space from '../Space/Space'
import MainSpaceSkeleton from './MainSpaceSkeleton'
import Spinner from '../Spinner/Spinner'

export interface SpaceListProps {
memberId?: number
Expand Down Expand Up @@ -50,7 +50,7 @@ const MainSpaceList = ({

return isSpacesLoading ? (
<DeferredComponent>
<MainSpaceSkeleton />
<Spinner />
</DeferredComponent>
) : (
<>
Expand Down
25 changes: 0 additions & 25 deletions src/components/common/MainSpaceList/MainSpaceSkeleton.tsx

This file was deleted.

14 changes: 0 additions & 14 deletions src/components/common/Skeleton/Skeleton.tsx

This file was deleted.

38 changes: 0 additions & 38 deletions src/components/common/Space/SpaceSkeleton.tsx

This file was deleted.

0 comments on commit dc2ede9

Please sign in to comment.