Skip to content

Commit 038bf6d

Browse files
committed
Apply mobile design for search, tag, user posts, temp posts
1 parent bce44b3 commit 038bf6d

21 files changed

+237
-28
lines changed

src/components/base/Header.tsx

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { UserLogo } from '../../modules/header';
1111
import HeaderLogo from './HeaderLogo';
1212
import media from '../../lib/styles/media';
1313
import { SearchIcon2 } from '../../static/svg';
14+
import { Link } from 'react-router-dom';
1415

1516
const HeaderBlock = styled.div<{ floating: boolean }>`
1617
width: 100%;
@@ -90,6 +91,7 @@ interface HeaderProps {
9091
custom: boolean;
9192
userLogo: UserLogo | null;
9293
velogUsername: string | null;
94+
isSearch: boolean;
9395
}
9496

9597
const { useCallback } = React;
@@ -102,6 +104,7 @@ const Header: React.FC<HeaderProps> = ({
102104
custom,
103105
userLogo,
104106
velogUsername,
107+
isSearch,
105108
}) => {
106109
const [userMenu, toggleUserMenu] = useToggle(false);
107110

@@ -128,7 +131,24 @@ const Header: React.FC<HeaderProps> = ({
128131
/>
129132
</div>
130133
<div className="right">
131-
<SearchIcon2 className="search" />
134+
{/* {velogUsername ? (
135+
<SearchIcon2 className="search" />
136+
) : (
137+
<Link to="/search">
138+
<SearchIcon2 className="search" />
139+
</Link>
140+
)} */}
141+
{!isSearch && (
142+
<Link
143+
to={
144+
velogUsername
145+
? `/search?username=${velogUsername}`
146+
: '/search'
147+
}
148+
>
149+
<SearchIcon2 className="search" />
150+
</Link>
151+
)}
132152
{user ? (
133153
<div className="logged-in">
134154
<RoundButton

src/components/common/HorizontalTab.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import styled from 'styled-components';
33
import { Link } from 'react-router-dom';
44
import palette from '../../lib/styles/palette';
55
import { useSpring, animated } from 'react-spring';
6+
import media from '../../lib/styles/media';
67

78
export type HorizontalTabProps = {
89
className?: string;
@@ -88,6 +89,10 @@ const StyledLink = styled(Link)`
8889
width: 8rem;
8990
height: 3rem;
9091
font-size: 1.3125rem;
92+
${media.small} {
93+
height: 2.5rem;
94+
font-size: 1rem;
95+
}
9196
color: ${palette.gray7};
9297
display: flex;
9398
align-items: center;

