-
Notifications
You must be signed in to change notification settings - Fork 0
feat#29-mainpage-ui #37
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
Changes from all commits
9affec8
b09a96d
22a38c5
b853215
0764765
93a4e56
986b742
081aeb0
cc336d8
00df347
f0225c3
af564b1
6745e8f
6f03a70
a2f379b
785b7e0
0e32223
16bac0d
5b2b7c7
631624d
c9815fa
83ec631
24480f8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| import { ChevronLeftIcon, ChevronRightIcon } from 'lucide-react'; | ||
|
|
||
| import { Button } from '@/shared'; | ||
|
|
||
| type Props = { | ||
| currentPage: number; | ||
| setCurrentPage: (page: number) => void; | ||
| totalPages: number; | ||
| }; | ||
|
|
||
| export const Pagination = ({ currentPage, setCurrentPage, totalPages }: Props) => { | ||
| return ( | ||
| <div className='mt-6 flex items-center justify-center gap-2'> | ||
| <Button | ||
| variant='ghost' | ||
| size='icon' | ||
| onClick={() => setCurrentPage(Math.max(1, currentPage - 1))} | ||
| disabled={currentPage === 1} | ||
| className='size-8 rounded-full text-gray-600 hover:bg-gray-100 disabled:opacity-50' | ||
| > | ||
| <ChevronLeftIcon className='size-4' /> | ||
| </Button> | ||
|
|
||
| {Array.from({ length: totalPages }, (_, i) => i + 1).map((page) => ( | ||
| <Button | ||
| variant='ghost' | ||
| key={page} | ||
| onClick={() => setCurrentPage(page)} | ||
| className={`size-8 rounded-full ${ | ||
| currentPage === page | ||
| ? 'bg-lighthouse-blue text-white' | ||
| : 'text-[#6B7684] hover:bg-[#E6E8EA]' | ||
| }`} | ||
| > | ||
| {page} | ||
| </Button> | ||
| ))} | ||
|
|
||
| <Button | ||
| variant='ghost' | ||
| size='icon' | ||
| onClick={() => setCurrentPage(Math.min(totalPages, currentPage + 1))} | ||
| disabled={currentPage === totalPages} | ||
| className='size-8 rounded-full text-gray-600 hover:bg-gray-100 disabled:opacity-50' | ||
| > | ||
| <ChevronRightIcon className='size-4' /> | ||
| </Button> | ||
| </div> | ||
| ); | ||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,4 @@ | ||
| export * from './form'; | ||
| export * from './chart'; | ||
| export * from './reliability'; | ||
| export * from './property'; |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,60 @@ | ||||||||||||||||||
| import { useState } from 'react'; | ||||||||||||||||||
|
|
||||||||||||||||||
| import HomeIcon from '../../../_assets/Home.webp'; | ||||||||||||||||||
| import type { Property } from '../../../types'; | ||||||||||||||||||
| import { getPropertyTypeColor } from '../../../utils'; | ||||||||||||||||||
| import { Pagination } from '../../common'; | ||||||||||||||||||
|
|
||||||||||||||||||
| type Props = { | ||||||||||||||||||
| properties: Property[]; | ||||||||||||||||||
| title: string; | ||||||||||||||||||
| }; | ||||||||||||||||||
|
Comment on lines
+8
to
+11
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||
|
|
||||||||||||||||||
| export const PropertyListBox = ({ properties, title }: Props) => { | ||||||||||||||||||
| const [currentPage, setCurrentPage] = useState(1); | ||||||||||||||||||
| const itemsPerPage = 5; | ||||||||||||||||||
| const totalPages = Math.ceil(properties.length / itemsPerPage); | ||||||||||||||||||
|
|
||||||||||||||||||
| const startIndex = (currentPage - 1) * itemsPerPage; | ||||||||||||||||||
| const endIndex = startIndex + itemsPerPage; | ||||||||||||||||||
| const currentProperties = properties.slice(startIndex, endIndex); | ||||||||||||||||||
|
|
||||||||||||||||||
| return ( | ||||||||||||||||||
| <div className='w-full rounded-lg bg-white p-6'> | ||||||||||||||||||
| <h3 className='mb-4 text-2xl font-bold text-gray-900'>{title}</h3> | ||||||||||||||||||
|
|
||||||||||||||||||
| <div className='space-y-4'> | ||||||||||||||||||
| {currentProperties.map((property) => ( | ||||||||||||||||||
| <div key={property.id} className='flex items-start justify-center gap-3'> | ||||||||||||||||||
| <img src={HomeIcon} alt='home' className='mt-1 h-[19px] w-[15px]' /> | ||||||||||||||||||
|
|
||||||||||||||||||
| <div className='flex flex-1 flex-col gap-1'> | ||||||||||||||||||
| {/* ๋งค๋ฌผ ํ์ ๋ผ๋ฒจ */} | ||||||||||||||||||
| <div className='flex items-center gap-3'> | ||||||||||||||||||
| <span | ||||||||||||||||||
| className='flex h-6 w-16 items-center justify-center rounded-xs text-sm font-medium text-white' | ||||||||||||||||||
| style={{ | ||||||||||||||||||
| backgroundColor: getPropertyTypeColor(property.type), | ||||||||||||||||||
| }} | ||||||||||||||||||
| > | ||||||||||||||||||
| {property.type} | ||||||||||||||||||
| </span> | ||||||||||||||||||
| <span className='text-lg font-medium text-gray-900'>{property.buildingName}</span> | ||||||||||||||||||
| </div> | ||||||||||||||||||
|
|
||||||||||||||||||
| {/* ์์ธ ์ฃผ์ */} | ||||||||||||||||||
| <span className='text-sm text-gray-500'>{property.address}</span> | ||||||||||||||||||
| </div> | ||||||||||||||||||
| </div> | ||||||||||||||||||
| ))} | ||||||||||||||||||
| </div> | ||||||||||||||||||
|
|
||||||||||||||||||
| {/* ํ์ด์ง๋ค์ด์ */} | ||||||||||||||||||
| <Pagination | ||||||||||||||||||
| currentPage={currentPage} | ||||||||||||||||||
| setCurrentPage={setCurrentPage} | ||||||||||||||||||
| totalPages={totalPages} | ||||||||||||||||||
| /> | ||||||||||||||||||
| </div> | ||||||||||||||||||
| ); | ||||||||||||||||||
| }; | ||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export * from './PropertyListBox'; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| import { getTrustGradeColorClass } from '@/shared'; | ||
|
|
||
| import { LANDLORD_TRUST_DATA } from '../../../mock'; | ||
|
|
||
| export const GradeBox = () => { | ||
| return ( | ||
| <div className='flex flex-col gap-2'> | ||
| <h1 className='text-3xl font-bold'>์๋์ธ ์ ๋ขฐ๋ ๋ฑ๊ธ</h1> | ||
| <span className='text-md flex gap-2 font-semibold'> | ||
| <span className='text-black'>์ํ์ ์ :</span> | ||
| <span className='text-chart-green'>{LANDLORD_TRUST_DATA.trustScore}</span> | ||
| <span className='text-black'>์ </span> | ||
| </span> | ||
| <div className='flex w-full items-center justify-center'> | ||
| <span | ||
| className={`text-landlord-reliability font-semibold ${getTrustGradeColorClass(LANDLORD_TRUST_DATA.grade)}`} | ||
| > | ||
| {LANDLORD_TRUST_DATA.grade} | ||
| </span> | ||
| </div> | ||
| </div> | ||
| ); | ||
| }; |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,15 @@ | ||||||
| import { LANDLORD_TRUST_DATA } from '../../../mock'; | ||||||
|
|
||||||
| export const MultiHouseBox = () => { | ||||||
| return ( | ||||||
| <div> | ||||||
| <h1 className='text-3xl font-bold'>๋ค์ฃผํ์</h1> | ||||||
| <div className='flex w-full items-end justify-center'> | ||||||
| <span className='text-landlord-reliability font-bold text-blue-500'> | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ์์ ๊ฐ์ด ์ด ๋ณ๊ฒฝ์ ์ ์ฉํ๋ ค๋ฉด ํ์ผ ์๋จ์
Suggested change
|
||||||
| {LANDLORD_TRUST_DATA.ownedUnsoldCount} | ||||||
| </span> | ||||||
| <span className='mb-25 text-5xl font-semibold text-black'>์ฑ</span> | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||||||
| </div> | ||||||
| </div> | ||||||
| ); | ||||||
| }; | ||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| import { RELIABILITY_REASONS } from '../../../mock'; | ||
|
|
||
| export const ReasonBox = () => { | ||
| return ( | ||
| <div className='flex w-full flex-col gap-2 pb-3'> | ||
| <h1 className='text-3xl font-bold'>์๋์ธ ์ ๋ขฐ๋ ๋ฑ๊ธ ์ฌ์ </h1> | ||
| {RELIABILITY_REASONS.map((reason, index) => ( | ||
| <div | ||
| key={`${reason.name}-${reason.percent}-${index}`} | ||
| className='flex items-center gap-5 py-3 text-center font-semibold' | ||
| > | ||
| <div className='size-1 rounded-full bg-black' /> | ||
| <span className='flex items-center gap-2 text-gray-900'> | ||
| <span className='text-lg text-lighthouse-blue'>{reason.name}</span> | ||
| <div className='flex items-center gap-1'> | ||
| <span className='font-medium text-red-500'>{reason.percent}</span> | ||
| <span className='text-black'>%</span> | ||
| </div> | ||
| </span> | ||
| </div> | ||
| ))} | ||
| </div> | ||
| ); | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| import { getSubrogationColorClass } from '@/shared'; | ||
|
|
||
| import { LANDLORD_TRUST_DATA } from '../../../mock'; | ||
|
|
||
| export const SubrogationPaymentBox = () => { | ||
| return ( | ||
| <div> | ||
| <h1 className='text-3xl font-bold'>๋์๋ณ์ ์ด๋ ฅ</h1> | ||
| <div className='flex w-full items-end justify-center'> | ||
| <span | ||
| className={`text-landlord-reliability font-bold ${getSubrogationColorClass(LANDLORD_TRUST_DATA.subrogationCount)}`} | ||
| > | ||
| {LANDLORD_TRUST_DATA.subrogationCount} | ||
| </span> | ||
| <span className='mb-25 text-5xl font-semibold text-black'>ํ</span> | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| </div> | ||
| </div> | ||
| ); | ||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| export * from './GradeBox'; | ||
| export * from './ReasonBox'; | ||
| export * from './SubrogationPaymentBox'; | ||
| export * from './MultiHouseBox'; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,3 @@ | ||
| export * from './form-type'; | ||
| export * from './house-type'; | ||
| export * from './property-type'; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| // ๊ธฐ๋ณธ ๋งค๋ฌผ ํ์ ๋ณ ์์ ์ ์ | ||
| export const PROPERTY_TYPE_COLORS = { | ||
| ์คํผ์คํ : '#B27373', // ์ ๊ฐ์ | ||
| ์๋ฃธ: '#73B286', // ์ฐํ ์ด๋ก์ | ||
| ํฌ๋ฃธ: '#7573B2', // ๋ณด๋ผ์ | ||
| ์ํํธ: '#B273AE', // ์ฐํ ๋ถํ์ | ||
| ๋ณต์ธต: '#739EB2', // ์ฒญ๋ก์ | ||
| ๋น๋ผ: '#FFA500', // ์ฃผํฉ์ | ||
| ๋จ๋ ์ฃผํ: '#32CD32', // ๋ผ์์ | ||
| } as const; | ||
|
|
||
| // ๋์ ์์ ์์ฑ์ ์ํ fallback ์์ ๋ฐฐ์ด | ||
| export const FALLBACK_COLORS = [ | ||
| '#FF6B6B', // ๋นจ๊ฐ์ | ||
| '#4ECDC4', // ์ฒญ๋ก์ | ||
| '#45B7D1', // ํ๋์ | ||
| '#96CEB4', // ์ฐํ ์ด๋ก์ | ||
| '#FFEAA7', // ์ฐํ ๋ ธ๋์ | ||
| '#DDA0DD', // ์ฐํ ๋ณด๋ผ์ | ||
| '#98D8C8', // ๋ฏผํธ์ | ||
| '#F7DC6F', // ๋ ธ๋์ | ||
| '#BB8FCE', // ์ฐํ ๋ณด๋ผ์ | ||
| '#85C1E9', // ํ๋์ | ||
| ] as const; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,4 @@ | ||
| export * from './chart-data.mock'; | ||
| export * from './landlord-reliability.mock'; | ||
| export * from './property-data.mock'; | ||
| export * from './risk-analysis.mock'; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| // ์๋์ธ ์ ๋ขฐ๋ ๋ฑ๊ธ, ๋์๋ณ์ ์ด๋ ฅ, ๋ค์ฃผํ์ | ||
| export const LANDLORD_TRUST_DATA = { | ||
| trustScore: 85, | ||
| subrogationCount: 0, | ||
| arrearsCount: 0, | ||
| litigationCount: 0, | ||
| ownedUnsoldCount: 2, | ||
| grade: 'A', | ||
| }; | ||
|
|
||
| // ์๋์ธ ์ ๋ขฐ๋ ๋ฑ๊ธ ์ฌ์ | ||
| export const RELIABILITY_REASONS = [ | ||
| { | ||
| name: '์๋์ธ ์ ๋ขฐ๋ ๋ฑ๊ธ ์ฌ์ ', | ||
| percent: 25, | ||
| }, | ||
| { | ||
| name: '์๋์ธ ์ ๋ขฐ๋ ๋ฑ๊ธ ์ฌ์ ', | ||
| percent: 20, | ||
| }, | ||
| { | ||
| name: '์๋์ธ ์ ๋ขฐ๋ ๋ฑ๊ธ ์ฌ์ ', | ||
| percent: 18, | ||
| }, | ||
| { | ||
| name: '์๋์ธ ์ ๋ขฐ๋ ๋ฑ๊ธ ์ฌ์ ', | ||
| percent: 15, | ||
| }, | ||
| { | ||
| name: '์๋์ธ ์ ๋ขฐ๋ ๋ฑ๊ธ ์ฌ์ ', | ||
| percent: 12, | ||
| }, | ||
| ]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ํ์ด์ง ์๊ฐ ๋ง์์ง ๊ฒฝ์ฐ ๋ชจ๋ ํ์ด์ง ๋ฒํผ์ ๋ ๋๋งํ๋ฉด UI๊ฐ ๊ธธ์ด์ง๊ณ ์ฌ์ฉ์ฑ์ด ๋จ์ด์ง ์ ์์ต๋๋ค. ์๋ฅผ ๋ค์ด, 100๊ฐ์ ํ์ด์ง๊ฐ ์๋ค๋ฉด 100๊ฐ์ ๋ฒํผ์ด ๋ชจ๋ ํ์๋ฉ๋๋ค. ํ์ฌ ํ์ด์ง ์ฃผ๋ณ์ ์ผ๋ถ ํ์ด์ง๋ง ํ์ํ๊ณ ๋๋จธ์ง๋ '...'์ผ๋ก ์ฒ๋ฆฌํ๋ ๋ก์ง์ ์ถ๊ฐํ์ฌ ํ์ฅ์ฑ์ ๊ฐ์ ํ๋ ๊ฒ์ ๊ณ ๋ คํด๋ณด์ธ์.