Skip to content

Commit

Permalink
Add: job-list init
Browse files Browse the repository at this point in the history
  • Loading branch information
hyeon81 committed Jun 29, 2024
1 parent 8bc5af3 commit a930c0c
Show file tree
Hide file tree
Showing 5 changed files with 252 additions and 7 deletions.
86 changes: 86 additions & 0 deletions src/app/job/JobCard.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
import { Card, CardContent, CardHeader, Stack, Typography } from '@mui/material'
import Link from 'next/link'

import { IJob } from '@/types/IJob'

const JobCard = ({ title, writerName, createdAt, id }: IJob) => {
return (
<Card
sx={{
borderRadius: '0.75rem',
borderWidth: '2px',
borderStyle: 'solid',
borderColor: 'background.tertiary',
boxShadow: 'none',
}}
>
<Link href={`/job/${id}`} style={{ textDecoration: 'none' }}>
{/*<Box sx={{ position: 'relative' }}>*/}
{/* <CuPhotoBox*/}
{/* style={{*/}
{/* width: '100%',*/}
{/* height: '160px',*/}
{/* position: 'relative',*/}
{/* left: '-2px',*/}
{/* top: '-2px',*/}
{/* border: '2px solid',*/}
{/* borderBottom: 'none',*/}
{/* borderColor: 'background.tertiary',*/}
{/* borderBottomLeftRadius: '0.75rem',*/}
{/* borderBottomRightRadius: '0.75rem',*/}
{/* }}*/}
{/* src={undefined}*/}
{/* alt="userImage"*/}
{/* />*/}
{/*</Box>*/}
</Link>
<CardHeader
title={
<Typography
variant="Body2"
color="text.alternative"
sx={{
display: '-webkit-box',
WebkitLineClamp: 1,
WebkitBoxOrient: 'vertical',
overflow: 'hidden',
textOverflow: 'ellipsis',
}}
>
{writerName}
</Typography>
}
/>
<Link href={`/job/${id}`} style={{ textDecoration: 'none' }}>
<CardContent
sx={{
'&:last-child': {
paddingBottom: '1rem !important',
},
paddingY: 0,
}}
>
<Stack>
<Typography
variant="Body1"
color="text.normal"
sx={{
overflow: 'hidden',
textOverflow: 'ellipsis',
display: '-webkit-box',
WebkitBoxOrient: 'vertical',
}}
>
{title}
</Typography>
<Typography variant="Body2" color="text.alternative">
{createdAt}
</Typography>
</Stack>
</CardContent>
</Link>
</Card>
)
}

export default JobCard
108 changes: 108 additions & 0 deletions src/app/job/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
'use client'

import { Container, Grid, Stack, Typography } from '@mui/material'
import { containerStyle } from '@/app/panel/main-page/Mainpage.style'

import NoDataDolphin from '@/components/NoDataDolphin'

import { IPagination } from '@/types/IPagination'
import { IJob } from '@/types/IJob'
import JobCard from '@/app/job/JobCard'

const data: IPagination<IJob[]> = {
content: [
{
title: '6월의 인기 채용 공고',
writerName: 'jujeon',
createdAt: '2023-05-15',
id: 1,
},
{
title: '5월의 인기 채용 공고',
writerName: 'jujeon',
createdAt: '2023-06-01',
id: 2,
},
{
title: '4월의 인기 채용 공고',
writerName: 'jujeon',
createdAt: '2023-04-20',
id: 3,
},
// Add more IJob objects as needed
],
pageable: {
sort: {
empty: false,
unsorted: false,
sorted: true,
},
offset: 0,
pageNumber: 0,
pageSize: 10,
paged: true,
unpaged: false,
},
totalPages: 1,
totalElements: 3,
last: true,
size: 10,
number: 0,
sort: {
empty: false,
unsorted: false,
sorted: true,
},
numberOfElements: 3,
first: true,
empty: false,
}