src/components/common/PostCard.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ const PostCardBlock = styled.div`
6666
.post-thumbnail {
6767
margin-bottom: 1rem;
6868
${media.small} {
69-
margin-bottom: 0.5rem;
7069
}
7170
}
7271
line-height: 1.5;

src/components/saves/SavesTemplate.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import VelogResponsive from '../velog/VelogResponsive';
33
import styled from 'styled-components';
44
import PageTemplate from '../base/PageTemplate';
55
import palette from '../../lib/styles/palette';
6+
import media from '../../lib/styles/media';
67

78
export interface SavesTemplateProps {
89
children: React.ReactNode;
@@ -17,6 +18,19 @@ const StyledVelogResponsive = styled(VelogResponsive)`
1718
margin-bottom: 3rem;
1819
color: ${palette.gray8};
1920
}
21+
22+
${media.medium} {
23+
padding-left: 1rem;
24+
padding-right: 1rem;
25+
}
26+
${media.small} {
27+
width: 100%;
28+
margin-top: 2rem;
29+
& > h1 {
30+
font-size: 2.5rem;
31+
margin-bottom: 1.5rem;
32+
}
33+
}
2034
`;
2135

2236
function SavesTemplate({ children }: SavesTemplateProps) {

src/components/search/SearchInput.tsx

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import React, { useRef, useMemo, useEffect } from 'react';
22
import styled, { css } from 'styled-components';
33
import palette from '../../lib/styles/palette';
4-
import { SearchIcon } from '../../static/svg';
4+
import { SearchIcon2 } from '../../static/svg';
55
import useToggle from '../../lib/hooks/useToggle';
66
import useInput from '../../lib/hooks/useInput';
77
import { debounce } from 'throttle-debounce';
8+
import media from '../../lib/styles/media';
89

910
const SearchInputBlock = styled.div<{ focus: boolean; large?: boolean }>`
1011
display: flex;
@@ -20,7 +21,7 @@ const SearchInputBlock = styled.div<{ focus: boolean; large?: boolean }>`
2021
margin-right: 0.5rem;
2122
width: 1rem;
2223
height: 1rem;
23-
color: ${palette.gray5};
24+
fill: ${palette.gray5};
2425
}
2526
input {
2627
transition: all 0.125s ease-in;
@@ -43,7 +44,7 @@ const SearchInputBlock = styled.div<{ focus: boolean; large?: boolean }>`
4344
css`
4445
border: 1px solid ${palette.gray8};
4546
svg {
46-
color: ${palette.gray9};
47+
fill: ${palette.gray9};
4748
}
4849
input {
4950
color: ${palette.gray9};
@@ -54,7 +55,7 @@ const SearchInputBlock = styled.div<{ focus: boolean; large?: boolean }>`
5455
props.large &&
5556
css`
5657
height: 4rem;
57-
padding: 1.25rem 1.5rem;
58+
padding: 0 1.5rem;
5859
svg {
5960
width: 1.5rem;
6061
height: 1.5rem;
@@ -65,6 +66,22 @@ const SearchInputBlock = styled.div<{ focus: boolean; large?: boolean }>`
6566
line-height: 2rem;
6667
height: 2rem;
6768
}
69+
${media.small} {
70+
height: 2.25rem;
71+
padding-left: 1rem;
72+
padding-right: 1rem;
73+
svg {
74+
width: 1rem;
75+
height: 1rem;
76+
margin-right: 0.75rem;
77+
}
78+
input {
79+
flex: 1;
80+
font-size: 1.125rem;
81+
line-height: 1.5;
82+
height: auto;
83+
}
84+
}
6885
`}
6986
`;
7087

