From 1357410bc411933f8e5ace035356238297046080 Mon Sep 17 00:00:00 2001 From: Uzhastin-Nikita Date: Thu, 2 Jun 2022 23:59:21 +0300 Subject: [PATCH] feat: relocate Benefit component from web --- .../molecules/Benefits/Benefit.utils.ts | 55 ++++++++ .../Benefit/Benefit.styles.module.scss | 124 ++++++++++++++++++ .../molecules/Benefits/Benefit/Benefit.tsx | 48 +++++++ .../molecules/Benefits/Benefit/index.ts | 1 + .../Benefits/Benefits.styles.module.scss | 36 +++++ .../molecules/Benefits/Benefits.tsx | 38 ++++++ src/components/molecules/Benefits/index.ts | 1 + 7 files changed, 303 insertions(+) create mode 100644 src/components/molecules/Benefits/Benefit.utils.ts create mode 100644 src/components/molecules/Benefits/Benefit/Benefit.styles.module.scss create mode 100644 src/components/molecules/Benefits/Benefit/Benefit.tsx create mode 100644 src/components/molecules/Benefits/Benefit/index.ts create mode 100644 src/components/molecules/Benefits/Benefits.styles.module.scss create mode 100644 src/components/molecules/Benefits/Benefits.tsx create mode 100644 src/components/molecules/Benefits/index.ts diff --git a/src/components/molecules/Benefits/Benefit.utils.ts b/src/components/molecules/Benefits/Benefit.utils.ts new file mode 100644 index 0000000..40b6ab5 --- /dev/null +++ b/src/components/molecules/Benefits/Benefit.utils.ts @@ -0,0 +1,55 @@ +export type Benefit = { + header: string + content: string + svgUrl: string +} + +export const BENEFITS: Benefit[][] = [ + [ + { + svgUrl: 'images/benefit/dollar.svg', + header: 'Доступность', + content: 'Мы внимательно подошли к формированию цены, чтобы Вы могли найти подходящее решение' + } + ], + [ + { + svgUrl: 'images/benefit/guality.svg', + header: 'Профессионализм', + content: 'Мы - программисты и геймеры, которые понимают что нужно для максимального комфорта и эргономики!' + } + ], + [ + { + svgUrl: 'images/benefit/tool.svg', + header: 'Конфигурируемость', + content: + 'Заменить видеокарту или добавить ОЗУ?' + + ' Без проблем, крышка поднимается так, что процесс установки комплектующих принесёт удовольствие!' + } + ], + [ + { + svgUrl: 'images/benefit/modules.svg', + header: 'Модульность', + content: + 'Ремонтопригодность - неотъемлая часть долгосрочной эксплуатации' + + ', если повредите стекло или опоры, то всегда сможете заказать их отдельно!' + } + ], + [ + { + svgUrl: 'images/benefit/vector.svg', + header: 'Гибкость', + content: 'Хотите использовать свою сборку или поместить элементы декора? Мы поможем!' + } + ], + [ + { + svgUrl: 'images/benefit/envelope.svg', + header: 'Ваши предложения', + // TODO: Добавить возможность перехода по ссылке + content: 'В разделе Контакты есть вся необходимая информация, чтобы связаться с нами!' + } + ] +] diff --git a/src/components/molecules/Benefits/Benefit/Benefit.styles.module.scss b/src/components/molecules/Benefits/Benefit/Benefit.styles.module.scss new file mode 100644 index 0000000..d956ce6 --- /dev/null +++ b/src/components/molecules/Benefits/Benefit/Benefit.styles.module.scss @@ -0,0 +1,124 @@ +@import 'src/scss/mixins'; + +.header, +.benefit, +.container { + @include flex-center; +} + +.benefit { + width: 380px; + border-radius: 26px; + background: $color-background-indigo; + margin-top: 40px; + + @include desktop { + padding: 35px 0; + position: relative; + + &:hover .emergence { + display: flex; + } + } + + @include devices { + display: flex; + flex-flow: column; + } + + @include tablet { + width: 380px; + height: 280px; + } +} + +.benefit, +.emergence { + cursor: pointer; +} + +.header { + @include desktop { + width: 380px; + flex-flow: column; + } + + @include tablet { + width: 90%; + justify-content: space-evenly; + flex-flow: row-reverse; + } +} + +.img { + width: 100px; + height: 100px; + margin: 30px; + + @include devices { + width: 80px; + height: 80px; + margin: 10px; + } +} + +.title { + color: $color-white; + font-family: $font-lato; + font-size: 30px; + font-weight: 700; + line-height: 36px; + + @include desktop { + font-size: 30px; + } + + @include tablet { + font-size: 20px; + } +} + +.container { + @include desktop { + width: 380px; + } + + @include tablet { + width: 355px; + } +} + +.content { + color: $color-light; + font-family: $font-lato; + font-size: 24px; + font-weight: 400; + line-height: 32px; + margin: 10px; + padding: 15px; + + @include tablet { + font-size: 16px; + margin: 0; + padding: 13px; + } +} + +.emergence { + @include desktop { + width: 100%; + border-radius: 26px; + align-items: center; + left: 0; + bottom: 0; + right: 0; + top: 0; + display: none; + position: absolute; + background: $color-background-indigo; + } + + @include devices { + display: flex; + } +} diff --git a/src/components/molecules/Benefits/Benefit/Benefit.tsx b/src/components/molecules/Benefits/Benefit/Benefit.tsx new file mode 100644 index 0000000..c10e7cd --- /dev/null +++ b/src/components/molecules/Benefits/Benefit/Benefit.tsx @@ -0,0 +1,48 @@ +import React from 'react' + +import cx from 'classnames' + +import { Image } from 'src/components/atoms/Image' + +import css from './Benefit.styles.module.scss' + +export type BenefitProps = { + className?: string + headerClassName?: string + imgClassName?: string + titleClassName?: string + emergenceClassName?: string + containerClassName?: string + contentClassName?: string + header: string + content: string + svgUrl: string +} + +export const Benefit = ({ + header, + content, + svgUrl, + className, + headerClassName, + imgClassName, + titleClassName, + emergenceClassName, + containerClassName, + contentClassName +}: BenefitProps) => { + return ( +
+
+ + {header} +
+ +
+
+ {content} +
+
+
+ ) +} diff --git a/src/components/molecules/Benefits/Benefit/index.ts b/src/components/molecules/Benefits/Benefit/index.ts new file mode 100644 index 0000000..3ac440a --- /dev/null +++ b/src/components/molecules/Benefits/Benefit/index.ts @@ -0,0 +1 @@ +export * from './Benefit' diff --git a/src/components/molecules/Benefits/Benefits.styles.module.scss b/src/components/molecules/Benefits/Benefits.styles.module.scss new file mode 100644 index 0000000..95288f4 --- /dev/null +++ b/src/components/molecules/Benefits/Benefits.styles.module.scss @@ -0,0 +1,36 @@ +@import 'src/scss/mixins'; + +.benefits { + @include flex-center; + + flex-flow: wrap; + width: 100%; + margin-top: 100px; + margin-bottom: 50px; + + @include mobile { + display: none; + } +} + +.container { + display: grid; + grid-template-columns: 380px 380px 380px; + grid-template-rows: 280px 280px; + grid-gap: 40px; + margin-top: 50px; + + @include tablet { + grid-template-columns: 380px 380px; + grid-template-rows: 280px 280px; + grid-template-rows: 17em 17em; + grid-gap: 40px; + } +} + +.title { + width: 100%; + display: block; + text-align: left; + margin: 70px 0 30px; +} diff --git a/src/components/molecules/Benefits/Benefits.tsx b/src/components/molecules/Benefits/Benefits.tsx new file mode 100644 index 0000000..415027e --- /dev/null +++ b/src/components/molecules/Benefits/Benefits.tsx @@ -0,0 +1,38 @@ +import React from 'react' + +import cx from 'classnames' + +import { TitleBlock } from 'src/components/atoms/TitleBlock' + +import { Benefit } from './Benefit' +import { BENEFITS } from './Benefit.utils' + +import css from './Benefits.styles.module.scss' + +export const Benefits = () => { + return ( +
+
+ +
+
+ {BENEFITS.map((row, rowIndex) => { + return ( +
+ {row.map((column, columnIndex) => { + return ( + + ) + })} +
+ ) + })} +
+
+ ) +} diff --git a/src/components/molecules/Benefits/index.ts b/src/components/molecules/Benefits/index.ts new file mode 100644 index 0000000..ec48fdf --- /dev/null +++ b/src/components/molecules/Benefits/index.ts @@ -0,0 +1 @@ +export * from './Benefits'