, priceString].join('');\n case Currency.VND:\n return [priceString, 'VND'].join(' ');\n case Currency.YEN:\n return ['¥', priceString].join('');\n case Currency.SUSD:\n return ['S
, priceString].join('');\n }\n};\n\nexport const getDiscountMessage = (\n country: Country,\n currency: Currency,\n discountedPrice: number\n) =\u003E {\n const formattedPrice = formatPriceByCurrency(discountedPrice, currency);\n\n switch (country) {\n case Country.VIETNAM:\n return `The price has been discounted by ${formattedPrice} because you come from Vietnam.`;\n case Country.JAPAN:\n return `We have discounted the price by ${formattedPrice} thanks to the support from Japan's government.`;\n default:\n return `It's lucky that you come from ${country}, because we're running a program that discounts the price by ${discountedPrice}.`;\n }\n};\n","id":"mod_A9gtUS7b2qyHopfhFG9Amz","is_binary":false,"title":"price.ts","sha":null,"inserted_at":"2022-11-17T07:21:15","updated_at":"2024-06-01T01:19:29","upload_id":null,"shortid":"q6Om3","source_id":"src_AFxdZarXnzYnJDjTZWnoNS","directory_shortid":"gL4P9"},{"code":"import React from 'react';\r\n\r\nimport { getDiscountMessage, formatPriceByCurrency } from '..\u002Fservices\u002Fprice';\r\nimport { Country, Currency } from '..\u002Ftypes';\r\n\r\nimport styles from '.\u002FPricingCardBody.module.css';\r\n\r\ninterface PricingCardBodyProps {\r\n price: number;\r\n currency: Currency;\r\n country?: Country;\r\n}\r\n\r\nconst PricingCardBody: React.FC\u003CPricingCardBodyProps\u003E = ({\r\n price,\r\n currency,\r\n country\r\n}) =\u003E {\r\n const discountedRatio =\r\n country === Country.VIETNAM ? 0.4 : country === Country.JAPAN ? 0.2 : 0;\r\n const isDiscounted = discountedRatio \u003E 0;\r\n const finalPrice = price * (1 - discountedRatio);\r\n const discountedPrice = price - finalPrice;\r\n\r\n return (\r\n \u003Cdiv className={styles.body}\u003E\r\n \u003Ch1\u003E{formatPriceByCurrency(finalPrice, currency)}\u003C\u002Fh1\u003E\r\n {isDiscounted && country && (\r\n \u003Cdiv className={styles.discount}\u003E\r\n {getDiscountMessage(country, currency, discountedPrice)}\r\n \u003C\u002Fdiv\u003E\r\n )}\r\n \u003Cp\u003ELearn the essential skills for modern fullstack app development.\u003C\u002Fp\u003E\r\n \u003Cbutton className={styles.buyButton}\u003EGet started\u003C\u002Fbutton\u003E\r\n \u003C\u002Fdiv\u003E\r\n );\r\n};\r\n\r\nexport default PricingCardBody;\r\n","id":"mod_Hm8CSvCzPhAcShywLrvGgm","is_binary":false,"title":"PricingCardBody.tsx","sha":null,"inserted_at":"2022-11-10T14:29:00","updated_at":"2024-06-01T01:20:09","upload_id":null,"shortid":"71EAr","source_id":"src_AFxdZarXnzYnJDjTZWnoNS","directory_shortid":"lVp41"}],"forked_template":{"id":"sbtempl_ML2Hjiin6f2GyPJ1P2Unqg","title":"React (TS)","v2":false,"color":"#61DAFB","url":null,"published":false,"sdk":false,"icon_url":null,"official":false},"base_git":null,"is_sse":false,"updated_at":"2024-06-01T01:22:29","author":{"id":"user_J1XFm8RZdDzAqAqFqYVeHV","name":"Will T.","username":"will-t","avatar_url":"https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F24670327?v=4","personal_workspace_id":"ws_GwPVvNefLp5PyM3yd6NgM8","subscription_plan":null,"subscription_since":null},"settings":{"ai_consent":null},"user_liked":false,"restricted":false,"room_id":null,"version":174,"forked_from_sandbox":{"alias":"react-typescript-xlpsg","id":"xlpsg","title":"React Typescript","template":"create-react-app","inserted_at":"2021-04-14T09:12:52","updated_at":"2021-04-14T09:12:52","git":null,"privacy":0,"sdk":false,"custom_template":null},"id":"h59r02","pr_number":null,"fork_count":19,"original_git":null,"external_resources":[],"draft":false,"like_count":0,"view_count":320219,"screenshot_url":"https:\u002F\u002Fscreenshots.codesandbox.io\u002Fh59r02\u002F174.png","git":null};