File size: 1,931 Bytes
f5071ca
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import React from "react";
import { Box, Flex } from "@chakra-ui/react";
import DetailSkeleton from "../skeletons/DetailSkeleton";
import SideReactionBar from "./SideReactionBar";
import ErrorMessage from "../../utils/ErrorMessage";
import DetailRightContent from "./DetailRightContent";
import MainContent from "./MainContent";
import "react-mde/lib/styles/css/react-mde-all.css";
import "../../styles/postdetail.scss";

const DetailElements = ({
  postDetail,
  currentUserProfile,
  loading,
  err,
  otherPosts,
  trandingOnDevCommunity,
}) => {
  return (
    <Box
      maxW="1280px"
      w="100%"
      py="0"
      px={{ base: "0", md: "1rem" }}
      mt={{ base: "-.5rem !important", md: "0 !important" }}
      mb={{ md: "2rem" }}
      flex="1"
    >
      {!postDetail && loading && <DetailSkeleton />}

      {!postDetail && !loading && !err && <ErrorMessage urlNotFound={true} />}

      {!postDetail && !loading && err && <ErrorMessage offline={true} />}

      {postDetail && (
        <Flex flex={2} align="flex-start">
          <SideReactionBar postDetail={postDetail} />

          <Box flex="2.1" overflow="hidden" pb="1px">
            <MainContent postDetail={postDetail} />

            <DetailRightContent
              currentUserProfile={currentUserProfile}
              otherPosts={otherPosts}
              userId={postDetail.userId}
              display={{ base: "block", xl: "none" }}
              m={{ base: "1.5rem 0", md: "1.5rem 1px 0" }}
              trandingOnDevCommunity={trandingOnDevCommunity}
            />
          </Box>

          <DetailRightContent
            currentUserProfile={currentUserProfile}
            otherPosts={otherPosts}
            userId={postDetail.userId}
            display={{ base: "none", xl: "block" }}
            trandingOnDevCommunity={trandingOnDevCommunity}
          />
        </Flex>
      )}
    </Box>
  );
};

export default DetailElements;