Skip to content

Commit e36a544

Browse files
Berardo Matèmalessani
authored andcommitted
feat: order recap on thank you page
1 parent 3a1312d commit e36a544

1 file changed

Lines changed: 98 additions & 58 deletions

File tree

components/composite/StepComplete/index.tsx

Lines changed: 98 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,13 @@ import { PaymentContainer } from "components/composite/StepPayment/PaymentContai
1414
import { AppContext } from "components/data/AppProvider"
1515
import { Base } from "components/ui/Base"
1616
import { Button } from "components/ui/Button"
17-
import { CustomAddress } from "components/ui/CustomerAddressCard"
17+
import {
18+
CustomAddress,
19+
CustomerAddressCard,
20+
} from "components/ui/CustomerAddressCard"
21+
import { FlexContainer } from "components/ui/FlexContainer"
1822
import { Footer } from "components/ui/Footer"
23+
import { GridContainer } from "components/ui/GridContainer"
1924
import { Logo } from "components/ui/Logo"
2025

2126
import { CheckIcon } from "./CheckIcon"
@@ -92,62 +97,82 @@ export const StepComplete: React.FC<Props> = ({
9297
<Wrapper>
9398
<Recap>
9499
<RecapSummary>
95-
<RecapSummary>Summary</RecapSummary>
100+
<RecapTitle>Summary</RecapTitle>
96101
<OrderSummary appCtx={ctx} readonly />
97102
</RecapSummary>
98103
<RecapCustomer>
99-
Customer
100-
<div>{ctx.emailAddress}</div>
101-
<div className="flex flex-row">
102-
<CustomAddress
103-
firstName={ctx.billingAddress?.name}
104-
lastName={ctx.billingAddress?.last_name}
105-
city={ctx.billingAddress?.city}
106-
line1={ctx.billingAddress?.line_1}
107-
line2={ctx.billingAddress?.line_2}
108-
zipCode={ctx.billingAddress?.zip_code}
109-
stateCode={ctx.billingAddress?.state_code}
110-
countryCode={ctx.billingAddress?.country_code}
111-
phone={ctx.billingAddress?.phone}
112-
addressType="billing"
113-
/>
114-
<CustomAddress
115-
firstName={ctx.shippingAddress?.name}
116-
lastName={ctx.shippingAddress?.last_name}
117-
city={ctx.shippingAddress?.city}
118-
line1={ctx.shippingAddress?.line_1}
119-
line2={ctx.shippingAddress?.line_2}
120-
zipCode={ctx.shippingAddress?.zip_code}
121-
stateCode={ctx.shippingAddress?.state_code}
122-
countryCode={ctx.shippingAddress?.country_code}
123-
phone={ctx.shippingAddress?.phone}
124-
addressType="shipping"
125-
/>
126-
</div>
127-
<div className="flex">
128-
<PaymentContainer>
129-
<PaymentSource readonly>
130-
<PaymentSourceBrandIcon className="mr-2" />
131-
<PaymentSourceBrandName className="mr-1">
132-
{({ brand }) => {
133-
console.log("dsa")
134-
if (ctx.isCreditCard) {
135-
return (
136-
<Trans t={t} i18nKey="stepPayment.endingIn">
137-
{brand}
138-
<PaymentSourceDetail
139-
className="ml-1"
140-
type="last4"
141-
/>
142-
</Trans>
143-
)
144-
}
145-
return brand
146-
}}
147-
</PaymentSourceBrandName>
148-
</PaymentSource>
149-
</PaymentContainer>
150-
</div>
104+
<RecapTitle>Customer</RecapTitle>
105+
<RecapCol>
106+
<RecapItemTitle>E-mail:</RecapItemTitle>
107+
<RecapItem>{ctx.emailAddress}</RecapItem>
108+
</RecapCol>
109+
<RecapCol>
110+
<GridContainer className="lg:!grid-cols-1 xl:!grid-cols-2">
111+
<div>
112+
<RecapItemTitle>Billed to:</RecapItemTitle>
113+
<RecapBox>
114+
<CustomAddress
115+
firstName={ctx.billingAddress?.first_name}
116+
lastName={ctx.billingAddress?.last_name}
117+
city={ctx.billingAddress?.city}
118+
line1={ctx.billingAddress?.line_1}
119+
line2={ctx.billingAddress?.line_2}
120+
zipCode={ctx.billingAddress?.zip_code}
121+
stateCode={ctx.billingAddress?.state_code}
122+
countryCode={ctx.billingAddress?.country_code}
123+
phone={ctx.billingAddress?.phone}
124+
addressType="billing"
125+
/>
126+
</RecapBox>
127+
</div>
128+
<div>
129+
<RecapItemTitle>Shipped to:</RecapItemTitle>
130+
<RecapBox>
131+
<CustomAddress
132+
firstName={ctx.shippingAddress?.first_name}
133+
lastName={ctx.shippingAddress?.last_name}
134+
city={ctx.shippingAddress?.city}
135+
line1={ctx.shippingAddress?.line_1}
136+
line2={ctx.shippingAddress?.line_2}
137+
zipCode={ctx.shippingAddress?.zip_code}
138+
stateCode={ctx.shippingAddress?.state_code}
139+
countryCode={ctx.shippingAddress?.country_code}
140+
phone={ctx.shippingAddress?.phone}
141+
addressType="shipping"
142+
/>
143+
</RecapBox>
144+
</div>
145+
</GridContainer>
146+
</RecapCol>
147+
<RecapCol>
148+
<RecapItemTitle>Payment:</RecapItemTitle>
149+
<RecapBox>
150+
<FlexContainer className="font-bold text-md">
151+
<PaymentContainer>
152+
<PaymentSource readonly>
153+
<PaymentSourceBrandIcon className="mr-2" />
154+
<PaymentSourceBrandName className="mr-1">
155+
{({ brand }) => {
156+
console.log("dsa")
157+
if (ctx.isCreditCard) {
158+
return (
159+
<Trans t={t} i18nKey="stepPayment.endingIn">
160+
{brand}
161+
<PaymentSourceDetail
162+
className="ml-1 font-normal"
163+
type="last4"
164+
/>
165+
</Trans>
166+
)
167+
}
168+
return brand
169+
}}
170+
</PaymentSourceBrandName>
171+
</PaymentSource>
172+
</PaymentContainer>
173+
</FlexContainer>
174+
</RecapBox>
175+
</RecapCol>
151176
</RecapCustomer>
152177
</Recap>
153178
<Footer />
@@ -165,7 +190,7 @@ const Bottom = styled.div`
165190
`
166191

167192
const Main = styled.div`
168-
${tw`flex flex-col flex-1 justify-center items-center text-center pb-8`}
193+
${tw`flex flex-col justify-center items-center text-center`}
169194
`
170195
const Wrapper = styled.div`
171196
${tw`flex flex-col p-5 md:p-10 lg:px-20 2xl:(max-w-screen-2xl mx-auto)`}
@@ -186,11 +211,26 @@ const WrapperButton = styled.div`
186211
${tw`flex items-center justify-center`}
187212
`
188213
const Recap = styled.div`
189-
${tw`md:(grid auto-cols-fr grid-flow-col gap-4)`}
214+
${tw`grid md:(auto-cols-fr grid-flow-col gap-16) lg:gap-32`}
190215
`
191216
const RecapSummary = styled.div`
192-
${tw``}
217+
${tw`order-last border-t border-dashed border-t-2 pt-6 md:(order-first border-0 p-0)`}
193218
`
194219
const RecapCustomer = styled.div`
195-
${tw``}
220+
${tw`order-1 md:order-2 mb-5 md:mb-0`}
221+
`
222+
const RecapTitle = styled.h2`
223+
${tw`text-lg font-semibold leading-none mb-8 md:mb-16`}
224+
`
225+
const RecapCol = styled.div`
226+
${tw`mb-4 md:mb-8`}
227+
`
228+
const RecapItemTitle = styled.h3`
229+
${tw`font-normal text-sm mb-2`}
230+
`
231+
const RecapItem = styled.p`
232+
${tw`text-md font-bold`}
233+
`
234+
const RecapBox = styled.div`
235+
${tw`p-3 rounded border`}
196236
`

0 commit comments

Comments
 (0)