Skip to content

Commit ffc5107

Browse files
committed
[FE] Refactor : CDN 이미지 파일 사이즈 지정
1 parent 649fe13 commit ffc5107

File tree

9 files changed

+304
-21
lines changed

9 files changed

+304
-21
lines changed

frontend/package-lock.json

Lines changed: 238 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
},
2828
"homepage": "https://github.com/boostcamp-2020/Project01-C-User-Event-Collector#readme",
2929
"dependencies": {
30+
"@emotion/styled": "^11.0.0",
3031
"@types/next": "^9.0.0",
3132
"@types/react": "^17.0.0",
3233
"axios": "^0.21.0",

frontend/src/components/Common/Card/MagCard/index.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,18 @@ const enterTitle = title => {
2424

2525
const MagCard = ({ magMetaData: mag }: IMagMetaProps) => {
2626
const target = 'MagCard';
27+
const resetImgSize = url => {
28+
if (url) {
29+
const _url = url.replace(/type=r([0-9])+Fll/gi, 'type=r360Fll');
30+
return _url;
31+
}
32+
};
33+
2734
return (
2835
<Container>
2936
<BoxItem
3037
trackData={mag.tracks}
31-
imgUrl={mag.imgUrl}
38+
imgUrl={resetImgSize(mag.imgUrl)}
3239
next="magazines"
3340
id={mag.id}
3441
target={target}

frontend/src/components/Common/MagTag/index.tsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,21 @@ const All = styled.a`
4545
background: ${props => props.theme.color.highlight};
4646
`;
4747

48-
const SpecialTag = styled(All)`
48+
const SpecialTag = styled.a`
49+
padding: 5px 16px;
50+
border-radius: 30px;
4951
background: linear-gradient(to right, red, #ff00a0, #7e00e4);
5052
`;
5153

52-
const PickTag = styled(All)``;
54+
const PickTag = styled.a`
55+
padding: 5px 16px;
56+
border-radius: 30px;
57+
background: ${props => props.theme.color.highlight};
58+
`;
5359

54-
const GenreTag = styled(All)`
60+
const GenreTag = styled.a`
61+
padding: 5px 16px;
62+
border-radius: 30px;
5563
background: #7e00e4;
5664
`;
5765

frontend/src/components/Common/MagTopItem/index.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,21 @@ import BoxItem from '@components/Common/BoxItem';
77

88
function MagTopItem({ magData: mag }) {
99
const target = 'MagTopItem';
10+
11+
const resetImgSize = url => {
12+
if (url) {
13+
const _url = url.replace(/type=r([0-9])+Fll/gi, 'type=r360Fll');
14+
return _url;
15+
}
16+
};
17+
1018
return (
1119
<Wrapper>
1220
<ImgWrapper>
1321
<BoxItem
1422
trackData={mag.tracks}
1523
target={target}
16-
imgUrl={mag.imgUrl}
24+
imgUrl={resetImgSize(mag.imgUrl)}
1725
next="magazines"
1826
id={mag.id}
1927
/>

frontend/src/components/Common/PlayTrackItem/index.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,18 @@ function PlayTrackItem({ type, trackData: track }) {
3131
};
3232
};
3333

34+
const resetImgSize = url => {
35+
if (url) {
36+
const _url = url.replace(/type=r([0-9])+Fll/gi, 'type=r120Fll');
37+
return _url;
38+
}
39+
};
40+
3441
return (
3542
<TrackWrapper>
3643
<TrackImgWrapper>
3744
<A next="album" id={track?.album?.id} target={target}>
38-
<TrackImg src={track?.album?.imgUrl} alt="playbar-track-img" />
45+
<TrackImg src={resetImgSize(track?.album?.imgUrl)} alt="playbar-track-img" />
3946
</A>
4047
</TrackImgWrapper>
4148
<TrackContentWrapper>

frontend/src/components/Common/TrackItem/index.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ type TrackMeta = {
2525
imgUrl: string;
2626
};
2727

28+
const resetImgSize = url => {
29+
const _url = url.replace(/type=r([0-9])+Fll/gi, 'type=r120Fll');
30+
return _url;
31+
};
32+
2833
const TrackItem = ({
2934
chart,
3035
type,
@@ -49,7 +54,11 @@ const TrackItem = ({
4954
<TrackImgWrapper>
5055
<TrackHoverImg src="/images/track-hover-img.png" className="track-hover-img" />
5156
<TrackImg
52-
src={track.album?.imgUrl ? track.album.imgUrl : albumData.imgUrl}
57+
src={
58+
track.album?.imgUrl
59+
? resetImgSize(track.album.imgUrl)
60+
: resetImgSize(albumData.imgUrl)
61+
}
5362
alt="track-image"
5463
/>
5564
</TrackImgWrapper>

frontend/src/components/Layout/SideBar/NavBar/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ function NavBar() {
3030
<Container>
3131
{userState.isLoggedIn ? (
3232
<AuthWrapper>
33-
<ProfileImg src={userState?.profileURL} alt="profile-img" />
33+
<ProfileImg src={`${userState?.profileURL}?type=s33`} alt="profile-img" />
3434
{userState?.nickname}
3535
<AuthDropdown />
3636
</AuthWrapper>
3737
) : (
3838
<AuthWrapper style={{ cursor: 'pointer' }} onClick={loginEvent}>
39-
<ProfileImg src={userState?.profileURL} alt="profile-img" />
39+
<ProfileImg src={`${userState?.profileURL}?type=s33`} alt="profile-img" />
4040
로그인
4141
</AuthWrapper>
4242
)}

frontend/src/components/Template/Library/index.tsx

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,18 @@ function Layout({ mainTitle, type, children }: ILayout): ReactElement {
1818
<SubTitle>보관함</SubTitle>
1919
<MainTitle>{mainTitle}</MainTitle>
2020
</Title>
21-
{type && (
22-
<PlayButtonWrapper>
23-
<ClickEventWrapper target="PlayAllBtn">
24-
<LargeButton customType="play" />
25-
</ClickEventWrapper>
26-
<ClickEventWrapper target="shuffle">
27-
<LargeButton customType="shuffle" />
28-
</ClickEventWrapper>
29-
</PlayButtonWrapper>
30-
)}
21+
<PlayButtonWrapper>
22+
{type && (
23+
<>
24+
<ClickEventWrapper target="PlayAllBtn">
25+
<LargeButton customType="play" />
26+
</ClickEventWrapper>
27+
<ClickEventWrapper target="shuffleBtn">
28+
<LargeButton customType="shuffle" />
29+
</ClickEventWrapper>
30+
</>
31+
)}
32+
</PlayButtonWrapper>
3133
</Header>
3234
<LibraryContent>{children}</LibraryContent>
3335
</Wrapper>
@@ -45,9 +47,11 @@ const Wrapper = styled.div`
4547
`;
4648

4749
const Header = styled.header`
48-
position: relative;
4950
height: 80px;
5051
border-bottom: 1px solid #e4e4e4;
52+
display: flex;
53+
align-items: center;
54+
justify-content: space-between;
5155
`;
5256

5357
const Title = styled.div`
@@ -67,9 +71,10 @@ const MainTitle = styled.span`
6771

6872
const PlayButtonWrapper = styled.div`
6973
width: 296px;
70-
position: absolute;
74+
height: 60px;
7175
display: flex;
7276
justify-content: space-between;
77+
align-items: flex-end;
7378
bottom: 18px;
7479
right: 0px;
7580
`;

0 commit comments

Comments
 (0)