const JobInfo = () => {
// const { data, isLoading, error } = useSWR<IPagination<IJob[]>>(
// `${process.env.NEXT_PUBLIC_CSR_API}/api/v1/job?page=1&pageSize=10`,
// defaultGetFetcher,
// )
// const noContent = !isLoading
// ? error
// ? '에러 발생'
// : data?.content?.length == 0
// ? '데이터가 없습니다'
// : null
// : null

return (
<Container sx={containerStyle}>
<Stack mt={'1rem'} mb={'0.5rem'} spacing={4}>
<Typography variant={'Title1'} color={'text.strong'}>
채용 공고
</Typography>
</Stack>
<Stack direction={'row'} spacing={4}>
{data?.content.length === 0 ? (
<Stack
width={'100%'}
height={'100%'}
justifyContent={'center'}
alignItems={'center'}
>
<NoDataDolphin
message={'데이터가 없습니다.'}
backgroundColor={'background.primary'}
/>
</Stack>
) : (
<Grid container spacing={'1rem'}>
{data?.content?.map((job: IJob) => (
<Grid item key={job.id} sm={12} md={6} lg={4}>
<JobCard {...job} />
</Grid>
))}
</Grid>
)}
</Stack>
</Container>
)
}

export default JobInfo
17 changes: 14 additions & 3 deletions src/app/panel/layout-panel/MobileNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ const MobileNav = () => {
else setValue('my-page')
} else if (pathname.startsWith('/showcase')) {
setValue('showcase')
} else if (pathname.startsWith('/job')) {
setValue('job')
} else {
setValue('')
}
Expand Down Expand Up @@ -82,12 +84,21 @@ const MobileNav = () => {
router.push('/hitchhiking')
}}
/>
{/*<BottomNavigationAction*/}
{/* sx={bottomNavStyle}*/}
{/* label={<Typography fontSize={'0.6875rem'}>쇼케이스</Typography>}*/}
{/* value={'showcase'}*/}
{/* onClick={() => {*/}
{/* router.push('/showcase')*/}
{/* }}*/}
{/* icon={<ShowcaseIcon />}*/}
{/*/>*/}
<BottomNavigationAction
sx={bottomNavStyle}
label={<Typography fontSize={'0.6875rem'}>쇼케이스</Typography>}
value={'showcase'}
label={<Typography fontSize={'0.6875rem'}>채용공고</Typography>}
value={'job'}
onClick={() => {
router.push('/showcase')
router.push('/job')
}}
icon={<ShowcaseIcon />}
/>
Expand Down
38 changes: 34 additions & 4 deletions src/app/panel/layout-panel/PcNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,19 +136,49 @@ const PcNav = () => {
}}
sx={navStyle}
/>
{/*<BottomNavigationAction*/}
{/* value={'showcase'}*/}
{/* label={*/}
{/* <Stack*/}
{/* direction={'row'}*/}
{/* alignItems={'center'}*/}
{/* spacing={'0.15rem'}*/}
{/* >*/}
{/* <Typography*/}
{/* color={value === 'showcase' ? 'primary' : 'text.normal'}*/}
{/* variant="Caption"*/}
{/* >*/}
{/* 쇼케이스*/}
{/* </Typography>*/}
{/* <BetaIcon*/}
{/* style={{*/}
{/* position: 'relative',*/}
{/* top: '-0.5rem',*/}
{/* }}*/}
{/* />*/}
{/* </Stack>*/}
{/* }*/}
{/* onClick={() => {*/}
{/* router.push('/showcase')*/}
{/* }}*/}
{/* sx={{*/}
{/* ...navStyle,*/}
{/* wordBreak: 'keep-all',*/}
{/* }}*/}
{/*/>*/}
<BottomNavigationAction
value={'showcase'}
value={'job'}
label={
<Stack
direction={'row'}
alignItems={'center'}
spacing={'0.15rem'}
>
<Typography
color={value === 'showcase' ? 'primary' : 'text.normal'}
color={value === 'job' ? 'primary' : 'text.normal'}
variant="Caption"
>
쇼케이스
채용공고
</Typography>
<BetaIcon
style={{
Expand All @@ -159,7 +189,7 @@ const PcNav = () => {
</Stack>
}
onClick={() => {
router.push('/showcase')
router.push('/job')
}}
sx={{
...navStyle,
Expand Down
10 changes: 10 additions & 0 deletions src/types/IJob.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export interface IJob {
title: string
writerName: string
createdAt: string
id: number
}

export interface IJobDetail extends IJob {
content: string
}

0 comments on commit a930c0c

Please sign in to comment.