Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor: remove radio option row
  • Loading branch information
rquartararo committed Mar 6, 2026
commit cd6eeef41deae58b8aa6aa644c3cb7308bd26a74
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
Text,
Tooltip,
} from "@artsy/palette"
import { RadioOptionRow } from "Apps/Order2/Routes/Checkout/Components/RadioOptionRow"
import { validateAndExtractOrderResponse } from "Apps/Order/Components/ExpressCheckout/Util/mutationHandling"
import { SectionHeading } from "Apps/Order2/Components/SectionHeading"
import { CheckoutStepName } from "Apps/Order2/Routes/Checkout/CheckoutContext/types"
Expand Down Expand Up @@ -277,44 +276,43 @@ const MultipleShippingOptionsForm = ({
checkoutTracking.clickedSelectShippingOption(option.type)
}}
>
Comment on lines +270 to +278
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 when i was doing the radio change i wondered about some components using this and some not. Are radios always supposed to be wrapped instead of just using onClicks in the radios themselves?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we should always be wrapping multiple radios in RadioGroup.

{options.map((option, i) => {
{options.map(option => {
const label = deliveryOptionLabel(option.type)
const timeEstimate = deliveryOptionTimeEstimate(option.type)
const [prefix, timeRange] = timeEstimate || []
const isSelected = selectedOption === option

return (
<RadioOptionRow key={`${option.type}:${i}`} value={option}>
<Radio
flex={1}
label={
<>
<Flex justifyContent="space-between" width="100%">
<Text variant="sm-display">{label}</Text>
<Text variant="sm">{option.amount?.display}</Text>
</Flex>
</>
}
value={option}
>
<Flex width="100%">
<Flex flexDirection="column">
{timeEstimate && (
<Text variant="sm" color="mono60">
{prefix} <strong>{timeRange}</strong>
</Text>
)}
<Radio
key={option.type}
flex={1}
backgroundColor={isSelected ? "mono5" : "mono0"}
p={1}
label={
<Flex justifyContent="space-between" width="100%">
<Text variant="sm-display">{label}</Text>
<Text variant="sm">{option.amount?.display}</Text>
</Flex>
}
value={option}
>
<Flex width="100%">
<Flex flexDirection="column">
{timeEstimate && (
<Text variant="sm" color="mono60">
{prefix} <strong>{timeRange}</strong>
</Text>
)}

{option.type === "ARTSY_WHITE_GLOVE" && isSelected && (
<Text variant="sm" color="mono60">
This service includes custom packing, transportation on a
fine art shuttle, and in-home delivery.
</Text>
)}
</Flex>
{option.type === "ARTSY_WHITE_GLOVE" && isSelected && (
<Text variant="sm" color="mono60">
This service includes custom packing, transportation on a
fine art shuttle, and in-home delivery.
</Text>
)}
</Flex>
</Radio>
</RadioOptionRow>
</Flex>
</Radio>
)
})}
</RadioGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
Clickable,
Flex,
Radio,
RadioGroup,
Spacer,
Text,
usePrevious,
Expand All @@ -22,7 +21,6 @@ import {
type ProcessedUserAddress,
validateAddressFields,
} from "Apps/Order2/Routes/Checkout/Components/FulfillmentDetailsStep/utils"
import { RadioOptionRow } from "Apps/Order2/Routes/Checkout/Components/RadioOptionRow"
import { useCheckoutContext } from "Apps/Order2/Routes/Checkout/Hooks/useCheckoutContext"
import { useScrollToStep } from "Apps/Order2/Routes/Checkout/Hooks/useScrollToStep"
import type { FormikContextWithAddress } from "Components/Address/AddressFormFields"
Expand Down Expand Up @@ -226,20 +224,26 @@ export const SavedAddressOptions = ({

<Spacer y={2} />

<RadioGroup
defaultValue={initialSelectedAddress}
onSelect={address => handleAddressClick(address)}
>
<Flex flexDirection="column">
{savedAddresses.map(processedAddress => {
const { address, internalID, phoneNumberParsed } = processedAddress
const isSelected = selectedAddress?.internalID === internalID
const textColor = isSelected ? "mono100" : "mono60"

return (
<RadioOptionRow key={internalID} value={processedAddress}>
<Flex
key={internalID}
alignItems="flex-start"
backgroundColor={isSelected ? "mono5" : "mono0"}
p={1}
>
<Radio
flex={1}
value={processedAddress}
selected={isSelected}
onSelect={({ value }) =>
handleAddressClick(value as ProcessedUserAddress)
}
label={
<AddressDisplay
address={address}
Expand All @@ -248,13 +252,11 @@ export const SavedAddressOptions = ({
/>
}
/>

<Clickable
alignSelf="flex-start"
type="button"
aria-label={`Edit address for ${address.name}`}
onClick={e => {
e.stopPropagation()
onClick={() => {
setUserAddressMode({
mode: "edit",
address: processedAddress,
Expand All @@ -270,10 +272,10 @@ export const SavedAddressOptions = ({
Edit
</Text>
</Clickable>
</RadioOptionRow>
</Flex>
)
})}
</RadioGroup>
</Flex>

<Spacer y={2} />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { Flex, Radio, RadioGroup, Spacer, Text } from "@artsy/palette"
import { appendCurrencySymbol } from "Apps/Order/Utils/currencyUtils"
import { OfferInput } from "Apps/Order2/Routes/Checkout/Components/OfferStep/Components/OfferInput"
import type { OfferFormProps } from "Apps/Order2/Routes/Checkout/Components/OfferStep/types"
import { RadioOptionRow } from "Apps/Order2/Routes/Checkout/Components/RadioOptionRow"
import { useCountdownTimer } from "Utils/Hooks/useCountdownTimer"
import createLogger from "Utils/logger"
import type { Order2OfferOptions_order$key } from "__generated__/Order2OfferOptions_order.graphql"
Expand Down Expand Up @@ -178,60 +177,63 @@ export const Order2OfferOptions: React.FC<Order2OfferOptionsProps> = ({
setSelectedRadio(value as PriceOptionKey)
}

const radioOptions = [
...priceOptions.map(({ value: optionValue, description, key }) => {
const isGalleryOffer =
isLimitedPartnerOffer && key === PriceOptionKey.MAX
const showTimer = isGalleryOffer && timer.hasValidRemainingTime
return (
<RadioOptionRow key={key} value={key}>
<Radio
flex={1}
value={key}
label={
isGalleryOffer ? (
<Text variant="sm-display" color="blue100">
{formatCurrency(optionValue)}
</Text>
) : (
formatCurrency(optionValue)
)
}
>
<Spacer y={0.5} />
<Text
variant="sm-display"
color={isGalleryOffer ? "blue100" : "mono60"}
>
{description}
{showTimer && ` (Exp. ${timer.remainingTime})`}
</Text>
</Radio>
</RadioOptionRow>
)
}),
<RadioOptionRow key={PriceOptionKey.CUSTOM} value={PriceOptionKey.CUSTOM}>
<Radio
flex={1}
value={PriceOptionKey.CUSTOM}
label="Other amount"
>
{selectedRadio === PriceOptionKey.CUSTOM && (
<Flex flexDirection="column" mt={2}>
<OfferInput
name="offerValue"
order={orderData}
onBlur={onCustomOfferBlur}
/>
</Flex>
)}
</Radio>
</RadioOptionRow>,
]

return (
<RadioGroup defaultValue={selectedRadio} onSelect={handleRadioSelect}>
{radioOptions}
{[
...priceOptions.map(({ value: optionValue, description, key }) => {
const isGalleryOffer =
isLimitedPartnerOffer && key === PriceOptionKey.MAX
const showTimer = isGalleryOffer && timer.hasValidRemainingTime
const isSelected = selectedRadio === key

return (
<Radio
key={key}
flex={1}
backgroundColor={isSelected ? "mono5" : "mono0"}
p={1}
value={key}
label={
isGalleryOffer ? (
<Text variant="sm-display" color="blue100">
{formatCurrency(optionValue)}
</Text>
) : (
formatCurrency(optionValue)
)
}
>
<Spacer y={0.5} />
<Text
variant="sm-display"
color={isGalleryOffer ? "blue100" : "mono60"}
>
{description}
{showTimer && ` (Exp. ${timer.remainingTime})`}
</Text>
</Radio>
)
}),

<Radio
key="price-option-custom"
flex={1}
backgroundColor={selectedRadio === PriceOptionKey.CUSTOM ? "mono5" : "mono0"}
p={1}
value={PriceOptionKey.CUSTOM}
label="Other amount"
>
{selectedRadio === PriceOptionKey.CUSTOM && (
<Flex flexDirection="column" mt={2}>
<OfferInput
name="offerValue"
order={orderData}
onBlur={onCustomOfferBlur}
/>
</Flex>
)}
</Radio>,
]}
</RadioGroup>
)
}
Expand Down
39 changes: 0 additions & 39 deletions src/Apps/Order2/Routes/Checkout/Components/RadioOptionRow.tsx

This file was deleted.