Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/features/rolling-paper/components/rolling-paper-list.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import Avatar from "../../../components/avatar/avatar";
import AVATAR_SIZE from "../../../components/avatar/avatar-size";
import CardBackground from "../../../components/image/card-background";
import { useImageListLodeChecker } from "../../../hooks/use-image-loader";
import { useNavigate } from "react-router";

const CardContainer = styled.div`
display: grid;
Expand Down Expand Up @@ -62,6 +63,7 @@ const CardItem = styled(CardBackground)`
flex-direction: column;
position: relative;
overflow: hidden;
cursor: pointer;

justify-content: space-between;

Expand All @@ -86,6 +88,16 @@ const CardItem = styled(CardBackground)`
: polygonStyle[$backgroundColorForStyle];
}}
}

&:hover {
filter: brightness(0.9);
box-shadow: 0px 6px 16px rgba(0, 0, 0, 0.12);
}
&:active {
filter: brightness(0.8);
transform: translateY(1px);
box-shadow: 0px 3px 8px rgba(0, 0, 0, 0.15);
}
`;

const ellipseStyle = css`
Expand Down Expand Up @@ -277,6 +289,11 @@ const PreviewButtonWrapper = styled.div`
`;

function RollingPaperList({ cardData, totalPages, currentPage, onTurnCards }) {
const navigate = useNavigate();

const handleCardClick = (cardId) => {
navigate(`/post/${cardId}`);
};
const profileImages = useMemo(
() =>
cardData.flatMap((card) =>
Expand All @@ -300,6 +317,7 @@ function RollingPaperList({ cardData, totalPages, currentPage, onTurnCards }) {
backgroundImageURL={card.backgroundImageURL}
backgroundColor={card.backgroundColor}
overlayOn
onClick={() => handleCardClick(card.id)}
>
<CardTitle
$fontColor={card.backgroundImageURL ? "#ffffff" : "#000000"}
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/use-image-loader.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ function useImageLodeChecker(imageURL, noNeedToLoad = false) {
useEffect(() => {
if (noNeedToLoad || !imageURL) return;
const img = new Image();
img.src = imageURL;

const handleLoad = () => setIsLode(true);
const handleError = () => setIsLode(false);

img.addEventListener("load", handleLoad);
img.addEventListener("error", handleError);

img.src = imageURL;
return () => {
img.removeEventListener("load", handleLoad);
img.removeEventListener("error", handleError);
Expand Down