Skip to content

Commit 24553e4

Browse files
committed
Rename 나만 보기 -> 비공개, and show a label on private post
1 parent 7f7c411 commit 24553e4

File tree

8 files changed

+60
-4
lines changed

8 files changed

+60
-4
lines changed

src/components/common/PostCard.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import Skeleton from './Skeleton';
1111
import SkeletonTexts from './SkeletonTexts';
1212
import RatioImage from './RatioImage';
1313
import media from '../../lib/styles/media';
14+
import PrivatePostLabel from './PrivatePostLabel';
1415

1516
const PostCardBlock = styled.div`
1617
padding-top: 4rem;
@@ -172,6 +173,11 @@ const PostCard = ({ post, hideUser }: PostCardProps) => {
172173
<div className="subinfo">
173174
<span>{formatDate(post.released_at)}</span>
174175
<span>{post.comments_count}개의 댓글</span>
176+
{post.is_private && (
177+
<span>
178+
<PrivatePostLabel />
179+
</span>
180+
)}
175181
</div>
176182
</PostCardBlock>
177183
);
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import React from 'react';
2+
import styled from 'styled-components';
3+
import palette from '../../lib/styles/palette';
4+
import { LockIcon } from '../../static/svg';
5+
6+
export type PrivatePostLabelProps = {};
7+
8+
function PrivatePostLabel(props: PrivatePostLabelProps) {
9+
return (
10+
<Block>
11+
<LockIcon /> 비공개
12+
</Block>
13+
);
14+
}
15+
16+
const Block = styled.div`
17+
background: ${palette.gray8};
18+
color: white;
19+
line-height: 1;
20+
padding-left: 0.5rem;
21+
padding-right: 0.5rem;
22+
padding-top: 0.25rem;
23+
padding-bottom: 0.25rem;
24+
border-radius: 4px;
25+
font-weight: bold;
26+
font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue',
27+
'Apple SD Gothic Neo', arial, 나눔고딕, 'Nanum Gothic', 돋움, Dotum, Tahoma,
28+
Geneva, sans-serif;
29+
display: inline-flex;
30+
align-items: center;
31+
svg {
32+
margin-right: 0.5rem;
33+
width: 0.875rem;
34+
height: 0.875rem;
35+
}
36+
`;
37+
38+
export default PrivatePostLabel;

src/components/post/PostHead.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import PopupOKCancel from '../common/PopupOKCancel';
1010
import media from '../../lib/styles/media';
1111
import TagList from '../common/TagList';
1212
import { Link } from 'react-router-dom';
13+
import { LockIcon } from '../../static/svg';
14+
import PrivatePostLabel from '../common/PrivatePostLabel';
1315

1416
const PostHeadBlock = styled(VelogResponsive)`
1517
margin-top: 5.5rem;
@@ -63,6 +65,7 @@ const SubInfo = styled.div`
6365
margin-left: 0.5rem;
6466
margin-right: 0.5rem;
6567
}
68+
6669
${media.small} {
6770
font-size: 0.875rem;
6871
}
@@ -126,6 +129,7 @@ export interface PostHeadProps {
126129
onEdit: () => any;
127130
shareButtons: React.ReactNode;
128131
toc: React.ReactNode;
132+
isPrivate?: boolean;
129133
}
130134

131135
const PostHead: React.FC<PostHeadProps> = ({
@@ -142,6 +146,7 @@ const PostHead: React.FC<PostHeadProps> = ({
142146
onEdit,
143147
shareButtons,
144148
toc,
149+
isPrivate,
145150
}) => {
146151
const [askRemove, toggleAskRemove] = useToggle(false);
147152

@@ -160,6 +165,12 @@ const PostHead: React.FC<PostHeadProps> = ({
160165
</span>
161166
<span className="separator">&middot;</span>
162167
<span>{formatDate(date)}</span>
168+
{isPrivate && (
169+
<>
170+
<span className="separator">&middot;</span>
171+
<PrivatePostLabel />
172+
</>
173+
)}
163174
</div>
164175
{ownPost && (
165176
<EditRemoveGroup>

src/components/write/PublishPrivacySetting.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ const PublishPrivacySetting: React.FC<PublishPrivacySettingProps> = ({
7272
</Button>
7373
<Button active={isPrivate} onClick={onClickPrivate}>
7474
<LockIcon />
75-
나만 보기
75+
비공개
7676
</Button>
7777
</PublishPrivacySettingBlock>
7878
);

src/components/write/__tests__/PublishPrivacySetting.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ describe('PublishPrivacySetting', () => {
1515
);
1616
const buttons = {
1717
public: utils.getByText('전체 공개'),
18-
private: utils.getByText('나만 보기'),
18+
private: utils.getByText('비공개'),
1919
};
2020
return {
2121
...utils,

src/components/write/__tests__/__snapshots__/PublishPrivacySetting.test.tsx.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ exports[`PublishPrivacySetting matches snapshot 1`] = `
2525
<svg>
2626
icon-lock.svg
2727
</svg>
28-
나만 보기
28+
비공개
2929
</button>
3030
</div>
3131
</section>

src/containers/post/PostViewer.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,7 @@ const PostViewer: React.FC<PostViewerProps> = ({
335335
/>
336336
}
337337
toc={<PostToc />}
338+
isPrivate={post.is_private}
338339
/>
339340
<PostContent isMarkdown={post.is_markdown} body={post.body} />
340341
<UserProfileWrapper>

src/containers/write/__tests__/PublishPrivacySettingContainer.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ describe('PublishPrivacySettingContainer', () => {
1818
);
1919
const buttons = {
2020
public: utils.getByText('전체 공개'),
21-
private: utils.getByText('나만 보기'),
21+
private: utils.getByText('비공개'),
2222
};
2323
return {
2424
...utils,

0 commit comments

Comments
 (0)