From 82e03978b89938219958032efb1448cc76baa181 Mon Sep 17 00:00:00 2001 From: Saumit Date: Sat, 27 Sep 2025 02:14:26 +0530 Subject: Initial snapshot - OpenTelemetry demo 2.1.3 -f --- .../components/CheckoutItem/CheckoutItem.styled.ts | 90 ++++++++++++++++++++++ .../components/CheckoutItem/CheckoutItem.tsx | 61 +++++++++++++++ src/frontend/components/CheckoutItem/index.ts | 4 + 3 files changed, 155 insertions(+) create mode 100644 src/frontend/components/CheckoutItem/CheckoutItem.styled.ts create mode 100644 src/frontend/components/CheckoutItem/CheckoutItem.tsx create mode 100644 src/frontend/components/CheckoutItem/index.ts (limited to 'src/frontend/components/CheckoutItem') diff --git a/src/frontend/components/CheckoutItem/CheckoutItem.styled.ts b/src/frontend/components/CheckoutItem/CheckoutItem.styled.ts new file mode 100644 index 0000000..013250e --- /dev/null +++ b/src/frontend/components/CheckoutItem/CheckoutItem.styled.ts @@ -0,0 +1,90 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +import Image from 'next/image'; +import styled from 'styled-components'; + +export const CheckoutItem = styled.div` + display: grid; + grid-template-columns: 1fr; + padding: 25px; + border-radius: 5px; + border: 1px solid ${({ theme }) => theme.colors.lightBorderGray}; + + ${({ theme }) => theme.breakpoints.desktop} { + grid-template-columns: 40% 40% 1fr; + } +`; + +export const ItemDetails = styled.div` + display: flex; + gap: 25px; + padding-bottom: 25px; + border-bottom: 1px solid ${({ theme }) => theme.colors.lightBorderGray}; + + ${({ theme }) => theme.breakpoints.desktop} { + padding-bottom: 0; + padding-right: 25px; + border-bottom: none; + border-right: 1px solid ${({ theme }) => theme.colors.lightBorderGray}; + } +`; + +export const Details = styled.div` + display: flex; + flex-direction: column; + gap: 5px; + + span, + p { + margin: 0; + font-weight: ${({ theme }) => theme.fonts.regular}; + } +`; + +export const ItemName = styled.h5` + margin: 0; + font-size: ${({ theme }) => theme.sizes.mLarge}; +`; + +export const ShippingData = styled.div` + display: flex; + flex-direction: column; + gap: 5px; + padding: 25px 0; + border-bottom: 1px solid ${({ theme }) => theme.colors.lightBorderGray}; + + p { + margin: 0; + font-weight: ${({ theme }) => theme.fonts.light}; + } + + ${({ theme }) => theme.breakpoints.desktop} { + padding: 0 25px; + border-bottom: none; + border-right: 1px solid ${({ theme }) => theme.colors.lightBorderGray}; + } +`; + +export const Status = styled.div` + display: flex; + align-items: center; + justify-content: center; + padding-top: 25px; + gap: 10px; + + ${({ theme }) => theme.breakpoints.desktop} { + padding-top: 0; + } +`; + +export const ItemImage = styled(Image).attrs({ + width: '80', + height: '80', +})` + border-radius: 5px; +`; + +export const SeeMore = styled.a` + color: ${({ theme }) => theme.colors.otelBlue}; +`; diff --git a/src/frontend/components/CheckoutItem/CheckoutItem.tsx b/src/frontend/components/CheckoutItem/CheckoutItem.tsx new file mode 100644 index 0000000..8fd0ecf --- /dev/null +++ b/src/frontend/components/CheckoutItem/CheckoutItem.tsx @@ -0,0 +1,61 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +import Image from 'next/image'; +import { useState } from 'react'; +import { CypressFields } from '../../utils/enums/CypressFields'; +import { Address } from '../../protos/demo'; +import { IProductCheckoutItem } from '../../types/Cart'; +import ProductPrice from '../ProductPrice'; +import * as S from './CheckoutItem.styled'; + +interface IProps { + checkoutItem: IProductCheckoutItem; + address: Address; +} + +const CheckoutItem = ({ + checkoutItem: { + item: { + quantity, + product: { picture, name }, + }, + cost = { currencyCode: 'USD', units: 0, nanos: 0 }, + }, + address: { streetAddress = '', city = '', state = '', zipCode = '', country = '' }, +}: IProps) => { + const [isCollapsed, setIsCollapsed] = useState(false); + + return ( + + + + + {name} +

Quantity: {quantity}

+

+ Total: +

+
+
+ + Shipping Data +

Street: {streetAddress}

+ {!isCollapsed && setIsCollapsed(true)}>See More} + {isCollapsed && ( + <> +

City: {city}

+

State: {state}

+

Zip Code: {zipCode}

+

Country: {country}

+ + )} +
+ + check Done + +
+ ); +}; + +export default CheckoutItem; diff --git a/src/frontend/components/CheckoutItem/index.ts b/src/frontend/components/CheckoutItem/index.ts new file mode 100644 index 0000000..f4c6b78 --- /dev/null +++ b/src/frontend/components/CheckoutItem/index.ts @@ -0,0 +1,4 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +export { default } from './CheckoutItem'; -- cgit v1.2.3