Skip to content

Commit

Permalink
포매팅추가
Browse files Browse the repository at this point in the history
  • Loading branch information
gongdongho12 committed Jul 18, 2020
1 parent 8d2a1e2 commit e9a752d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/components/ItemCard/ItemCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React, { FunctionComponent, CSSProperties } from "react";
import { Card } from "antd";
import FlexCenter from "components/FlexCenter";
import styled from "styled-components";
import { propsToStyle } from "utils";
import { propsToStyle, formatNumber } from "utils";

const { Meta } = Card;

Expand Down Expand Up @@ -87,15 +87,15 @@ const ItemCard: FunctionComponent<IItemCardProps> = ({
<FlexCenter style={{ flex: "1", flexFlow: "column" }}>
<span>희망금액</span>
<span style={{ fontSize: "14px", fontWeight: "bold" }}>
{data?.hopeMoney}
{formatNumber(data?.hopeMoney)}
</span>
</FlexCenter>
) : (
<>
<FlexCenter style={{ flex: "1", flexFlow: "column" }}>
<span>최소 주문금액</span>
<span style={{ fontSize: "14px", fontWeight: "bold" }}>
<span>{`${data?.minMoney}`}</span>
<span>{`${formatNumber(data?.minMoney)}`}</span>
</span>
</FlexCenter>
<div
Expand Down
2 changes: 2 additions & 0 deletions src/utils/formatNumber.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
const formatNumber: any = (num: number) => (num).toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, "$1,")
export default formatNumber
3 changes: 2 additions & 1 deletion src/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export { default as assignRouteProps } from './assignRouteProps'
export { default as range } from './range'
export { default as propsToStyle } from './propsToStyle'
export { default as propsToStyle } from './propsToStyle'
export { default as formatNumber } from './formatNumber'

0 comments on commit e9a752d

Please sign in to comment.