From b698e5b90e462301f643f313a34e93d85ec3c395 Mon Sep 17 00:00:00 2001 From: dariakoko Date: Fri, 25 Oct 2024 12:37:29 +0200 Subject: [PATCH] chore: address review comments --- .../ArtworkRail/ArtworkSaleMessageComponent.tsx | 5 +++-- src/app/utils/getSaleMessgeOrBidInfo.ts | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/app/Components/ArtworkRail/ArtworkSaleMessageComponent.tsx b/src/app/Components/ArtworkRail/ArtworkSaleMessageComponent.tsx index f2ca4925932..84b0bb02729 100644 --- a/src/app/Components/ArtworkRail/ArtworkSaleMessageComponent.tsx +++ b/src/app/Components/ArtworkRail/ArtworkSaleMessageComponent.tsx @@ -2,6 +2,7 @@ import { Flex, Text, TextProps } from "@artsy/palette-mobile" import { ArtworkSaleMessageComponent_artwork$key } from "__generated__/ArtworkSaleMessageComponent_artwork.graphql" import { useMetaDataTextColor } from "app/Components/ArtworkRail/ArtworkRailUtils" import { formattedTimeLeft } from "app/Scenes/Activity/utils/formattedTimeLeft" +import { displayAsLinethrought, parsedSaleMessage } from "app/utils/getSaleMessgeOrBidInfo" import { getTimer } from "app/utils/getTimer" import { useFeatureFlag } from "app/utils/hooks/useFeatureFlag" import { graphql, useFragment } from "react-relay" @@ -41,7 +42,7 @@ export const ArtworkSaleMessageComponent: React.FC {parts.map((part, index) => { - if (part.startsWith("~") && part.endsWith("~")) { + if (displayAsLinethrought(part)) { return ( { + // Split the sale message into parts to apply different styles to each part + const parts = saleMessage && saleMessage.split(/(~.*?~)/) + + return { parts } +} + +export const displayAsLinethrought = (part: string) => { + return part.startsWith("~") && part.endsWith("~") +}