-
Notifications
You must be signed in to change notification settings - Fork 0
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
대시보드 UI 구현 #40
대시보드 UI 구현 #40
Conversation
* 한국 통화 변환 함수 구현 * open 시간, time시간 체크 함수 구현
* 대시보드 Card 컴포넌트 * 카드 List 컴포넌트 * 주문 목록 테이블 * 가게 정보 * 옵션 메뉴 컴포넌트
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.
고생하셨습니다!
다만 간격들이 묘하게 애매한것 같은...? ㅎ...?
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.
옹 머지되면 저도 가져다 써야겠네요
const columns: ColumnDef<Order>[] = useMemo( | ||
() => [ | ||
{ | ||
header: 'OrderID', | ||
accessorKey: 'orderId', | ||
enableSorting: true, | ||
}, | ||
{ | ||
header: 'storeName', | ||
accessorKey: 'storeName', | ||
enableSorting: true, | ||
}, | ||
{ | ||
header: 'ordererName', | ||
accessorKey: 'ordererName', | ||
enableSorting: true, | ||
}, | ||
{ | ||
header: 'menutotalPrice', | ||
accessorKey: 'menutotalPrice', | ||
accessorFn: (data) => formatToKoreanCurrency(data.menutotalPrice), | ||
enableSorting: true, | ||
}, | ||
{ | ||
header: 'status', | ||
accessorKey: 'status', | ||
enableSorting: true, | ||
}, | ||
], | ||
[], |
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.
최근에는 굳이 써야하는 곳이 아니라면 useMemo를 안쓰는게 오히려 메모리 측면에 낫다는 이야기가 있더라구요. 저도 적정선이 어딘지 참으로 고민이되요 ㅎ...
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.
맞아요!! useMemo는 저도 최대한 지양 해야 한다고 생각하는데, React table 예시에서 useMemo로 표현한게 있길래 일단은 급하게 구현하느라 메모를 써서 표현해봤어요. 좀더 찾아봐서 수정해야하는 포인트라고 생각합니다 ㅎㅎ React table을 처음 사용해봐서요ㅠ
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.
요기서 columns 배열은 컴포넌트 외부로 분리되어도 괜찮을 것 같네요!
return ( | ||
<ImageLoader | ||
accept=".jpg, .jpeg, .png .JPG" | ||
onMetadataLoaded={(data) => { | ||
setSrc(data.src); | ||
}} | ||
limit={{ | ||
width: { | ||
max: 3000, | ||
onError: (error) => { | ||
console.log(error); | ||
}, | ||
}, | ||
height: 3000, | ||
}} | ||
> |
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.
헿 사용해주는 사람이 생겼다
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.
정말 편한 라이브러리 입니다 굿굿!! pic-pik
const ImageUpload = () => { | ||
return <PicPickComponent />; | ||
}; |
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.
단순 궁금증인데 한번더 감싸신 이유가뭘까용?
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.
지금 코드가 이전 코드인거 같네요 ?? 이상하넹 수정한지 좀 됐는데 다시 확인해볼게요. 현재는 아래와 같아요
export const ImageUpload = () => {
const [originalImageMetadata, setOriginalImageMetadata] =
useState<ImageMetadata | null>(null);
const { metadata } = useResizeImage({
metadata: originalImageMetadata,
option: {
mode: 'aspectRatio',
...(originalImageMetadata &&
originalImageMetadata.width > originalImageMetadata.height
? { height: 352 }
: { width: 352 }),
},
});
return (
<div css={_imageWrapper}>
<ImageLoader onMetadataLoaded={setOriginalImageMetadata}>
{originalImageMetadata && metadata ? (
<div css={_imageLoader}>
<img src={metadata.src} width={'100%'} />
</div>
) : (
<div css={_imageLoader}>Please upload a picture</div>
)}
</ImageLoader>
</div>
);
};
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.
테이블 컴포넌트는 장원님이 만들어주신 방향으로 가는게 좋을 것 같습니다!
(제가 너무 대충 만들어서요 ㅠㅠ)
const columns: ColumnDef<Order>[] = useMemo( | ||
() => [ | ||
{ | ||
header: 'OrderID', | ||
accessorKey: 'orderId', | ||
enableSorting: true, | ||
}, | ||
{ | ||
header: 'storeName', | ||
accessorKey: 'storeName', | ||
enableSorting: true, | ||
}, | ||
{ | ||
header: 'ordererName', | ||
accessorKey: 'ordererName', | ||
enableSorting: true, | ||
}, | ||
{ | ||
header: 'menutotalPrice', | ||
accessorKey: 'menutotalPrice', | ||
accessorFn: (data) => formatToKoreanCurrency(data.menutotalPrice), | ||
enableSorting: true, | ||
}, | ||
{ | ||
header: 'status', | ||
accessorKey: 'status', | ||
enableSorting: true, | ||
}, | ||
], | ||
[], |
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.
요기서 columns 배열은 컴포넌트 외부로 분리되어도 괜찮을 것 같네요!
const OpeningHoursAndFees = ({ | ||
open, | ||
close, | ||
minCost, | ||
delivery, | ||
}: OpeningHoursAndFeesProps) => { | ||
const [openTime, setOpenTime] = useState<string>(open); | ||
const [closeTime, setCloseTime] = useState<string>(close); | ||
const [minOrder, setMinOrder] = useState<number>(minCost); | ||
const [deliveryFee, setDeliveryFee] = useState<string>(delivery); |
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.
props로 받은 값을 useState의 초기값으로 넣으면 props 값이 변경이 되어도 useState의 값은 초기값을 계속 유지하게 되어서 요렇게 작성하는 건 좋지 않은 패턴인 것 같아요!
부모 컴포넌트에서 OpeningHoursAndFees 컴포넌트에 상태를 변경하는 함수를 전달해주는게 어떨까 싶네요!
관련 이슈
변경 사항
코드 리뷰 시 주의 사항
기타 사항