diff options
Diffstat (limited to 'src/frontend/components/Recommendations')
3 files changed, 69 insertions, 0 deletions
diff --git a/src/frontend/components/Recommendations/Recommendations.styled.ts b/src/frontend/components/Recommendations/Recommendations.styled.ts new file mode 100644 index 0000000..1667be4 --- /dev/null +++ b/src/frontend/components/Recommendations/Recommendations.styled.ts @@ -0,0 +1,39 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +import styled from 'styled-components'; + +export const Recommendations = styled.section` + display: flex; + margin: 40px 0; + align-items: center; + flex-direction: column; +`; + +export const ProductList = styled.div` + display: flex; + width: 100%; + padding: 0 20px; + flex-direction: column; + gap: 24px; + + ${({ theme }) => theme.breakpoints.desktop} { + display: grid; + grid-template-columns: 1fr 1fr 1fr 1fr; + } +`; + +export const TitleContainer = styled.div` + border-top: 1px dashed; + padding: 40px 0; + text-align: center; + width: 100%; +`; + +export const Title = styled.h3` + font-size: ${({ theme }) => theme.sizes.mLarge}; + + ${({ theme }) => theme.breakpoints.desktop} { + font-size: ${({ theme }) => theme.sizes.dLarge}; + } +`; diff --git a/src/frontend/components/Recommendations/Recommendations.tsx b/src/frontend/components/Recommendations/Recommendations.tsx new file mode 100644 index 0000000..3a5d64f --- /dev/null +++ b/src/frontend/components/Recommendations/Recommendations.tsx @@ -0,0 +1,26 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +import { CypressFields } from '../../utils/enums/CypressFields'; +import { useAd } from '../../providers/Ad.provider'; +import ProductCard from '../ProductCard'; +import * as S from './Recommendations.styled'; + +const Recommendations = () => { + const { recommendedProductList } = useAd(); + + return ( + <S.Recommendations data-cy={CypressFields.RecommendationList}> + <S.TitleContainer> + <S.Title>You May Also Like</S.Title> + </S.TitleContainer> + <S.ProductList> + {recommendedProductList.map(product => ( + <ProductCard key={product.id} product={product} /> + ))} + </S.ProductList> + </S.Recommendations> + ); +}; + +export default Recommendations; diff --git a/src/frontend/components/Recommendations/index.ts b/src/frontend/components/Recommendations/index.ts new file mode 100644 index 0000000..625afa5 --- /dev/null +++ b/src/frontend/components/Recommendations/index.ts @@ -0,0 +1,4 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +export { default } from './Recommendations'; |
