Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feat] LogPage, HistoryPage 퍼블리싱 및 리스트 컴포넌트 작업 #47

Merged
merged 15 commits into from
Jan 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions app/(dashboard)/history/components/ListItem/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { RightIcon } from '@/public/icons'
import { ListItemModel } from '@/types/history'

import * as styles from './styles.css'

interface ListItemProps {
data: ListItemModel
}

const ListItem = ({ data }: ListItemProps) => {
const {
vehicleNumber,
department,
name,
drivingDays,
averageDrivingDistance,
averageDrivingTime,
totalDrivingDistance,
drivingRate,
} = data

return (
<div className={styles.container}>
<div className={styles.itemWrapper}>{vehicleNumber}</div>
<span className={styles.itemWrapper}>{department}</span>
<span className={styles.itemWrapper}>{name}</span>
<span className={styles.itemWrapper}>{drivingDays}일</span>
<span className={styles.itemWrapper}>{averageDrivingDistance}km</span>
<span className={styles.itemWrapper}>{averageDrivingTime}분</span>
<span className={styles.itemWrapper}>{totalDrivingDistance}km</span>
<span className={styles.itemWrapper}>{drivingRate}%</span>
<div className={styles.icon}>
<RightIcon />
</div>
</div>
)
}

export default ListItem
23 changes: 23 additions & 0 deletions app/(dashboard)/history/components/ListItem/styles.css.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { style } from '@vanilla-extract/css'

import { styles } from '@/styles/theme.css'

export const container = style({
display: 'flex',
alignItems: 'center',
textAlign: 'center',
padding: '24px 0px',
borderBottom: `1px solid ${styles.colors.gray[200]}`,
color: styles.colors.black,
fontWeight: styles.fontWeights.bold,
fontSize: styles.fontSizes.mediumPlus,
})

export const itemWrapper = style({
flex: 1,
})

export const icon = style({
width: '24px',
height: '24px',
})
146 changes: 145 additions & 1 deletion app/(dashboard)/history/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,149 @@
'use client'

import ListHeader from '@/components/domain/vehicle/ListHeader'
import SearchField from '@/components/domain/vehicle/SearchField'
import { ListItemModel } from '@/types/history'

import ListItem from './components/ListItem/index'
import * as styles from './styles.css'

const HistoryPage = () => {
return <div>HistoryPage</div>
// TODO 실제 데이터로 변경하기
const mockHistoryData: ListItemModel[] = [
{
id: 1,
vehicleNumber: '123가 4567',
department: '해외영업1팀',
name: '김알린',
drivingDays: 15,
averageDrivingDistance: 150,
averageDrivingTime: 480,
totalDrivingDistance: 2250,
drivingRate: '85',
},
{
id: 2,
vehicleNumber: '456나 7890',
department: '국내영업2팀',
name: '이택배',
drivingDays: 12,
averageDrivingDistance: 180,
averageDrivingTime: 420,
totalDrivingDistance: 2160,
drivingRate: '78',
},
{
id: 3,
vehicleNumber: '789다 1234',
department: '해외영업2팀',
name: '박배송',
drivingDays: 18,
averageDrivingDistance: 165,
averageDrivingTime: 510,
totalDrivingDistance: 2970,
drivingRate: '92',
},
{
id: 4,
vehicleNumber: '321라 5678',
department: '국내영업1팀',
name: '최드라',
drivingDays: 14,
averageDrivingDistance: 145,
averageDrivingTime: 450,
totalDrivingDistance: 2030,
drivingRate: '75',
},
{
id: 5,
vehicleNumber: '654마 9012',
department: '해외영업3팀',
name: '정기사',
drivingDays: 16,
averageDrivingDistance: 175,
averageDrivingTime: 495,
totalDrivingDistance: 2800,
drivingRate: '88',
},
{
id: 6,
vehicleNumber: '987바 3456',
department: '국내영업3팀',
name: '강운전',
drivingDays: 13,
averageDrivingDistance: 155,
averageDrivingTime: 435,
totalDrivingDistance: 2015,
drivingRate: '82',
},
{
id: 7,
vehicleNumber: '147사 7890',
department: '해외영업1팀',
name: '조안전',
drivingDays: 17,
averageDrivingDistance: 185,
averageDrivingTime: 525,
totalDrivingDistance: 3145,
drivingRate: '95',
},
{
id: 8,
vehicleNumber: '258아 1234',
department: '국내영업2팀',
name: '윤차량',
drivingDays: 11,
averageDrivingDistance: 135,
averageDrivingTime: 390,
totalDrivingDistance: 1485,
drivingRate: '70',
},
{
id: 9,
vehicleNumber: '369자 5678',
department: '해외영업2팀',
name: '한주행',
drivingDays: 19,
averageDrivingDistance: 195,
averageDrivingTime: 540,
totalDrivingDistance: 3705,
drivingRate: '98',
},
{
id: 10,
vehicleNumber: '159차 9012',
department: '국내영업3팀',
name: '황배달',
drivingDays: 15,
averageDrivingDistance: 160,
averageDrivingTime: 465,
totalDrivingDistance: 2400,
drivingRate: '86',
},
]

const headerTitles = [
'차량번호',
'부서명',
'이름',
'운행일수',
'평균운행거리',
'평균운행시간',
'총운행거리',
'운행률',
]
return (
<div>
<SearchField hasButton={false} />
<div className={styles.listWrapper}>
<ListHeader headerTitles={headerTitles} />
{mockHistoryData.map((history) => (
<ListItem key={history.id} data={history} />
))}
</div>
{/* TODO 페이지네이션 추가 */}
</div>
)
}

