-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: centralize sticker positioning logic to base sticker component
- Loading branch information
1 parent
f131fb4
commit 53569de
Showing
4 changed files
with
75 additions
and
50 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,16 @@ | ||
.stickerContainer { | ||
.stickerPositionContainer { | ||
position: relative; | ||
display: flex; | ||
} | ||
|
||
.stickerParent { | ||
position: "relative"; | ||
width: 0; | ||
height: 0; | ||
} | ||
|
||
.sticker { | ||
cursor: grab; | ||
position: absolute; | ||
z-index: 100; | ||
} |
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
32 changes: 21 additions & 11 deletions
32
apps/site/src/components/Sticker/Stickers/HeartSticker/HeartSticker.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 |
---|---|---|
@@ -1,16 +1,26 @@ | ||
import HeartEmoji from "@/assets/images/heart_emoji.png"; | ||
import BaseSticker from "../../BaseSticker"; | ||
import { fastShake } from "@/components/animation"; | ||
import React from "react"; | ||
|
||
export default function HeartSticker(style: any) { | ||
return ( | ||
<BaseSticker | ||
style={{ ...style }} | ||
imageSrc={HeartEmoji.src} | ||
alt="heart emoji sticker" | ||
height={150} | ||
width={150} | ||
{...fastShake} | ||
/> | ||
); | ||
interface HeartStickerProps { | ||
children: React.ReactNode; | ||
position?: "top-left" | "top-right" | "bottom-left" | "bottom-right"; | ||
} | ||
|
||
const HeartSticker = React.forwardRef< | ||
React.ElementRef<typeof BaseSticker>, | ||
HeartStickerProps | ||
>(({ ...props }, ref) => ( | ||
<BaseSticker | ||
imageSrc={HeartEmoji.src} | ||
alt="heart emoji sticker" | ||
height={150} | ||
width={150} | ||
{...fastShake} | ||
{...props} | ||
/> | ||
)); | ||
HeartSticker.displayName = "HeartSticker"; | ||
|
||
export default HeartSticker; |
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