diff --git a/app/(dashboard)/history/components/ListItem/index.tsx b/app/(dashboard)/history/components/ListItem/index.tsx new file mode 100644 index 0000000..1514765 --- /dev/null +++ b/app/(dashboard)/history/components/ListItem/index.tsx @@ -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 ( +
+
{vehicleNumber}
+ {department} + {name} + {drivingDays}일 + {averageDrivingDistance}km + {averageDrivingTime}분 + {totalDrivingDistance}km + {drivingRate}% +
+ +
+
+ ) +} + +export default ListItem diff --git a/app/(dashboard)/history/components/ListItem/styles.css.ts b/app/(dashboard)/history/components/ListItem/styles.css.ts new file mode 100644 index 0000000..ac280fc --- /dev/null +++ b/app/(dashboard)/history/components/ListItem/styles.css.ts @@ -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', +}) diff --git a/app/(dashboard)/history/page.tsx b/app/(dashboard)/history/page.tsx index f062c46..acff701 100644 --- a/app/(dashboard)/history/page.tsx +++ b/app/(dashboard)/history/page.tsx @@ -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
HistoryPage
+ // 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 ( +
+ +
+ + {mockHistoryData.map((history) => ( + + ))} +
+ {/* TODO 페이지네이션 추가 */} +
+ ) } export default HistoryPage diff --git a/app/(dashboard)/history/styles.css.ts b/app/(dashboard)/history/styles.css.ts new file mode 100644 index 0000000..a8ce17a --- /dev/null +++ b/app/(dashboard)/history/styles.css.ts @@ -0,0 +1,7 @@ +import { style } from '@vanilla-extract/css' + +export const listWrapper = style({ + padding: '120px 100px', + display: 'flex', + flexDirection: 'column', +}) diff --git a/app/(dashboard)/log/VehicleList/index.tsx b/app/(dashboard)/log/VehicleList/index.tsx deleted file mode 100644 index e69de29..0000000 diff --git a/app/(dashboard)/log/components/ListItem/index.tsx b/app/(dashboard)/log/components/ListItem/index.tsx new file mode 100644 index 0000000..5fd75c2 --- /dev/null +++ b/app/(dashboard)/log/components/ListItem/index.tsx @@ -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 { + data: ListItemModel +} + +const ListItem = ({ data }: ListItemProps) => { + const { vehicleNumber, vehicleModel, status } = data + + return ( +
+ {vehicleNumber} + {vehicleModel} + + + +
+ +
+
+ ) +} + +export default ListItem diff --git a/app/(dashboard)/log/components/ListItem/styles.css.ts b/app/(dashboard)/log/components/ListItem/styles.css.ts new file mode 100644 index 0000000..ac280fc --- /dev/null +++ b/app/(dashboard)/log/components/ListItem/styles.css.ts @@ -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', +}) diff --git a/app/(dashboard)/log/VehicleRegisterForm/index.tsx b/app/(dashboard)/log/components/VehicleRegisterForm/index.tsx similarity index 100% rename from app/(dashboard)/log/VehicleRegisterForm/index.tsx rename to app/(dashboard)/log/components/VehicleRegisterForm/index.tsx diff --git a/app/(dashboard)/log/VehicleRegisterForm/styles.css.ts b/app/(dashboard)/log/components/VehicleRegisterForm/styles.css.ts similarity index 100% rename from app/(dashboard)/log/VehicleRegisterForm/styles.css.ts rename to app/(dashboard)/log/components/VehicleRegisterForm/styles.css.ts diff --git a/app/(dashboard)/log/page.tsx b/app/(dashboard)/log/page.tsx index 957fd16..d94fccd 100644 --- a/app/(dashboard)/log/page.tsx +++ b/app/(dashboard)/log/page.tsx @@ -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
+ // 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 ( +
+ +
+ + {mockLogData.map((log) => ( + + ))} +
+ + {/* TODO 페이지네이션 추가 */} +
+ ) } export default LogPage diff --git a/app/(dashboard)/log/styles.css.ts b/app/(dashboard)/log/styles.css.ts new file mode 100644 index 0000000..a8ce17a --- /dev/null +++ b/app/(dashboard)/log/styles.css.ts @@ -0,0 +1,7 @@ +import { style } from '@vanilla-extract/css' + +export const listWrapper = style({ + padding: '120px 100px', + display: 'flex', + flexDirection: 'column', +}) diff --git a/components/common/Badge/styles.css.ts b/components/common/Badge/styles.css.ts index 0e121b5..5b2c32d 100644 --- a/components/common/Badge/styles.css.ts +++ b/components/common/Badge/styles.css.ts @@ -13,7 +13,6 @@ export const shape = styleVariants({ [BADGE_SHAPE.RECTANGLE]: { paddingLeft: '12px', paddingRight: '12px', - fontSize: styles.fontSizes.small, borderRadius: '4px', }, [BADGE_SHAPE.CIRCLE]: { diff --git a/components/common/Button/BaseButton/style.css.ts b/components/common/Button/BaseButton/style.css.ts index 74f4981..2575c17 100644 --- a/components/common/Button/BaseButton/style.css.ts +++ b/components/common/Button/BaseButton/style.css.ts @@ -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, }, }) diff --git a/components/common/Button/RoundButton/index.tsx b/components/common/Button/RoundButton/index.tsx index e41b3d4..3ee2b33 100644 --- a/components/common/Button/RoundButton/index.tsx +++ b/components/common/Button/RoundButton/index.tsx @@ -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 ( - + {children} ) diff --git a/components/common/Button/RoundButton/style.css.tsx b/components/common/Button/RoundButton/style.css.tsx index 9f75a5b..16c6408 100644 --- a/components/common/Button/RoundButton/style.css.tsx +++ b/components/common/Button/RoundButton/style.css.tsx @@ -1,41 +1,42 @@ -import { recipe } from '@vanilla-extract/recipes' +import { style } from '@vanilla-extract/css' +import { styleVariants } from '@vanilla-extract/css' import { styles } from '@/styles/theme.css' -export const button = recipe({ - base: { +const baseButton = style({ + borderRadius: '30px', + fontSize: styles.fontSizes.medium, + ':hover': { + opacity: styles.opacity[80], + }, +}) + +export const colorVariants = styleVariants({ + primary: { + backgroundColor: styles.colors.primary, + color: styles.colors.white, + }, + secondary: { backgroundColor: styles.colors.transparent[500], - fontSize: styles.fontSizes.medium, - borderRadius: '30px', - ':hover': { - backgroundColor: styles.colors.gray[50], - }, + color: styles.colors.gray[700], }, - variants: { - size: { - small: { - width: '76px', - height: '48px', - backgroundColor: styles.colors.white, - border: `1px solid ${styles.colors.gray[200]}`, - boxShadow: `0px 4px 4px 0px ${styles.colors.shadow[100]}`, - }, - large: { - color: styles.colors.primary, - height: '60px', - }, - }, - color: { - primary: { - color: styles.colors.primary, - }, - secondary: { - color: styles.colors.black, - }, - }, +}) + +export const sizeVariants = styleVariants({ + small: { + width: '76px', + height: '48px', + border: `1px solid ${styles.colors.gray[200]}`, + boxShadow: `0px 4px 4px 0px ${styles.colors.shadow[100]}`, }, - defaultVariants: { - size: 'large', - color: 'primary', + large: { + height: '60px', + padding: '16px 24px', }, }) + +export const button = { + base: baseButton, + color: colorVariants, + size: sizeVariants, +} diff --git a/components/common/Button/SquareButton/index.tsx b/components/common/Button/SquareButton/index.tsx index 2bdc9f9..23a705b 100644 --- a/components/common/Button/SquareButton/index.tsx +++ b/components/common/Button/SquareButton/index.tsx @@ -14,7 +14,7 @@ interface SquareButtonProps extends ComponentPropsWithoutRef<'button'> { } const SquareButton = ({ children, color = 'primary', ...props }: SquareButtonProps) => { return ( - + {children} ) diff --git a/components/common/Button/SquareButton/style.css.tsx b/components/common/Button/SquareButton/style.css.tsx index 9354546..4894959 100644 --- a/components/common/Button/SquareButton/style.css.tsx +++ b/components/common/Button/SquareButton/style.css.tsx @@ -1,35 +1,45 @@ -import { styleVariants } from '@vanilla-extract/css' +import { recipe } from '@vanilla-extract/recipes' import { styles } from '@/styles/theme.css' -export const button = styleVariants({ - primary: { - backgroundColor: styles.colors.primary, - color: styles.colors.white, - ':hover': { - opacity: 0.8, - }, - }, - white: { - backgroundColor: styles.colors.white, - color: styles.colors.black, - border: `1px solid ${styles.colors.black}`, - ':hover': { - backgroundColor: styles.colors.gray[50], - }, +export const button = recipe({ + base: { + padding: '16px 24px', }, - error: { - backgroundColor: styles.colors.error, - color: styles.colors.white, - ':hover': { - opacity: 0.8, + variants: { + color: { + primary: { + backgroundColor: styles.colors.primary, + color: styles.colors.white, + ':hover': { + opacity: styles.opacity[80], + }, + }, + white: { + backgroundColor: styles.colors.white, + color: styles.colors.black, + border: `1px solid ${styles.colors.black}`, + ':hover': { + backgroundColor: styles.colors.gray[50], + }, + }, + error: { + backgroundColor: styles.colors.error, + color: styles.colors.white, + ':hover': { + opacity: styles.opacity[80], + }, + }, + dark: { + backgroundColor: styles.colors.dark, + color: styles.colors.white, + ':hover': { + backgroundColor: styles.colors.gray[800], + }, + }, }, }, - dark: { - backgroundColor: styles.colors.dark, - color: styles.colors.white, - ':hover': { - backgroundColor: styles.colors.gray[800], - }, + defaultVariants: { + color: 'primary', }, }) diff --git a/components/common/Input/BaseInput/index.tsx b/components/common/Input/BaseInput/index.tsx index a449e39..cec6454 100644 --- a/components/common/Input/BaseInput/index.tsx +++ b/components/common/Input/BaseInput/index.tsx @@ -17,7 +17,7 @@ const BaseInput = forwardRef( placeholder={placeholder || '차량번호를 검색하세요.'} className={`${styles.baseInput} ${isError && styles.errorInput} - ${className}`} + ${className}`} {...props} /> ) diff --git a/components/domain/vehicle/ListHeader/index.tsx b/components/domain/vehicle/ListHeader/index.tsx new file mode 100644 index 0000000..5ed83d0 --- /dev/null +++ b/components/domain/vehicle/ListHeader/index.tsx @@ -0,0 +1,20 @@ +import * as styles from './styles.css' + +interface ListHeaderProps { + headerTitles: string[] +} + +const ListHeader = ({ headerTitles = [] }: ListHeaderProps) => { + return ( +
+ {headerTitles.map((title) => ( +
+ {title} +
+ ))} +
+
+ ) +} + +export default ListHeader diff --git a/components/domain/vehicle/ListHeader/styles.css.ts b/components/domain/vehicle/ListHeader/styles.css.ts new file mode 100644 index 0000000..e2be262 --- /dev/null +++ b/components/domain/vehicle/ListHeader/styles.css.ts @@ -0,0 +1,21 @@ +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.gray[600], +}) + +export const headerTitle = style({ + flex: 1, +}) + +export const headerIcon = style({ + width: '24px', + height: '24px', +}) diff --git a/components/domain/vehicle/SearchField/index.tsx b/components/domain/vehicle/SearchField/index.tsx new file mode 100644 index 0000000..090da26 --- /dev/null +++ b/components/domain/vehicle/SearchField/index.tsx @@ -0,0 +1,24 @@ +import { RoundButton } from '@/components/common/Button/RoundButton' +import SearchInput from '@/components/common/Input/SearchInput' + +import * as styles from './styles.css' + +interface SearchFieldProps { + hasButton: boolean +} +const SearchField = ({ hasButton }: SearchFieldProps) => { + return ( +
+
+ {hasButton && ( + + 등록 + + )} + +
+
+ ) +} + +export default SearchField diff --git a/components/domain/vehicle/SearchField/styles.css.ts b/components/domain/vehicle/SearchField/styles.css.ts new file mode 100644 index 0000000..e2d9321 --- /dev/null +++ b/components/domain/vehicle/SearchField/styles.css.ts @@ -0,0 +1,11 @@ +import { style } from '@vanilla-extract/css' + +export const container = style({ + position: 'absolute', + top: '2rem', + right: '2rem', + display: 'flex', + gap: '12px', + alignItems: 'center', + marginBottom: '12rem', +}) diff --git a/styles/theme.css.ts b/styles/theme.css.ts index df2ec73..fbfba19 100644 --- a/styles/theme.css.ts +++ b/styles/theme.css.ts @@ -92,10 +92,16 @@ export const zIndex = { below: '-1', } +const opacity = { + 80: '0.8', + 50: '0.5', +} + export const styles = createGlobalTheme(':root', { breakPoints, colors, fontSizes, fontWeights, zIndex, + opacity, }) diff --git a/types/history.ts b/types/history.ts new file mode 100644 index 0000000..372c431 --- /dev/null +++ b/types/history.ts @@ -0,0 +1,11 @@ +export interface ListItemModel { + id: number + vehicleNumber: string + department: string + name: string + drivingDays: number + averageDrivingDistance: number + averageDrivingTime: number + totalDrivingDistance: number + drivingRate: React.ReactNode +} diff --git a/types/log.ts b/types/log.ts new file mode 100644 index 0000000..bd15fe8 --- /dev/null +++ b/types/log.ts @@ -0,0 +1,8 @@ +export interface ListItemModel { + id: number + vehicleNumber: string + vehicleModel: string + status: VehicleStatusType +} + +type VehicleStatusType = '운행중' | '미운행' | '미관제'