Skip to content

Commit

Permalink
Merge pull request #267 from SWM-FIRE/FIRE-765-룸-상단-theme-svg에서-stati…
Browse files Browse the repository at this point in the history
…c-img로-변경

FIRE-765 change theme svg to static img
  • Loading branch information
071yoon authored Oct 18, 2022
2 parents 1e8b203 + 30ea11a commit 4fc6ca7
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 16 deletions.
42 changes: 31 additions & 11 deletions src/components/atoms/ThemeImages.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,49 +7,69 @@ import Travel from '../../assets/theme/travel.png';
import Camping from '../../assets/theme/camp.png';
import { ReactComponent as Bar } from '../../assets/svg/Room/Bar.svg';

export default function ThemeImage({ theme }) {
export default function ThemeImage({ theme, type }) {
if (theme === 'cosmos') {
return (
<Component>
<Img src={Cosmos} alt="cosmos" />
<Name>우주</Name>
<Bar />
{type === 'block' && (
<>
<Name>우주</Name>
<Bar />
</>
)}
</Component>
);
}
if (theme === 'fire') {
return (
<Component>
<Img src={Fire} alt="fire" />
<Name>모닥불</Name>
<Bar />
{type === 'block' && (
<>
<Name>모닥불</Name>
<Bar />
</>
)}
</Component>
);
}
if (theme === 'ocean') {
return (
<Component>
<Img src={Ocean} alt="ocean" />
<Name>바다</Name>
<Bar />
{type === 'block' && (
<>
<Name>바다</Name>
<Bar />
</>
)}
</Component>
);
}
if (theme === 'travel') {
return (
<Component>
<Img src={Travel} alt="travel" />
<Name>여행</Name>
<Bar />
{type === 'block' && (
<>
<Name>여행</Name>
<Bar />
</>
)}
</Component>
);
}
if (theme === 'camping') {
return (
<Component>
<Img src={Camping} alt="camping" />
<Name>캠핑</Name>
<Bar />
{type === 'block' && (
<>
<Name>캠핑</Name>
<Bar />
</>
)}
</Component>
);
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/main/block/Block.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import useEnterProfile from '../useEnterProfile';
export default function Block({ isMain, data }) {
const navigate = useNavigate();
const { nickname } = UserStore();
const { enterProfile } = useEnterProfile(data.moderator.uid);
const { enterProfile } = useEnterProfile(data?.moderator.uid);

const enterRoom = (event: React.MouseEvent<HTMLButtonElement>) => {
event.preventDefault();
Expand All @@ -35,7 +35,7 @@ export default function Block({ isMain, data }) {
return (
<Container main={isMain} data-cy="main-room-cards">
<AvatarContainer data-cy="main-room-moderator" onClick={enterProfile}>
<MyAvatar num={Number(data.moderator.avatar)} />
<MyAvatar num={Number(data?.moderator.avatar)} />
<Moderator>
방장<Nickname>{data.moderator.nickname}</Nickname>
</Moderator>
Expand Down
2 changes: 1 addition & 1 deletion src/components/ready/card/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default function Header({ data }) {
return (
<Container data-cy="ready-card-header">
<AvatarControl>
<MyAvatar num={Number(data.moderator.avatar)} />
<MyAvatar num={Number(data?.moderator.avatar)} />
</AvatarControl>
<NameTag data-cy="ready-card-name">
<Moderator isModerator={1}>방장</Moderator>
Expand Down
4 changes: 2 additions & 2 deletions src/components/room/header/Theme.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useState, useRef, useEffect } from 'react';
import styled from 'styled-components';
import MovingTheme from '../screenShare/MovingTheme';
import ThemeImage from '../../atoms/ThemeImages';
import { ReactComponent as VolumeOn } from '../../../assets/svg/VolumeOn.svg';
import { ReactComponent as VolumeOff } from '../../../assets/svg/VolumeOff.svg';
import UserMediaStreamStore from '../../../stores/room/userMediaStreamStore';
Expand Down Expand Up @@ -32,7 +32,7 @@ export default function Theme({ theme }) {
return (
<Container>
<ThemeSound volumeRef={volumeRef} theme={theme} />
<MovingTheme theme={theme} size="3.2" />
<ThemeImage theme={theme} type="header" />
<Volume onClick={setSpeaker}>
{userSpeaker && volume !== 0 ? <VolumeOn /> : <VolumeOff />}
</Volume>
Expand Down

0 comments on commit 4fc6ca7

Please sign in to comment.