@@ -117,7 +134,7 @@ function SearchInput({
117134
onClick={onClick}
118135
large={large}
119136
>
120-
<SearchIcon />
137+
<SearchIcon2 />
121138
<input
122139
placeholder="검색어를 입력하세요"
123140
onFocus={toggleFocus}
@@ -126,6 +143,7 @@ function SearchInput({
126143
ref={inputRef}
127144
onChange={onChange}
128145
value={value}
146+
autoFocus
129147
/>
130148
</SearchInputBlock>
131149
);

src/components/search/SearchResultInfo.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
import React from 'react';
22
import palette from '../../lib/styles/palette';
33
import styled from 'styled-components';
4+
import media from '../../lib/styles/media';
45

56
const Info = styled.p`
67
margin-bottom: 4rem;
78
font-size: 1.125rem;
89
line-height: 1.5;
10+
${media.small} {
11+
font-size: 1rem;
12+
margin-bottom: 1rem;
13+
}
914
color: ${palette.gray7};
1015
b {
1116
color: ${palette.gray9};

src/components/search/SearchTemplate.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,18 @@ import React from 'react';
22
import PageTemplate from '../base/PageTemplate';
33
import VelogResponsive from '../velog/VelogResponsive';
44
import styled from 'styled-components';
5+
import media from '../../lib/styles/media';
56

67
const StyledVelogResponsive = styled(VelogResponsive)`
78
margin-top: 3.5rem;
9+
${media.medium} {
10+
padding-left: 1rem;
11+
padding-right: 1rem;
12+
margin-top: 2rem;
13+
}
14+
${media.small} {
15+
margin-top: 0.5rem;
16+
}
817
`;
918

1019
export interface SearchTemplateProps {

src/components/tags/DetailedTagItem.tsx

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import TagItem from '../common/TagItem';
44
import palette from '../../lib/styles/palette';
55
import Skeleton from '../common/Skeleton';
66
import SkeletonTexts from '../common/SkeletonTexts';
7+
import media from '../../lib/styles/media';
78

89
export type DetailedTagItemProps = {
910
name: string;
@@ -58,11 +59,26 @@ const Block = styled.div<{ hasDescription: boolean }>`
5859
flex-direction: column;
5960
justify-content: space-between;
6061
padding: 1rem;
62+
6163
width: 25%;
64+
${media.large} {
65+
width: 33.333%;
66+
}
67+
${media.medium} {
68+
width: 50%;
69+
margin-bottom: 1rem;
70+
}
71+
${media.custom(470)} {
72+
width: 100%;
73+
margin-bottom: 0;
74+
}
6275
${props =>
6376
props.hasDescription &&
6477
css`
6578
height: 12rem;
79+
${media.medium} {
80+
height: auto;
81+
}
6682
`}
6783
6884
p {
@@ -76,11 +92,20 @@ const Block = styled.div<{ hasDescription: boolean }>`
7692
font-size: 0.875rem;
7793
color: ${palette.gray7};
7894
line-height: 1.5;
95+
${media.small} {
96+
font-size: 0.75rem;
97+
}
7998
}
8099
81100
.count {
82101
font-size: 0.875rem;
83102
color: ${palette.gray5};
103+
${media.medium} {
104+
margin-top: 0.5rem;
105+
}
106+
${media.small} {
107+
font-size: 0.75rem;
108+
}
84109
}
85110
`;
86111

src/components/tags/DetailedTagList.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React from 'react';
22
import styled, { css } from 'styled-components';
33
import DetailedTagItem, { DetailedTagItemSkeleton } from './DetailedTagItem';
44
import { Tag } from '../../lib/graphql/tags';
5+
import media from '../../lib/styles/media';
56

67
export type DetailedTagListProps = {
78
tags: Tag[];
@@ -43,6 +44,17 @@ const Block = styled.section`
4344
width: 1200px;
4445
display: flex;
4546
flex-wrap: wrap;
47+
${media.large} {
48+
width: 1024px;
49+
}
50+
${media.medium} {
51+
width: 100%;
52+
margin-top: 2rem;
53+
}
54+
55+
${media.small} {
56+
margin-top: 1rem;
57+
}
4658
`;
4759

4860
const SkeletonBlock = styled(Block)<{

src/components/tags/TagDetail.tsx

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import styled from 'styled-components';
33
import palette from '../../lib/styles/palette';
44
import Skeleton from '../common/Skeleton';
55
import SkeletonTexts from '../common/SkeletonTexts';
6+
import media from '../../lib/styles/media';
67

78
export type TagDetailProps = {
89
thumbnail: string | null;
@@ -60,20 +61,34 @@ const Block = styled.div`
6061
border-radius: 6rem;
6162
box-shadow: 0px 0px 4px rgba(0, 0, 0, 0.125);
6263
margin-bottom: 2rem;
64+
${media.small} {
65+
margin-top: 2rem;
66+
width: 8rem;
67+
height: 8rem;
68+
margin-bottom: 1rem;
69+
}
6370
}
6471
6572
h1 {
6673
font-size: 3rem;
6774
margin: 0;
6875
line-height: 1.5;
6976
color: ${palette.gray8};
77+
${media.small} {
78+
font-size: 2rem;
79+
}
7080
}
7181
p {
7282
margin-top: 1rem;
7383
margin-bottom: 1rem;
7484
font-size: 1.125rem;
7585
line-height: 1.5;
7686
color: ${palette.gray7};
87+
${media.small} {
88+
margin-top: 0.5rem;
89+
margin-bottom: 0.5rem;
90+
font-size: 1rem;
91+
}
7792
}
7893
.count {
7994
margin-top: 1rem;
@@ -87,6 +102,10 @@ const SkeletonBlock = styled(Block)`
87102
height: 4.5rem;
88103
display: flex;
89104
align-items: center;
105+
margin: 0;
106+
${media.small} {
107+
height: 3rem;
108+
}
90109
}
91110
.lines {
92111
margin-top: 1rem;
@@ -97,6 +116,14 @@ const SkeletonBlock = styled(Block)`
97116
align-items: center;
98117
width: 100%;
99118
}
119+
${media.small} {
120+
margin-top: 0.5rem;
121+
margin-bottom: 0.5rem;
122+
font-size: 1rem;
123+
.line {
124+
height: 1.5rem;
125+
}
126+
}
100127
}
101128
`;
102129

0 commit comments

Comments
 (0)