-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #106 from DDD-Community/97-feature-폴라로이드-디자인-개선
[FEATURE/97] 폴라로이드 디자인 개선, 닉네임 추가
- Loading branch information
Showing
27 changed files
with
594 additions
and
389 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
src/app/(board)/board/[boardId]/_components/PolaroidList/PolaroidListItem.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { useEffect, useState } from 'react' | ||
import { Polaroid } from '@/types' | ||
import PolaroidCard from '@/components/Polaroid/PolaroidCard' | ||
|
||
interface PolaroidListItemProps { | ||
item: Polaroid | ||
onClick: () => void | ||
} | ||
|
||
const PolaroidListItem = ({ item, onClick }: PolaroidListItemProps) => { | ||
const [rotate, setRotate] = useState<number>(0) | ||
useEffect(() => { | ||
const randomRotate = | ||
Math.random() > 0.5 ? Math.random() + 1 : Math.random() * -1 - 1 | ||
setRotate(randomRotate) | ||
}, []) | ||
|
||
return ( | ||
<div | ||
className="flex flex-col justify-center" | ||
onClick={onClick} | ||
style={{ rotate: `${rotate}deg` }} | ||
> | ||
<PolaroidCard polaroid={item} /> | ||
</div> | ||
) | ||
} | ||
|
||
export default PolaroidListItem |
43 changes: 43 additions & 0 deletions
43
src/app/(board)/board/[boardId]/_components/PolaroidList/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
'use client' | ||
|
||
import { Polaroid } from '@/types' | ||
import { useState } from 'react' | ||
import PolaroidDetailModal from '@/components/Polaroid/PolaroidDetail' | ||
import PolaroidListItem from './PolaroidListItem' | ||
|
||
interface PolaroidListProps { | ||
polaroids: Polaroid[] | ||
} | ||
|
||
const PolaroidList = ({ polaroids }: PolaroidListProps) => { | ||
const [isModalOpen, setIsModalOpen] = useState(false) | ||
const [selectedPolaroid, setSelectedPolaroid] = useState<Polaroid | null>( | ||
null, | ||
) | ||
|
||
const openDetailModal = (polaroid: Polaroid) => { | ||
setSelectedPolaroid(polaroid) | ||
setIsModalOpen(true) | ||
} | ||
|
||
return ( | ||
<div className="mx-auto w-full flex-1 overflow-x-hidden overflow-y-scroll scrollbar-hide"> | ||
<div className="grid grid-cols-2 gap-6 px-[20px] py-[10px]"> | ||
{polaroids.map((item) => ( | ||
<PolaroidListItem | ||
key={item.id} | ||
item={item} | ||
onClick={() => openDetailModal(item)} | ||
/> | ||
))} | ||
</div> | ||
<PolaroidDetailModal | ||
isOpen={isModalOpen} | ||
onClose={() => setIsModalOpen(false)} | ||
polaroid={selectedPolaroid} | ||
/> | ||
</div> | ||
) | ||
} | ||
|
||
export default PolaroidList |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { HTMLAttributes } from 'react' | ||
import { twMerge } from 'tailwind-merge' | ||
|
||
const PolaroidDescription = ({ | ||
children, | ||
className, | ||
...props | ||
}: HTMLAttributes<HTMLDivElement>) => { | ||
return ( | ||
<div | ||
className={`${twMerge('flex flex-col gap-0.5 px-4 pb-2', className)}`} | ||
style={{ | ||
background: | ||
'linear-gradient(180deg, rgba(255, 255, 255, 0.20) 10.71%, rgba(255, 255, 255, 0.50) 57.96%, rgba(255, 255, 255, 0.00) 100%), #EAEAEA', | ||
}} | ||
{...props} | ||
> | ||
{children} | ||
</div> | ||
) | ||
} | ||
|
||
export default PolaroidDescription |
Oops, something went wrong.