Skip to content

Commit cc4ecba

Browse files
committed
Fix #80
1 parent e4a2fc4 commit cc4ecba

File tree

5 files changed

+21
-21
lines changed

5 files changed

+21
-21
lines changed

.env

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
REACT_APP_API_HOST=https://v2dev.velog.io/
2-
PUBLIC_URL=https://static.velog.io/
1+
REACT_APP_API_HOST=http://localhost:5000/
2+
PUBLIC_URL=/

docker/redis/docker-compose.yml

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ services:
66
environment:
77
# ALLOW_EMPTY_PASSWORD is recommended only for development.
88
- ALLOW_EMPTY_PASSWORD=yes
9-
- REDIS_DISABLE_COMMANDS=FLUSHDB,FLUSHALL
109
ports:
1110
- '6379:6379'
1211
volumes:

src/components/velog/SideArea.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const Wrapper = styled.div`
2121

2222
const Block = styled.div`
2323
position: absolute;
24-
margin-top: 4.25rem;
24+
2525
width: 11.5rem;
2626
left: -13.5rem;
2727

src/pages/velog/UserPage.tsx

-14
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ import SeriesTab from './tabs/SeriesTab';
99
import AboutTab from './tabs/AboutTab';
1010
import palette from '../../lib/styles/palette';
1111
import media from '../../lib/styles/media';
12-
import UserTags from '../../components/velog/UserTags';
13-
import qs from 'qs';
14-
import { usePrevious } from 'react-use';
1512

1613
const UserPageBlock = styled(VelogResponsive)``;
1714

@@ -20,23 +17,12 @@ export interface UserPageProps
2017

2118
const UserPage: React.FC<UserPageProps> = ({ match, location }) => {
2219
const { username, tab } = match.params;
23-
const { tag } = qs.parse(location.search, {
24-
ignoreQueryPrefix: true,
25-
}) as { tag: string | undefined };
26-
27-
const prevTag = usePrevious(tag);
28-
useEffect(() => {
29-
if (prevTag !== tag) {
30-
window.scrollTo(0, 0);
31-
}
32-
}, [prevTag, tag]);
3320

3421
return (
3522
<UserPageBlock>
3623
<UserProfileContainer username={username} />
3724
<MobileSeparator />
3825
<VelogTab username={username} tab={tab || 'posts'} />
39-
<UserTags username={username} tag={tag || null} />
4026
<Route path="/@:username" exact component={UserPostsTab} />
4127
<Route path="/@:username/series" component={SeriesTab} />
4228
<Route path="/@:username/about" component={AboutTab} />

src/pages/velog/tabs/UserPostsTab.tsx

+18-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from 'react';
1+
import React, { useEffect } from 'react';
22
import UserPosts from '../../../containers/velog/UserPosts';
33
import { RouteComponentProps } from 'react-router';
44
import qs from 'qs';
@@ -8,6 +8,8 @@ import styled from 'styled-components';
88
import media from '../../../lib/styles/media';
99
import usePreserveScroll from '../../../lib/hooks/usePreserveScroll';
1010
import { Helmet } from 'react-helmet-async';
11+
import { usePrevious } from 'react-use';
12+
import UserTags from '../../../components/velog/UserTags';
1113

1214
export interface UserPostsTabProps
1315
extends RouteComponentProps<{ username: string }> {
@@ -32,8 +34,15 @@ const UserPostsTab: React.FC<UserPostsTabProps> = ({
3234
const { username } = match.params;
3335
usePreserveScroll('user/posts');
3436

37+
const prevTag = usePrevious(tag);
38+
useEffect(() => {
39+
if (prevTag !== tag) {
40+
window.scrollTo(0, 0);
41+
}
42+
}, [prevTag, tag]);
43+
3544
return (
36-
<>
45+
<div>
3746
<HideOnMobile>
3847
<Helmet>
3948
<link
@@ -49,14 +58,17 @@ const UserPostsTab: React.FC<UserPostsTabProps> = ({
4958
username={match.params.username}
5059
/>
5160
</HideOnMobile>
61+
<TagWrapper>
62+
<UserTags username={username} tag={tag || null} />
63+
</TagWrapper>
5264
<Block>
5365
{q ? (
5466
<SearchResult username={username} keyword={q} />
5567
) : (
5668
<UserPosts username={match.params.username} tag={tag || null} />
5769
)}
5870
</Block>
59-
</>
71+
</div>
6072
);
6173
};
6274

@@ -73,4 +85,7 @@ const Block = styled.div`
7385
}
7486
`;
7587

88+
const TagWrapper = styled.div`
89+
position: relative;
90+
`;
7691
export default UserPostsTab;

0 commit comments

Comments
 (0)