@@ -13,8 +13,9 @@ import { reallyGetAllPosts } from "../../../actions/getPostAction";
13
13
import { postComment } from "../../../actions/commentAction" ;
14
14
import Comment from "../../comment/Comment" ;
15
15
import * as S from "@chakra-ui/react" ;
16
- import styled from "styled-components" ;
16
+ import styled , { css } from "styled-components" ;
17
17
import { useToast } from "@chakra-ui/react" ;
18
+ import { useMediaQuery } from "@chakra-ui/react" ;
18
19
19
20
const Post = ( {
20
21
post : { currentPost, openedPost, likedStatus, likedPost } ,
@@ -32,6 +33,7 @@ const Post = ({
32
33
const [ lik , setLik ] = useState ( [ ] ) ;
33
34
const [ post , setPost ] = useState ( { } ) ;
34
35
const toast = useToast ( ) ;
36
+ const [ isLargerThan500 ] = useMediaQuery ( "(min-width: 500px)" ) ;
35
37
36
38
useEffect ( ( ) => {
37
39
showNav ( ) ;
@@ -104,15 +106,19 @@ const Post = ({
104
106
105
107
return (
106
108
< React . Fragment >
107
- < S . Flex flexDir = "column" px = "400px" >
108
- < S . Heading fontSize = "80" color = "gray.900" >
109
+ < S . Flex
110
+ flexDir = "column"
111
+ px = { isLargerThan500 ? "400px" : "50px" }
112
+ w = "100vw"
113
+ >
114
+ < S . Heading fontSize = { [ "35" , "50" , "80" ] } color = "gray.900" >
109
115
{ post . heading }
110
116
</ S . Heading >
111
117
< S . Flex flexDir = "column" >
112
118
{ openedPost . user ? (
113
119
< S . Box
114
120
onClick = { getThatP }
115
- fontSize = " 23px"
121
+ fontSize = { [ "15px" , " 23px"] }
116
122
color = "gray.700"
117
123
mb = "10px"
118
124
>
@@ -122,7 +128,7 @@ const Post = ({
122
128
< span > No id</ span >
123
129
) }
124
130
< S . Flex alignItems = "center" mb = "10px" >
125
- < S . Text fontSize = " 18"> { "7min" } </ S . Text >
131
+ < S . Text fontSize = { [ "15" , " 18"] } > { "7min" } </ S . Text >
126
132
< span
127
133
style = { {
128
134
width : "5px" ,
@@ -138,7 +144,7 @@ const Post = ({
138
144
style = {
139
145
likedBtn ( )
140
146
? { color : "rgb(255, 0, 106)" , fontSize : "25px" }
141
- : { fontSize : "25px" }
147
+ : { fontSize : isLargerThan500 ? "25px" : " " }
142
148
}
143
149
> </ i >
144
150
</ S . Flex >
@@ -148,18 +154,25 @@ const Post = ({
148
154
src = { post && `${ post . image } ` }
149
155
fallbackSrc = "https://i.ibb.co/RBT25fY/default-fallback-image.png"
150
156
alt = "post"
151
- style = { { width : "100%" , height : "600px" } }
157
+ style = { {
158
+ width : isLargerThan500 ? "100%" : "300px" ,
159
+ height : isLargerThan500 ? "600px" : "auto" ,
160
+ } }
152
161
/>
153
162
</ S . Flex >
154
163
< S . Flex mt = "30px" >
155
164
{ post . content && (
156
- < TurnIn >
165
+ < TurnIn isLargerThan500 >
157
166
< ParsedData draftJSRawData = { post . content . toString ( ) } />
158
167
</ TurnIn >
159
168
) }
160
169
</ S . Flex >
161
- < S . Divider my = "60px" />
162
- < S . Box fontSize = "24px" fontWeight = "600" mb = "15px" >
170
+ < S . Divider my = { isLargerThan500 ? "60px" : "20px" } />
171
+ < S . Box
172
+ fontSize = { isLargerThan500 ? "24px" : "18px" }
173
+ fontWeight = "600"
174
+ mb = "15px"
175
+ >
163
176
Comments
164
177
</ S . Box >
165
178
< Comment auth = { auth } post_id = { currentPost } />
@@ -175,6 +188,16 @@ const TurnIn = styled.div`
175
188
font-size: 25px;
176
189
}
177
190
}
191
+
192
+ ${ ( props ) =>
193
+ props . isLargerThan500 &&
194
+ css `
195
+ div {
196
+ span {
197
+ font-size: 16px;
198
+ }
199
+ }
200
+ ` }
178
201
` ;
179
202
180
203
const mapStateToProps = ( state ) => {
0 commit comments