Skip to content

Commit

Permalink
Merge pull request #151 from DDD-Community/feature/6th-qa
Browse files Browse the repository at this point in the history
[FEATURE] 6차 QA
  • Loading branch information
hwanheejung authored Jan 6, 2025
2 parents 4280055 + 82e2032 commit 2c74c3c
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 60 deletions.
28 changes: 15 additions & 13 deletions src/app/board/[boardId]/decorate/_components/DecorateScreenshot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,22 +98,24 @@ const DecorateScreenshot = () => {
</div>
</header>
{previewUrl && (
<div
id="preview"
className="relative aspect-[9/16] w-auto overflow-hidden shadow-screenshot"
>
<>
<OpenStickerModalBtn>
<SelectSticker />
</OpenStickerModalBtn>
<Sticker />
<Image
src={previewUrl}
alt="screenshot"
width={1080}
height={1920}
className="aspect-[9/16] max-h-full w-auto object-contain"
/>
</div>
<div
id="preview"
className="relative aspect-[9/16] w-auto overflow-hidden shadow-screenshot"
>
<Sticker isDecorating={isDecorating} />
<Image
src={previewUrl}
alt="screenshot"
width={1080}
height={1920}
className="aspect-[9/16] max-h-full w-auto object-contain"
/>
</div>
</>
)}
<div className="mb-5 w-full">
{isDownloaded && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const OpenStickerModalBtn = ({ children }: OpenModalBtnProps) => {
}

return (
<div className="absolute right-0 z-10">
<div className="absolute right-7 top-14 z-10">
<DecorateTutorial step={1} tooltip={<Step1Tooltip />} hasNext>
<StickerIcon onClick={openStickerModal} className="cursor-pointer" />
</DecorateTutorial>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ const DeleteBtn = {
type="button"
className="h-6 w-6 rounded-full bg-gray-1000"
onClick={() => deleteSticker(file)}
onTouchEnd={() => deleteSticker(file)}
aria-label="Delete sticker"
>
<CloseIcon className="text-gray-0" />
Expand Down
95 changes: 52 additions & 43 deletions src/app/board/[boardId]/decorate/_components/Sticker/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ import Selecto from 'react-selecto'
import { useSticker } from '../../_contexts/StickerContext'
import DeleteBtn from './DeleteBtn'

const Sticker = () => {
interface StickerProps {
isDecorating: boolean
}

const Sticker = ({ isDecorating }: StickerProps) => {
const [targets, setTargets] = useState<Array<SVGElement | HTMLElement>>([])
const moveableRef = useRef<Moveable>(null)
const selectoRef = useRef<Selecto>(null)
Expand Down Expand Up @@ -36,48 +40,53 @@ const Sticker = () => {

return (
<div>
<Moveable
ref={moveableRef}
ables={[DeleteBtn]}
props={{
editable: true,
file: targetedStickerId,
deleteSticker,
}}
draggable
target={targets}
rotatable={{
renderDirections: ['se'],
}}
resolveAblesWithRotatable={{
resizable: ['se'],
}}
resizable={{
renderDirections: false,
}}
rotateAroundControls
onRender={(e) => {
e.target.style.cssText += e.cssText
}}
/>
<Selecto
ref={selectoRef}
selectableTargets={['.sticker']}
hitRate={100}
selectByClick
selectFromInside={false}
ratio={0}
onSelectEnd={(e) => {
const moveable = moveableRef.current!
if (e.isDragStart) {
e.inputEvent.preventDefault()
moveable
.waitToChangeTarget()
.then(() => moveable.dragStart(e.inputEvent))
}
setTargets(e.selected)
}}
/>
{isDecorating && (
<>
<Moveable
ref={moveableRef}
ables={[DeleteBtn]}
props={{
editable: true,
file: targetedStickerId,
deleteSticker,
}}
draggable
target={targets}
rotatable={{
renderDirections: ['se'],
}}
resolveAblesWithRotatable={{
resizable: ['se'],
}}
resizable={{
renderDirections: false,
}}
rotateAroundControls
onRender={(e) => {
e.target.style.cssText += e.cssText
}}
/>
<Selecto
ref={selectoRef}
selectableTargets={['.sticker']}
hitRate={100}
selectByClick
selectFromInside={false}
ratio={0}
onSelectEnd={(e) => {
const moveable = moveableRef.current!
if (e.isDragStart) {
e.inputEvent.preventDefault()
moveable
.waitToChangeTarget()
.then(() => moveable.dragStart(e.inputEvent))
}
setTargets(e.selected)
}}
/>
</>
)}

<div className="absolute left-1/2 top-0 z-10">
{selectedStickers.map(({ id, file }) => (
<div
Expand Down
4 changes: 1 addition & 3 deletions src/components/Tutorial/Tutorial.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,7 @@ const Tutorial = ({

updateOverlayStyle()

return () => {
observer.disconnect()
}
return () => observer.disconnect()
}
return undefined
}, [isOpen])
Expand Down

0 comments on commit 2c74c3c

Please sign in to comment.