feat(web): add InteractionBar component and integrate with SongCover for 'like' functionality #11

open
opened by tsiry-sandratraina.com targeting main from feat/like-scrobble
Changed files
+26 -4
apps
web
src
components
SongCover
pages
home
feed
+13
apps/web/src/components/SongCover/InteractionBar/InteractionBar.tsx
···
+
import HeartOutline from "../../Icons/HeartOutline";
+
+
function InteractionBar() {
+
return (
+
<div className="absolute bottom-[-1px] left-0 h-[100px] w-full bg-[linear-gradient(rgba(22,24,35,0)_2.92%,rgba(22,24,35,0.5)_98.99%)] flex justify-start items-end p-[10px] rounded-b-[8px]">
+
<div className="h-[40px] w-full flex items-center">
+
<HeartOutline color="#fff" />
+
</div>
+
</div>
+
);
+
}
+
+
export default InteractionBar;
+3
apps/web/src/components/SongCover/InteractionBar/index.tsx
···
+
import InteractionBar from "./InteractionBar";
+
+
export default InteractionBar;
+9 -4
apps/web/src/components/SongCover/SongCover.tsx
···
import { css } from "@emotion/react";
import styled from "@emotion/styled";
+
import InteractionBar from "./InteractionBar";
const Cover = styled.img<{ size?: number }>`
border-radius: 8px;
height: 240px;
width: 240px;
-
margin-bottom: 10px;
+
margin-bottom: -5px;
${(props) =>
props.size &&
css`
···
title?: string;
artist?: string;
size?: number;
+
withLikeButton?: boolean;
};
function SongCover(props: SongCoverProps) {
-
const { title, artist, cover, size } = props;
+
const { title, artist, cover, size, withLikeButton } = props;
return (
<CoverWrapper>
-
<Cover src={cover} size={size} />
-
<div className="mb-[13px]">
+
<div className={`relative h-[100%] w-[92%]`}>
+
{withLikeButton && <InteractionBar />}
+
<Cover src={cover} size={size} />
+
</div>
+
<div className="mb-[13px] mt-[10px]">
<SongTitle className="!text-[var(--color-text-primary)]">
{title}
</SongTitle>
+1
apps/web/src/pages/home/feed/Feed.tsx
···
cover={song.cover}
artist={song.artist}
title={song.title}
+
withLikeButton
/>
</Link>
<div className="flex">