-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: relocate TextBlocks component from web
- Loading branch information
1 parent
1357410
commit 4be092a
Showing
18 changed files
with
512 additions
and
0 deletions.
There are no files selected for viewing
81 changes: 81 additions & 0 deletions
81
src/components/molecules/Checkbox/Checkbox.styles.module.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
@import 'src/scss/mixins'; | ||
|
||
.checkbox-container { | ||
display: flex; | ||
width: 70%; | ||
justify-content: center; | ||
align-content: center; | ||
cursor: pointer; | ||
|
||
@include mobile { | ||
width: 100%; | ||
} | ||
} | ||
|
||
.information-block { | ||
display: block; | ||
width: 80%; | ||
margin-left: 30%; | ||
} | ||
|
||
.checkbox { | ||
position: relative; | ||
z-index: -1; | ||
opacity: 0; | ||
|
||
& + label { | ||
position: relative; | ||
cursor: pointer; | ||
|
||
&::before { | ||
content: ''; | ||
position: absolute; | ||
top: 34%; | ||
width: 49px; | ||
height: 23px; | ||
border-radius: 13px; | ||
background: $color-background-black; | ||
transition: 0.2s; | ||
border: 1px solid $color-white; | ||
|
||
@include mobile { | ||
width: 29px; | ||
height: 13px; | ||
margin-top: 8px; | ||
} | ||
} | ||
|
||
&::after { | ||
content: ''; | ||
position: absolute; | ||
top: 34%; | ||
width: 23px; | ||
height: 23px; | ||
border-radius: 10px; | ||
background: $color-base; | ||
transition: 0.2s; | ||
|
||
@include mobile { | ||
width: 13px; | ||
height: 13px; | ||
margin-top: 8px; | ||
} | ||
} | ||
} | ||
|
||
&:checked + label { | ||
&::before { | ||
background: $color-base; | ||
} | ||
|
||
&::after { | ||
left: 26px; | ||
border: 1px solid $color-white; | ||
background-color: $color-background-black; | ||
|
||
@include mobile { | ||
left: 16px; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import React, { useState } from 'react' | ||
|
||
import cx from 'classnames' | ||
|
||
import { InformationBlock } from 'src/components/molecules/TextBlocks/InformationBlock' | ||
|
||
import css from './Checkbox.styles.module.scss' | ||
|
||
export type CheckboxProps = { | ||
className?: string | ||
subheaderClassName?: string | ||
citingClassName?: string | ||
subheader?: string | ||
citing?: string | ||
} | ||
|
||
export const Checkbox = ({ className, citing, subheader, subheaderClassName, citingClassName }: CheckboxProps) => { | ||
const [checked, setChecked] = useState(false) | ||
|
||
return ( | ||
<div className={cx(css.checkboxContainer, className)}> | ||
<input | ||
className={css.checkbox} | ||
type="checkbox" | ||
id="box" | ||
checked={checked} | ||
onChange={() => setChecked(!checked)} | ||
/> | ||
<label htmlFor="box"> | ||
<InformationBlock | ||
classNameBox={css.informationBlock} | ||
classNameSubheader={subheaderClassName} | ||
classNameCiting={citingClassName} | ||
href="https://vk.com/digitable_team" | ||
blocks={[ | ||
{ | ||
subheader, | ||
citing | ||
} | ||
]} | ||
/> | ||
</label> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './Checkbox' |
32 changes: 32 additions & 0 deletions
32
...ponents/molecules/InformationSection/InformationBlock/InformationBlock.styles.module.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
@import 'src/scss/mixins'; | ||
|
||
.information-block:not(:first-child) { | ||
margin-top: 45px; | ||
} | ||
|
||
.header { | ||
font-size: 22px; | ||
font-weight: 700; | ||
font-family: $font-lato; | ||
|
||
@include mobile { | ||
font-size: 18px; | ||
font-weight: 500; | ||
} | ||
} | ||
|
||
.text { | ||
font-family: $font-inter; | ||
font-weight: 400; | ||
line-height: 30px; | ||
letter-spacing: 0; | ||
text-align: left; | ||
font-size: 22px; | ||
color: #c4c4c4; | ||
|
||
@include mobile { | ||
font-size: 16px; | ||
font-weight: 400; | ||
line-height: 19px; | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
src/components/molecules/InformationSection/InformationBlock/InformationBlock.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import React from 'react' | ||
|
||
import { InformationBlockContent } from 'src/components/molecules/InformationSection/InformationSection.types' | ||
|
||
import css from './InformationBlock.styles.module.scss' | ||
|
||
export type InformationBlockProps = InformationBlockContent | ||
|
||
export const InformationBlock = ({ header, texts }: InformationBlockProps) => { | ||
return ( | ||
<div className={css.informationBlock}> | ||
<p className={css.header}>{header}</p> | ||
{texts.map((text, index) => ( | ||
<p key={index} className={css.text}> | ||
{text} | ||
</p> | ||
))} | ||
</div> | ||
) | ||
} |
1 change: 1 addition & 0 deletions
1
src/components/molecules/InformationSection/InformationBlock/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './InformationBlock' |
45 changes: 45 additions & 0 deletions
45
src/components/molecules/InformationSection/InformationSection.styles.module.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
@import 'src/scss/mixins'; | ||
|
||
.information-section { | ||
display: flex; | ||
flex-flow: wrap; | ||
align-items: flex-start; | ||
|
||
@include tablet { | ||
align-items: flex-start; | ||
} | ||
|
||
@include mobile { | ||
width: 90%; | ||
} | ||
} | ||
|
||
.images, | ||
.blocks { | ||
margin-top: 80px; | ||
} | ||
|
||
.blocks { | ||
@include tablet { | ||
width: 90%; | ||
margin: 100px 20px; | ||
} | ||
|
||
@include mobile { | ||
width: 100%; | ||
margin: 30px 0 0 23px; | ||
} | ||
} | ||
|
||
.images { | ||
@include devices { | ||
display: none; | ||
} | ||
} | ||
|
||
.image { | ||
@include desktop { | ||
width: 450px; | ||
height: 450px; | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
src/components/molecules/InformationSection/InformationSection.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import React from 'react' | ||
|
||
import cx from 'classnames' | ||
|
||
import { Image } from 'src/components/atoms/Image' | ||
|
||
import { InformationBlock } from './InformationBlock' | ||
import { getSections } from './InformationSection.utils' | ||
|
||
import css from './InformationSection.styles.module.scss' | ||
|
||
export const InformationSection = () => { | ||
const sections = getSections() | ||
return ( | ||
<div className={css.informationSection}> | ||
<div className="row"> | ||
<div className={cx(css.blocks, 'col-md-8')}> | ||
{sections.map((section, index) => { | ||
return <InformationBlock key={index} header={section.header} texts={section.texts} /> | ||
})} | ||
</div> | ||
<div className={cx(css.images, 'col-md-4')}> | ||
<Image src="/images/common/boxes.png" className={css.image} /> | ||
</div> | ||
</div> | ||
</div> | ||
) | ||
} |
4 changes: 4 additions & 0 deletions
4
src/components/molecules/InformationSection/InformationSection.types.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export type InformationBlockContent = { | ||
header?: string | ||
texts?: string[] | ||
} |
29 changes: 29 additions & 0 deletions
29
src/components/molecules/InformationSection/InformationSection.utils.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { InformationBlockContent } from './InformationSection.types' | ||
|
||
const createSection = (header: string, texts: string[]): InformationBlockContent => { | ||
return { | ||
header, | ||
texts | ||
} | ||
} | ||
|
||
export const getSections = (): InformationBlockContent[] => { | ||
return [ | ||
createSection('У вас есть доставка?', [ | ||
'Для Вас всегда доступны быстрые и надежные варианты доставки Вашего компьютера:', | ||
'— Самовывоз', | ||
'— Доставка до пункта выдачи', | ||
'— Доставка до двери' | ||
]), | ||
createSection('А в мой город доставите?', [ | ||
'Доставка осуществляется по всей России транспортными компаниями СДЭК, Деловые линии, DPD и Яндекс.Доставка.', | ||
'При оформлении заказа наши менеджеры помогут Вам рассчитать стоимость и время доставки.' | ||
]), | ||
createSection('Как быстро?', [ | ||
'Всё зависит от наличия:', | ||
'— Товар в наличии отправляем в течение дня после оформления заказа.', | ||
'— Товар под заказ изготавливается не более 60 рабочих дней.' | ||
]), | ||
createSection('Почему я должен вам верить?', ['По законам РФ покупатель получает кассовый чек и бланк предоплаты.']) | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './InformationSection' |
43 changes: 43 additions & 0 deletions
43
src/components/molecules/TextBlocks/InformationBlock/InformationBlock.styles.module.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
@import 'src/scss/mixins'; | ||
|
||
.block { | ||
display: flex; | ||
width: 100%; | ||
flex-wrap: wrap; | ||
|
||
@include mobile { | ||
width: 90%; | ||
} | ||
} | ||
|
||
.item, | ||
.header { | ||
font-size: 22px; | ||
line-height: 50px; | ||
letter-spacing: 0; | ||
text-align: left; | ||
margin: 5px; | ||
|
||
@include mobile { | ||
font-size: 17px; | ||
line-height: 32px; | ||
} | ||
} | ||
|
||
.header { | ||
width: 100%; | ||
font-weight: 500; | ||
} | ||
|
||
.box { | ||
display: flex; | ||
width: 100%; | ||
|
||
@include mobile { | ||
justify-content: left; | ||
} | ||
} | ||
|
||
.item-color { | ||
color: $color-secondary; | ||
} |
50 changes: 50 additions & 0 deletions
50
src/components/molecules/TextBlocks/InformationBlock/InformationBlock.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import React from 'react' | ||
|
||
import cx from 'classnames' | ||
|
||
import { InformationBlockContent } from './InformationBlock.types' | ||
|
||
import css from './InformationBlock.styles.module.scss' | ||
|
||
export type InformationBlockProps = { | ||
header?: string | ||
blocks?: InformationBlockContent[] | ||
href?: string | ||
className?: string | ||
classNameHeader?: string | ||
classNameBox?: string | ||
classNameSubheader?: string | ||
classNameText?: string | ||
classNameCiting?: string | ||
} | ||
|
||
export const InformationBlock = ({ | ||
className, | ||
classNameHeader, | ||
classNameBox, | ||
classNameSubheader, | ||
classNameText, | ||
classNameCiting, | ||
blocks, | ||
header, | ||
href | ||
}: InformationBlockProps) => { | ||
return ( | ||
<div className={cx(css.block, className)}> | ||
{header && <span className={cx(css.header, classNameHeader)}>{header}</span>} | ||
{blocks?.map((block, index) => { | ||
return ( | ||
<div key={`information-block-${index}`} className={cx(css.box, classNameBox)}> | ||
{block.subheader && <span className={cx(css.item, classNameSubheader)}>{block.subheader}</span>} | ||
{block.text && <span className={cx(css.item, css.itemColor, classNameText)}>{block.text}</span>} | ||
{block.citing && ( | ||
<a href={href} className={cx(css.itemColor, classNameCiting)}> | ||
{block.citing} | ||
</a> | ||
)} | ||
</div> | ||
) | ||
})} | ||
</div> | ||
) | ||
} |
5 changes: 5 additions & 0 deletions
5
src/components/molecules/TextBlocks/InformationBlock/InformationBlock.types.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export type InformationBlockContent = { | ||
subheader?: string | ||
text?: string | ||
citing?: string | ||
} |
Oops, something went wrong.