export default HistoryPage
7 changes: 7 additions & 0 deletions app/(dashboard)/history/styles.css.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { style } from '@vanilla-extract/css'

export const listWrapper = style({
padding: '120px 100px',
display: 'flex',
flexDirection: 'column',
})
Empty file.
28 changes: 28 additions & 0 deletions app/(dashboard)/log/components/ListItem/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import Badge from '@/components/common/Badge'
import { RightIcon } from '@/public/icons'
import { ListItemModel } from '@/types/log'

import * as styles from './styles.css'

interface ListItemProps {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

여기처럼 위 History도 컨벤션대로 수정해주세요~

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

넵!

data: ListItemModel
}

const ListItem = ({ data }: ListItemProps) => {
const { vehicleNumber, vehicleModel, status } = data

return (
<div className={styles.container}>
<span className={styles.itemWrapper}>{vehicleNumber}</span>
<span className={styles.itemWrapper}>{vehicleModel}</span>
<span className={styles.itemWrapper}>
<Badge shape={'rectangle'} variant={status} />
</span>
<div className={styles.icon}>
<RightIcon />
</div>
</div>
)
}

export default ListItem
23 changes: 23 additions & 0 deletions app/(dashboard)/log/components/ListItem/styles.css.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { style } from '@vanilla-extract/css'

import { styles } from '@/styles/theme.css'

export const container = style({
display: 'flex',
alignItems: 'center',
textAlign: 'center',
padding: '24px 0px',
borderBottom: `1px solid ${styles.colors.gray[200]}`,
color: styles.colors.black,
fontWeight: styles.fontWeights.bold,
fontSize: styles.fontSizes.mediumPlus,
})

export const itemWrapper = style({
flex: 1,
})

export const icon = style({
width: '24px',
height: '24px',
})
39 changes: 38 additions & 1 deletion app/(dashboard)/log/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,42 @@
'use client'

import ListHeader from '@/components/domain/vehicle/ListHeader'
import SearchField from '@/components/domain/vehicle/SearchField'
import { ListItemModel } from '@/types/log'

import ListItem from './components/ListItem/index'
import * as styles from './styles.css'

const LogPage = () => {
return <div></div>
// TODO 실제 데이터로 변경하기
const mockLogData: ListItemModel[] = [
{ id: 1, vehicleNumber: '123가 4567', vehicleModel: '미니쿠퍼', status: '운행중' },
{ id: 2, vehicleNumber: '456나 7890', vehicleModel: '현대', status: '미운행' },
{ id: 3, vehicleNumber: '789다 1234', vehicleModel: '기아', status: '미관제' },
{ id: 4, vehicleNumber: '321라 5678', vehicleModel: '토요타', status: '운행중' },
{ id: 5, vehicleNumber: '654마 9012', vehicleModel: '벤츠', status: '미운행' },
{ id: 6, vehicleNumber: '987바 3456', vehicleModel: '테슬라', status: '미운행' },
{ id: 7, vehicleNumber: '147사 7890', vehicleModel: '아우디', status: '운행중' },
{ id: 8, vehicleNumber: '258아 1234', vehicleModel: '포르쉐', status: '운행중' },
{ id: 9, vehicleNumber: '369자 5678', vehicleModel: '볼보', status: '운행중' },
{ id: 10, vehicleNumber: '159차 9012', vehicleModel: '폭스바겐', status: '운행중' },
]

const headerTitles = ['차량번호', '차종', '차량현황']

return (
<div>
<SearchField hasButton={true} />
<div className={styles.listWrapper}>
<ListHeader headerTitles={headerTitles} />
{mockLogData.map((log) => (
<ListItem key={log.id} data={log} />
))}
</div>

{/* TODO 페이지네이션 추가 */}
</div>
)
}

export default LogPage
7 changes: 7 additions & 0 deletions app/(dashboard)/log/styles.css.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { style } from '@vanilla-extract/css'

export const listWrapper = style({
padding: '120px 100px',
display: 'flex',
flexDirection: 'column',
})
1 change: 0 additions & 1 deletion components/common/Badge/styles.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ export const shape = styleVariants({
[BADGE_SHAPE.RECTANGLE]: {
paddingLeft: '12px',
paddingRight: '12px',
fontSize: styles.fontSizes.small,
borderRadius: '4px',
},
[BADGE_SHAPE.CIRCLE]: {
Expand Down
3 changes: 1 addition & 2 deletions components/common/Button/BaseButton/style.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@ export const base = style({
fontWeight: styles.fontWeights.bold,
border: `1px solid ${styles.colors.gray[200]}`,
borderRadius: '8px',
padding: '16px 24px',
':disabled': {
cursor: 'not-allowed',
opacity: 0.5,
opacity: styles.opacity[50],
color: styles.colors.black,
},
})
12 changes: 8 additions & 4 deletions components/common/Button/RoundButton/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,17 @@ type ColorType = 'primary' | 'secondary'

interface RoundButtonProps extends ComponentPropsWithoutRef<'button'> {
children: ReactNode
size?: SizeType
color?: ColorType
size: SizeType
color: ColorType
className?: string
}

export const RoundButton = ({ size = 'large', color = 'primary', children, ...props }: RoundButtonProps) => {
export const RoundButton = ({ size = 'large', color = 'primary', children, className, ...props }: RoundButtonProps) => {
return (
<BaseButton className={styles.button({ size, color })} {...props}>
<BaseButton
className={`${styles.button.base} ${styles.sizeVariants[size]} ${styles.colorVariants[color]} ${className ?? ''}`}
{...props}
>
{children}
</BaseButton>
)
Expand Down
Loading