Skip to content

Commit 4be092a

Browse files
Uzhastin-Nikitathe-homeless-god
authored andcommitted
feat: relocate TextBlocks component from web
1 parent 1357410 commit 4be092a

18 files changed

+512
-0
lines changed
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
@import 'src/scss/mixins';
2+
3+
.checkbox-container {
4+
display: flex;
5+
width: 70%;
6+
justify-content: center;
7+
align-content: center;
8+
cursor: pointer;
9+
10+
@include mobile {
11+
width: 100%;
12+
}
13+
}
14+
15+
.information-block {
16+
display: block;
17+
width: 80%;
18+
margin-left: 30%;
19+
}
20+
21+
.checkbox {
22+
position: relative;
23+
z-index: -1;
24+
opacity: 0;
25+
26+
& + label {
27+
position: relative;
28+
cursor: pointer;
29+
30+
&::before {
31+
content: '';
32+
position: absolute;
33+
top: 34%;
34+
width: 49px;
35+
height: 23px;
36+
border-radius: 13px;
37+
background: $color-background-black;
38+
transition: 0.2s;
39+
border: 1px solid $color-white;
40+
41+
@include mobile {
42+
width: 29px;
43+
height: 13px;
44+
margin-top: 8px;
45+
}
46+
}
47+
48+
&::after {
49+
content: '';
50+
position: absolute;
51+
top: 34%;
52+
width: 23px;
53+
height: 23px;
54+
border-radius: 10px;
55+
background: $color-base;
56+
transition: 0.2s;
57+
58+
@include mobile {
59+
width: 13px;
60+
height: 13px;
61+
margin-top: 8px;
62+
}
63+
}
64+
}
65+
66+
&:checked + label {
67+
&::before {
68+
background: $color-base;
69+
}
70+
71+
&::after {
72+
left: 26px;
73+
border: 1px solid $color-white;
74+
background-color: $color-background-black;
75+
76+
@include mobile {
77+
left: 16px;
78+
}
79+
}
80+
}
81+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import React, { useState } from 'react'
2+
3+
import cx from 'classnames'
4+
5+
import { InformationBlock } from 'src/components/molecules/TextBlocks/InformationBlock'
6+
7+
import css from './Checkbox.styles.module.scss'
8+
9+
export type CheckboxProps = {
10+
className?: string
11+
subheaderClassName?: string
12+
citingClassName?: string
13+
subheader?: string
14+
citing?: string
15+
}
16+
17+
export const Checkbox = ({ className, citing, subheader, subheaderClassName, citingClassName }: CheckboxProps) => {
18+
const [checked, setChecked] = useState(false)
19+
20+
return (
21+
<div className={cx(css.checkboxContainer, className)}>
22+
<input
23+
className={css.checkbox}
24+
type="checkbox"
25+
id="box"
26+
checked={checked}
27+
onChange={() => setChecked(!checked)}
28+
/>
29+
<label htmlFor="box">
30+
<InformationBlock
31+
classNameBox={css.informationBlock}
32+
classNameSubheader={subheaderClassName}
33+
classNameCiting={citingClassName}
34+
href="https://vk.com/digitable_team"
35+
blocks={[
36+
{
37+
subheader,
38+
citing
39+
}
40+
]}
41+
/>
42+
</label>
43+
</div>
44+
)
45+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './Checkbox'
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
@import 'src/scss/mixins';
2+
3+
.information-block:not(:first-child) {
4+
margin-top: 45px;
5+
}
6+
7+
.header {
8+
font-size: 22px;
9+
font-weight: 700;
10+
font-family: $font-lato;
11+
12+
@include mobile {
13+
font-size: 18px;
14+
font-weight: 500;
15+
}
16+
}
17+
18+
.text {
19+
font-family: $font-inter;
20+
font-weight: 400;
21+
line-height: 30px;
22+
letter-spacing: 0;
23+
text-align: left;
24+
font-size: 22px;
25+
color: #c4c4c4;
26+
27+
@include mobile {
28+
font-size: 16px;
29+
font-weight: 400;
30+
line-height: 19px;
31+
}
32+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import React from 'react'
2+
3+
import { InformationBlockContent } from 'src/components/molecules/InformationSection/InformationSection.types'
4+
5+
import css from './InformationBlock.styles.module.scss'
6+
7+
export type InformationBlockProps = InformationBlockContent
8+
9+
export const InformationBlock = ({ header, texts }: InformationBlockProps) => {
10+
return (
11+
<div className={css.informationBlock}>
12+
<p className={css.header}>{header}</p>
13+
{texts.map((text, index) => (
14+
<p key={index} className={css.text}>
15+
{text}
16+
</p>
17+
))}
18+
</div>
19+
)
20+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './InformationBlock'
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
@import 'src/scss/mixins';
2+
3+
.information-section {
4+
display: flex;
5+
flex-flow: wrap;
6+
align-items: flex-start;
7+
8+
@include tablet {
9+
align-items: flex-start;
10+
}
11+
12+
@include mobile {
13+
width: 90%;
14+
}
15+
}
16+
17+
.images,
18+
.blocks {
19+
margin-top: 80px;
20+
}
21+
22+
.blocks {
23+
@include tablet {
24+
width: 90%;
25+
margin: 100px 20px;
26+
}
27+
28+
@include mobile {
29+
width: 100%;
30+
margin: 30px 0 0 23px;
31+
}
32+
}
33+
34+
.images {
35+
@include devices {
36+
display: none;
37+
}
38+
}
39+
40+
.image {
41+
@include desktop {
42+
width: 450px;
43+
height: 450px;
44+
}
45+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import React from 'react'
2+
3+
import cx from 'classnames'
4+
5+
import { Image } from 'src/components/atoms/Image'
6+
7+
import { InformationBlock } from './InformationBlock'
8+
import { getSections } from './InformationSection.utils'
9+
10+
import css from './InformationSection.styles.module.scss'
11+
12+
export const InformationSection = () => {
13+
const sections = getSections()
14+
return (
15+
<div className={css.informationSection}>
16+
<div className="row">
17+
<div className={cx(css.blocks, 'col-md-8')}>
18+
{sections.map((section, index) => {
19+
return <InformationBlock key={index} header={section.header} texts={section.texts} />
20+
})}
21+
</div>
22+
<div className={cx(css.images, 'col-md-4')}>
23+
<Image src="/images/common/boxes.png" className={css.image} />
24+
</div>
25+
</div>
26+
</div>
27+
)
28+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export type InformationBlockContent = {
2+
header?: string
3+
texts?: string[]
4+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import { InformationBlockContent } from './InformationSection.types'
2+
3+
const createSection = (header: string, texts: string[]): InformationBlockContent => {
4+
return {
5+
header,
6+
texts
7+
}
8+
}
9+
10+
export const getSections = (): InformationBlockContent[] => {
11+
return [
12+
createSection('У вас есть доставка?', [
13+
'Для Вас всегда доступны быстрые и надежные варианты доставки Вашего компьютера:',
14+
'— Самовывоз',
15+
'— Доставка до пункта выдачи',
16+
'— Доставка до двери'
17+
]),
18+
createSection('А в мой город доставите?', [
19+
'Доставка осуществляется по всей России транспортными компаниями СДЭК, Деловые линии, DPD и Яндекс.Доставка.',
20+
'При оформлении заказа наши менеджеры помогут Вам рассчитать стоимость и время доставки.'
21+
]),
22+
createSection('Как быстро?', [
23+
'Всё зависит от наличия:',
24+
'— Товар в наличии отправляем в течение дня после оформления заказа.',
25+
'— Товар под заказ изготавливается не более 60 рабочих дней.'
26+
]),
27+
createSection('Почему я должен вам верить?', ['По законам РФ покупатель получает кассовый чек и бланк предоплаты.'])
28+
]
29+
}

0 commit comments

Comments
 (0)