Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
PierreCrb committed Feb 1, 2021
1 parent 6dafbb7 commit 6e90a44
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 27 deletions.
30 changes: 26 additions & 4 deletions src/components/PreviewProject.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,41 @@
import React from 'react'
import { Box, Spinner } from '@chakra-ui/core'
import { Project } from '@prisma/client'
import { Box, Spinner, Icon, Text, Avatar } from '@chakra-ui/core'
import { Project, User } from '@prisma/client'

interface Props {
project: Project
project: Project & { user: User }
}

const PreviewProject = (props: Props) => {
return (
<Box mb={3} maxW="100%">
{!props.project ? (
<Spinner m="0 auto" color="white" size="xl" mt="3rem" />
) : props.project.thumbnail ? (
<img
src={props.project.thumbnail}
alt={props.project.projectName}
style={{ height: '200px', width: '100%' }}
/>
) : (
<img src={props.project.thumbnail} alt={props.project.projectName} />
<Box textAlign="center" margin={0} h="200px" w="100%">
<Icon name="warning" size="32px" color="red.500" mt={20} />
<Text mt={3}>No screenshot for this project</Text>
</Box>
)}

<Box w="100%">
<Text fontSize="xl">{props.project.projectName}</Text>
<Text fontSize="md" mt={2} textAlign="right" w="100%">
<Avatar
size="xs"
mr={2}
name={props.project.user.name || ''}
src={props.project.user.image || ''}
/>
{props.project.user.name}
</Text>
</Box>
</Box>
)
}
Expand Down
24 changes: 1 addition & 23 deletions src/pages/project/public/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
Box,
SimpleGrid,
PseudoBox,
Avatar,
RadioGroup,
Radio,
Spinner,
Expand Down Expand Up @@ -108,7 +107,7 @@ const ProjectList = () => {
<Spinner m="0 auto" color="white" size="xl" mt="3rem" />
</Box>
) : projects && projects?.project.length > 0 ? (
<SimpleGrid columns={[1, 1, 2, 3]} spacing={6} mt={10}>
<SimpleGrid columns={[1, 1, 2, 3]} spacing={4} mt={10}>
{projects?.project.map((e: Project & { user: User }, i: number) =>
radioValue === 'all' ? (
<PseudoBox
Expand All @@ -125,17 +124,6 @@ const ProjectList = () => {
key={i}
>
<PreviewProject project={e} />

<Text fontSize="xl">{e.projectName}</Text>
<Text fontSize="md" mt={2} textAlign="right">
<Avatar
size="xs"
mr={2}
name={e.user.name || ''}
src={e.user.image || ''}
/>
{e.user.name}
</Text>
</PseudoBox>
) : (
radioValue === e.tag && (
Expand All @@ -153,16 +141,6 @@ const ProjectList = () => {
key={i}
>
<PreviewProject project={e} />
<Text fontSize="xl">{e.projectName}</Text>
<Text fontSize="md" mt={2} textAlign="right">
<Avatar
size="xs"
mr={2}
name={e.user.name || ''}
src={e.user.image || ''}
/>
{e.user.name}
</Text>
</PseudoBox>
)
),
Expand Down

0 comments on commit 6e90a44

Please sign in to comment.