-
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.
* update: removed deadzone * feat: position stickers relative to page elements * refactor: centralize sticker positioning logic to base sticker component * fix: position value wrapped with quotes * refactor: remove unnecessary forwardRef on sticker * feat: sticker positioning component * fix: remove extraneous broken sticker layout component * feat: remove hack sticker from button --------- Co-authored-by: Tyler Yu <[email protected]>
- Loading branch information
1 parent
cca3883
commit ff15acf
Showing
13 changed files
with
142 additions
and
71 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,5 @@ | ||
.stickerContainer { | ||
.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
12 changes: 12 additions & 0 deletions
12
apps/site/src/components/Sticker/StickerPosition.module.scss
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,12 @@ | ||
.stickerPosition { | ||
position: relative; | ||
display: flex; | ||
justify-content: center; | ||
width: max-content; | ||
} | ||
|
||
.stickerParent { | ||
position: relative; | ||
width: 0; | ||
height: 0; | ||
} |
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,56 @@ | ||
import type { StickerProps } from "./Stickers/stickerProps"; | ||
import styles from "./StickerPosition.module.scss"; | ||
|
||
interface Sticker { | ||
Node: React.ComponentType<StickerProps>; | ||
positionX?: "left" | "right"; | ||
positionY?: "top" | "bottom"; | ||
offsetX?: number; | ||
offsetY?: number; | ||
} | ||
|
||
const StickerParent: React.FC<Sticker> = ({ | ||
Node, | ||
positionY = "top", | ||
offsetX, | ||
offsetY, | ||
}) => ( | ||
<div | ||
className={styles.stickerParent} | ||
style={{ | ||
alignSelf: positionY === "top" ? "flex-start" : "flex-end", | ||
}} | ||
> | ||
<Node offsetX={offsetX} offsetY={offsetY} /> | ||
</div> | ||
); | ||
|
||
interface StickerPositionProps { | ||
children?: React.ReactNode; | ||
stickers: Sticker[]; | ||
} | ||
|
||
const StickerPosition: React.FC<StickerPositionProps> = ({ | ||
children, | ||
stickers, | ||
}) => { | ||
return ( | ||
<div className={styles.stickerPosition}> | ||
{stickers | ||
.filter(({ positionX }) => !positionX || positionX === "left") | ||
.map((sticker) => ( | ||
// eslint-disable-next-line react/jsx-key | ||
<StickerParent {...sticker} /> | ||
))} | ||
{children} | ||
{stickers | ||
.filter(({ positionX }) => positionX === "right") | ||
.map((sticker) => ( | ||
// eslint-disable-next-line react/jsx-key | ||
<StickerParent {...sticker} /> | ||
))} | ||
</div> | ||
); | ||
}; | ||
|
||
export default StickerPosition; |
3 changes: 0 additions & 3 deletions
3
apps/site/src/components/Sticker/Stickers/HackSticker/HackSticker.module.scss
This file was deleted.
Oops, something went wrong.
28 changes: 14 additions & 14 deletions
28
apps/site/src/components/Sticker/Stickers/HackSticker/HackSticker.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,18 +1,18 @@ | ||
import type React from "react"; | ||
import type { StickerProps } from "../stickerProps"; | ||
import HackLogo from "@/assets/icons/hack.png"; | ||
import BaseSticker from "../../BaseSticker"; | ||
import styles from "./HackSticker.module.scss"; | ||
import { lightShake } from "@/components/animation"; | ||
|
||
export default function HackSticker({ style }: { style?: object | undefined }) { | ||
return ( | ||
<div className={styles.stickerContainer} style={{ ...style }}> | ||
<BaseSticker | ||
imageSrc={HackLogo.src} | ||
alt="Hack at UCI sticker" | ||
height={200} | ||
width={200} | ||
{...lightShake} | ||
/> | ||
</div> | ||
); | ||
} | ||
const HackSticker: React.FC<StickerProps> = (props) => ( | ||
<BaseSticker | ||
imageSrc={HackLogo.src} | ||
alt="Hack at UCI sticker" | ||
height={200} | ||
width={200} | ||
{...lightShake} | ||
{...props} | ||
/> | ||
); | ||
|
||
export default HackSticker; |
31 changes: 14 additions & 17 deletions
31
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,21 +1,18 @@ | ||
import type React from "react"; | ||
import type { StickerProps } from "../stickerProps"; | ||
import HeartEmoji from "@/assets/images/heart_emoji.png"; | ||
import BaseSticker from "../../BaseSticker"; | ||
import { fastShake } from "@/components/animation"; | ||
|
||
export default function HeartSticker({ | ||
style, | ||
}: { | ||
style?: object | undefined; | ||
}) { | ||
return ( | ||
<div style={{ ...style }}> | ||
<BaseSticker | ||
imageSrc={HeartEmoji.src} | ||
alt="heart emoji sticker" | ||
height={150} | ||
width={150} | ||
{...fastShake} | ||
/> | ||
</div> | ||
); | ||
} | ||
const HeartSticker: React.FC<StickerProps> = (props) => ( | ||
<BaseSticker | ||
imageSrc={HeartEmoji.src} | ||
alt="heart emoji sticker" | ||
height={150} | ||
width={150} | ||
{...fastShake} | ||
{...props} | ||
/> | ||
); | ||
|
||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export interface StickerProps { | ||
offsetX?: number; | ||
offsetY?: number; | ||
} |
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
30 changes: 22 additions & 8 deletions
30
apps/site/src/views/Home/components/ApplyButton/ApplyButton.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,17 +1,31 @@ | ||
import Button from "react-bootstrap/Button"; | ||
import StickerPosition from "@/components/Sticker/StickerPosition"; | ||
import { HackSticker, HeartSticker } from "@/components/Sticker/Stickers"; | ||
|
||
import styles from "./ApplyButton.module.scss"; | ||
|
||
export default function ApplyButton() { | ||
return ( | ||
<Button | ||
className={styles.applyButton} | ||
href="/apply" | ||
variant="" | ||
target="_blank" | ||
disabled | ||
<StickerPosition | ||
stickers={[ | ||
{ | ||
Node: HeartSticker, | ||
positionX: "right", | ||
positionY: "bottom", | ||
offsetX: 50, | ||
offsetY: 50, | ||
}, | ||
]} | ||
> | ||
<div>Applications have closed!</div> | ||
</Button> | ||
<Button | ||
className={styles.applyButton} | ||
href="/apply" | ||
variant="" | ||
target="_blank" | ||
disabled | ||
> | ||
<span>Applications have closed!</span> | ||
</Button> | ||
</StickerPosition> | ||
); | ||
} |
16 changes: 0 additions & 16 deletions
16
apps/site/src/views/Home/components/StickerLayout/StickerLayout.tsx
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