Skip to content

Commit 20b3f01

Browse files
authored
Merge pull request #82 from SeoJaeWan/develop
Deploy
2 parents abdf75c + 631fe87 commit 20b3f01

File tree

9 files changed

+95
-9
lines changed

9 files changed

+95
-9
lines changed

src/components/atoms/admin/listOption/index.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ import { color } from "@/style/theme";
33
import ListOptionStyle from "./listOption.style";
44
import { useEffect, useState } from "react";
55
import { TiLink, TiArrowShuffle, TiArrowLoop } from "react-icons/ti";
6+
import HoverInfo from "../../common/hoverInfo";
67

78
const Img = {
8-
link: { Image: TiLink, size: 22 },
9-
loop: { Image: TiArrowLoop, size: 20 },
10-
shuffle: { Image: TiArrowShuffle, size: 20 },
9+
link: { Image: TiLink, size: 22, label: "공유" },
10+
loop: { Image: TiArrowLoop, size: 20, label: "반복 재생" },
11+
shuffle: { Image: TiArrowShuffle, size: 20, label: "랜덤 셔플" },
1112
};
1213

1314
interface ListOptionProps {
@@ -34,9 +35,11 @@ const ListOption = (props: ListOptionProps) => {
3435

3536
return (
3637
<ListOptionStyle.Container
38+
className="tooltip"
3739
$active={!isActive || active}
3840
onClick={handleClick}
3941
>
42+
<HoverInfo>{Icon.label}</HoverInfo>
4043
<Icon.Image size={Icon.size} color={color.white} />
4144
</ListOptionStyle.Container>
4245
);
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import styled from "styled-components";
2+
3+
interface ContainerProps {
4+
$leftTooltip?: boolean;
5+
}
6+
7+
const Container = styled.span<ContainerProps>`
8+
position: absolute;
9+
top: calc(100% + 5px);
10+
${(props) => (props.$leftTooltip ? "left" : "right")}: 0;
11+
12+
display: inline-block;
13+
14+
width: 60px;
15+
padding: 5px;
16+
17+
background-color: ${(props) => props.theme.color.black};
18+
border-radius: 5px;
19+
20+
color: ${(props) => props.theme.color.white};
21+
22+
visibility: hidden;
23+
opacity: 0;
24+
25+
transition: all 0.5s;
26+
`;
27+
28+
const HoverInfoStyle = {
29+
Container,
30+
};
31+
32+
export default HoverInfoStyle;
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { PropsWithChildren } from "react";
2+
import HoverInfoStyle from "./hoverInfo.style";
3+
4+
interface HoverInfoProps extends PropsWithChildren {
5+
leftTooltip?: boolean;
6+
}
7+
8+
const HoverInfo = (props: HoverInfoProps) => {
9+
const { children, leftTooltip } = props;
10+
11+
return (
12+
<HoverInfoStyle.Container
13+
$leftTooltip={leftTooltip}
14+
className="tooltip-info"
15+
>
16+
{children}
17+
</HoverInfoStyle.Container>
18+
);
19+
};
20+
21+
export default HoverInfo;

src/components/atoms/common/trackController/index.tsx

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,14 @@ import useTrackManager from "@/store/trackManager";
44
import TrackControllerStyle from "./trackController.style";
55
import { color } from "@/style/theme";
66
import { useYoutube } from "@/hooks/useYoutube";
7+
import HoverInfo from "../hoverInfo";
78

8-
const TrackController = () => {
9+
interface TrackControllerProps {
10+
leftTooltip?: boolean;
11+
}
12+
13+
const TrackController = (props: TrackControllerProps) => {
14+
const { leftTooltip } = props;
915
const { isList, updateList } = useTrackManager();
1016
const { list } = useYoutube();
1117

@@ -14,11 +20,18 @@ const TrackController = () => {
1420
};
1521

1622
return (
17-
<TrackControllerStyle.Container onClick={handleUpdateList}>
23+
<TrackControllerStyle.Container
24+
className="tooltip"
25+
onClick={handleUpdateList}
26+
>
27+
<HoverInfo leftTooltip={leftTooltip}>
28+
{isList ? "노래 추가" : "재생 목록"}
29+
</HoverInfo>
30+
1831
{isList ? (
19-
<FaListUl color={color.white} />
20-
) : (
2132
<IoAddOutline color={color.white} size={20} />
33+
) : (
34+
<FaListUl color={color.white} />
2235
)}
2336
</TrackControllerStyle.Container>
2437
);

src/components/molecules/admin/controller/controller.style.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ const MusicTitle = styled.h1`
5555
5656
@media (max-width: ${(props) => props.theme.media.mobile}) {
5757
font-size: ${(props) => props.theme.font(24)};
58+
height: 29px;
5859
}
5960
`;
6061

src/components/molecules/admin/controller/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ const Controller = () => {
4545
return (
4646
<ControllerStyle.Container>
4747
<ControllerStyle.TopController>
48-
<TrackController />
48+
<TrackController leftTooltip />
4949

5050
<ControllerStyle.PlayingBox>
5151
<ListOption type="link" onClick={handleCopyLink} />

src/components/molecules/client/controller/controller.style.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ const Title = styled.h1`
2424
font-weight: 600;
2525
2626
color: ${(props) => props.theme.color.white};
27+
28+
@media (max-width: ${(props) => props.theme.media.mobile}) {
29+
font-size: ${(props) => props.theme.font(24)};
30+
height: 29px;
31+
}
2732
`;
2833

2934
const ControllerStyle = {

src/hooks/useYoutube/index.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,9 @@ const YoutubeProvider = (props: PropsWithChildren) => {
145145
};
146146

147147
const updateVolume = (vol: number) => {
148-
player.current!.setVolume(vol);
148+
if (player.current) {
149+
player.current.setVolume(vol);
150+
}
149151
volume.current = vol;
150152
};
151153

src/style/global/index.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,15 @@ const Global = styled.createGlobalStyle`
5555
#player {
5656
display: none;
5757
}
58+
59+
.tooltip {
60+
position: relative;
61+
62+
&:hover .tooltip-info {
63+
visibility: visible;
64+
opacity: 1;
65+
}
66+
}
5867
`;
5968

6069
export default Global;

0 commit comments

Comments
 (0)