feature/IO-3479-Customer-Phone-Numbers - Implementation

This commit is contained in:
Dave
2025-12-30 19:14:57 -05:00
parent 79a3b58a86
commit 63ce7b5c79
31 changed files with 247 additions and 77 deletions

View File

@@ -1,7 +1,23 @@
//import NumberFormat from "react-number-format";
import { Typography } from "antd";
import parsePhoneNumber from "libphonenumber-js";
export default function PhoneNumberFormatter(props) {
const p = parsePhoneNumber(props.children || "", "CA");
return p ? <span>{p.formatNational()}</span> : null;
const { Text } = Typography;
export default function PhoneNumberFormatter({ children, type }) {
const p = parsePhoneNumber(children || "", "CA");
if (!p) return null;
const phone = p.formatNational();
return (
<span>
<Text>{phone}</Text>
{type ? (
<>
{" "}
<Text type="secondary">({type})</Text>
</>
) : null}
</span>
);
}