@meduza/ui-kit-2 0.4.14 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +7 -1
- package/src/Cover/index.tsx +2 -10
- package/src/DocumentItemsCount/DocumentItemsCount.module.css +12 -1
- package/src/DocumentItemsCount/DocumentItemsCount.test.tsx +9 -2
- package/src/DocumentItemsCount/index.tsx +3 -3
- package/src/Image/Image.module.css +0 -11
- package/src/Meta/Meta.module.css +0 -5
- package/src/Meta/Meta.stories.module.css +0 -16
- package/src/Meta/Meta.stories.tsx +4 -51
- package/src/Meta/MetaContainer.tsx +0 -8
- package/src/RawHtmlBlock/index.tsx +5 -0
- package/src/RelatedRichBlock/RelatedRichBlock.module.css +1 -11
- package/src/RenderBlocks/index.tsx +1 -5
- package/src/ShopRelatedBlock/ShopRelatedBlock.module.css +210 -0
- package/src/ShopRelatedBlock/ShopRelatedBlock.stories.module.css +12 -0
- package/src/ShopRelatedBlock/ShopRelatedBlock.stories.tsx +52 -0
- package/src/ShopRelatedBlock/ShopRelatedBlock.test.tsx +20 -0
- package/src/ShopRelatedBlock/ShopRelatedBlock.types.ts +4 -0
- package/src/ShopRelatedBlock/index.tsx +120 -0
- package/src/ShopRelatedBlock/mock.json +153 -0
- package/src/SimpleBlock/SimpleBlock.types.ts +1 -0
- package/src/SimpleBlock/index.tsx +3 -1
- package/src/Tag/Tag.module.css +3 -8
- package/src/Tag/Tag.stories.tsx +3 -16
- package/src/Tag/Tag.types.ts +1 -7
- package/src/index.tsx +1 -1
- package/dist/AnnouncementInText/AnnouncementInText.types.d.ts +0 -4
- package/dist/AnnouncementInText/index.d.ts +0 -3
- package/dist/BookmarkButton/BookmarkButton.types.d.ts +0 -6
- package/dist/BookmarkButton/index.d.ts +0 -3
- package/dist/Button/Button.d.ts +0 -3
- package/dist/Button/Button.types.d.ts +0 -16
- package/dist/Button/ButtonLoader.d.ts +0 -2
- package/dist/Button/index.d.ts +0 -2
- package/dist/CardTitle/CardTitle.types.d.ts +0 -10
- package/dist/CardTitle/index.d.ts +0 -3
- package/dist/ChapterBlock/ChapterBlock.types.d.ts +0 -7
- package/dist/ChapterBlock/index.d.ts +0 -3
- package/dist/Cover/Cover.types.d.ts +0 -24
- package/dist/Cover/index.d.ts +0 -3
- package/dist/DocumentItemsCount/DocumentItemsCount.types.d.ts +0 -7
- package/dist/DocumentItemsCount/index.d.ts +0 -3
- package/dist/DonatesTeaser/DonatesTeaser.types.d.ts +0 -4
- package/dist/DonatesTeaser/index.d.ts +0 -3
- package/dist/DotsOnImage/DotsOnImage.types.d.ts +0 -46
- package/dist/DotsOnImage/index.d.ts +0 -3
- package/dist/Dropdown/Dropdown.types.d.ts +0 -6
- package/dist/Dropdown/index.d.ts +0 -4
- package/dist/EmbedBlock/EmbedBlock.d.ts +0 -3
- package/dist/EmbedBlock/EmbedBlock.types.d.ts +0 -12
- package/dist/EmbedBlock/EmbedGif.d.ts +0 -3
- package/dist/EmbedBlock/IframeBlock.d.ts +0 -3
- package/dist/EmbedBlock/index.d.ts +0 -3
- package/dist/Footnote/Footnote.types.d.ts +0 -5
- package/dist/Footnote/index.d.ts +0 -3
- package/dist/GroupedBlock/GroupedBlock.types.d.ts +0 -4
- package/dist/GroupedBlock/index.d.ts +0 -3
- package/dist/HalfBlock/HalfBlock.types.d.ts +0 -4
- package/dist/HalfBlock/index.d.ts +0 -3
- package/dist/Image/Image.types.d.ts +0 -35
- package/dist/Image/RenderPicture.d.ts +0 -4
- package/dist/Image/index.d.ts +0 -3
- package/dist/ImportantLead/ImportantLead.types.d.ts +0 -4
- package/dist/ImportantLead/index.d.ts +0 -3
- package/dist/Lazy/Lazy.types.d.ts +0 -5
- package/dist/Lazy/index.d.ts +0 -3
- package/dist/ListBlock/ListBlock.types.d.ts +0 -10
- package/dist/ListBlock/index.d.ts +0 -3
- package/dist/MaterialNote/MaterialNote.types.d.ts +0 -13
- package/dist/MaterialNote/index.d.ts +0 -3
- package/dist/MaterialTitle/MaterialTitle.types.d.ts +0 -4
- package/dist/MaterialTitle/index.d.ts +0 -5
- package/dist/MediaCaption/MediaCaption.types.d.ts +0 -5
- package/dist/MediaCaption/index.d.ts +0 -3
- package/dist/Meta/Meta.mock.d.ts +0 -12
- package/dist/Meta/Meta.types.d.ts +0 -19
- package/dist/Meta/MetaContainer.d.ts +0 -3
- package/dist/Meta/index.d.ts +0 -3
- package/dist/MetaItem/MetaItem.types.d.ts +0 -7
- package/dist/MetaItem/index.d.ts +0 -3
- package/dist/MetaItemLive/MetaItemLive.types.d.ts +0 -3
- package/dist/MetaItemLive/index.d.ts +0 -3
- package/dist/Popover/Popover.types.d.ts +0 -5
- package/dist/Popover/index.d.ts +0 -3
- package/dist/QuoteBlock/QuoteBlock.types.d.ts +0 -6
- package/dist/QuoteBlock/index.d.ts +0 -3
- package/dist/RawHtmlBlock/RawHtmlBlock.types.d.ts +0 -17
- package/dist/RawHtmlBlock/index.d.ts +0 -3
- package/dist/RelatedBlock/RelatedBlock.types.d.ts +0 -17
- package/dist/RelatedBlock/index.d.ts +0 -3
- package/dist/RelatedBook/RelatedBook.mock.d.ts +0 -65
- package/dist/RelatedBook/RelatedBook.types.d.ts +0 -4
- package/dist/RelatedBook/index.d.ts +0 -3
- package/dist/RelatedRichBlock/RelatedRichBlock.types.d.ts +0 -4
- package/dist/RelatedRichBlock/index.d.ts +0 -3
- package/dist/RenderBlocks/RenderBlocks.types.d.ts +0 -11
- package/dist/RenderBlocks/index.d.ts +0 -3
- package/dist/RichTitle/RichTitle.types.d.ts +0 -13
- package/dist/RichTitle/index.d.ts +0 -3
- package/dist/SensitiveBlock/SensitiveBlock.types.d.ts +0 -15
- package/dist/SensitiveBlock/index.d.ts +0 -3
- package/dist/SimpleBlock/SimpleBlock.types.d.ts +0 -4
- package/dist/SimpleBlock/index.d.ts +0 -3
- package/dist/SimpleTitle/SimpleTitle.types.d.ts +0 -9
- package/dist/SimpleTitle/index.d.ts +0 -3
- package/dist/SourceBlock/SourceBlock.types.d.ts +0 -15
- package/dist/SourceBlock/index.d.ts +0 -3
- package/dist/Spoiler/Spoiler.types.d.ts +0 -4
- package/dist/Spoiler/index.d.ts +0 -3
- package/dist/SvgSymbol/SvgSymbol.types.d.ts +0 -8
- package/dist/SvgSymbol/icons.d.ts +0 -167
- package/dist/SvgSymbol/index.d.ts +0 -3
- package/dist/Switcher/Switcher.types.d.ts +0 -12
- package/dist/Switcher/index.d.ts +0 -3
- package/dist/Table/Table.types.d.ts +0 -25
- package/dist/Table/index.d.ts +0 -3
- package/dist/Tag/Tag.types.d.ts +0 -12
- package/dist/Tag/index.d.ts +0 -3
- package/dist/Timestamp/Timestamp.types.d.ts +0 -5
- package/dist/Timestamp/index.d.ts +0 -4
- package/dist/Toolbar/Toolbar.d.ts +0 -3
- package/dist/Toolbar/Toolbar.types.d.ts +0 -8
- package/dist/Toolbar/ToolbarItem.d.ts +0 -3
- package/dist/Toolbar/index.d.ts +0 -2
- package/dist/ToolbarButton/ToolbarButton.types.d.ts +0 -10
- package/dist/ToolbarButton/index.d.ts +0 -3
- package/dist/Tooltip/Tooltip.d.ts +0 -3
- package/dist/Tooltip/Tooltip.types.d.ts +0 -8
- package/dist/Tooltip/TooltipFooter.d.ts +0 -3
- package/dist/Tooltip/index.d.ts +0 -2
- package/dist/constants.d.ts +0 -41
- package/dist/index.d.ts +0 -45
- package/dist/types.d.ts +0 -20
- package/dist/ui-kit-2.cjs.development.js +0 -2669
- package/dist/ui-kit-2.cjs.development.js.map +0 -1
- package/dist/ui-kit-2.cjs.production.min.js +0 -2
- package/dist/ui-kit-2.cjs.production.min.js.map +0 -1
- package/dist/ui-kit-2.esm.js +0 -2615
- package/dist/ui-kit-2.esm.js.map +0 -1
- package/dist/ui-kit.css +0 -6006
- package/dist/utils/BlockContext.d.ts +0 -8
- package/dist/utils/DangerousHtml.d.ts +0 -8
- package/dist/utils/capitalizeFirstLetter.d.ts +0 -1
- package/dist/utils/converCase.d.ts +0 -2
- package/dist/utils/generateGradient.d.ts +0 -2
- package/dist/utils/getElementPositionRelativeToViewport.d.ts +0 -2
- package/dist/utils/makeClassName.d.ts +0 -3
- package/dist/utils/makeStyleContext.d.ts +0 -3
- package/dist/utils/pluralize.d.ts +0 -2
- package/dist/utils/postMessage.d.ts +0 -2
- package/dist/utils/viewportSize.d.ts +0 -6
- package/src/.DS_Store +0 -0
- package/src/Meta/Meta.mock.ts +0 -19
- package/src/RelatedBook/RelatedBook.mock.ts +0 -68
- package/src/RelatedBook/RelatedBook.module.css +0 -210
- package/src/RelatedBook/RelatedBook.stories.module.css +0 -5
- package/src/RelatedBook/RelatedBook.stories.tsx +0 -35
- package/src/RelatedBook/RelatedBook.test.tsx +0 -20
- package/src/RelatedBook/RelatedBook.types.ts +0 -4
- package/src/RelatedBook/index.tsx +0 -68
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.
|
|
2
|
+
"version": "0.5.1",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"description": "UIKit for Meduza",
|
|
5
5
|
"repository": "https://github.com/meduza-corp/ui-kit-2.git",
|
|
@@ -51,6 +51,12 @@
|
|
|
51
51
|
"@commitlint/config-conventional"
|
|
52
52
|
]
|
|
53
53
|
},
|
|
54
|
+
"husky": {
|
|
55
|
+
"hooks": {
|
|
56
|
+
"pre-commit": "tsc --noEmit && lint-staged",
|
|
57
|
+
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
|
|
58
|
+
}
|
|
59
|
+
},
|
|
54
60
|
"devDependencies": {
|
|
55
61
|
"@babel/core": "^7.22.9",
|
|
56
62
|
"@babel/preset-env": "^7.22.9",
|
package/src/Cover/index.tsx
CHANGED
|
@@ -38,10 +38,7 @@ export const Cover: React.FC<CoverProps> = ({
|
|
|
38
38
|
|
|
39
39
|
classNames = makeStyleContext(classNames, theme, styles)
|
|
40
40
|
|
|
41
|
-
style.backgroundImage = generateGradient(
|
|
42
|
-
gradients.bg_rgb,
|
|
43
|
-
'mediaBlockBottom'
|
|
44
|
-
)
|
|
41
|
+
style.backgroundImage = generateGradient(gradients.bg_rgb, 'mediaBlockBottom')
|
|
45
42
|
}
|
|
46
43
|
|
|
47
44
|
const renderCC = (context?: string): JSX.Element => (
|
|
@@ -55,12 +52,7 @@ export const Cover: React.FC<CoverProps> = ({
|
|
|
55
52
|
return (
|
|
56
53
|
<div data-testid="cover" className={makeClassName(classNames)}>
|
|
57
54
|
<div className={styles.image}>
|
|
58
|
-
<Image
|
|
59
|
-
optimized={urls}
|
|
60
|
-
ratio={mobileRatio}
|
|
61
|
-
display="narrow"
|
|
62
|
-
lazy={true}
|
|
63
|
-
/>
|
|
55
|
+
<Image optimized={urls} ratio={mobileRatio} display="narrow" />
|
|
64
56
|
</div>
|
|
65
57
|
<div className={styles.body} style={style}>
|
|
66
58
|
{blocks.map((item) => (
|
|
@@ -1,6 +1,17 @@
|
|
|
1
|
+
/* stylelint-disable declaration-empty-line-before */
|
|
1
2
|
@import '../vars';
|
|
2
3
|
|
|
3
|
-
.root
|
|
4
|
+
.root {
|
|
5
|
+
display: inline;
|
|
6
|
+
|
|
7
|
+
line-height: inherit;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.root svg {
|
|
11
|
+
vertical-align: top;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.items {
|
|
4
15
|
margin-left: 1px;
|
|
5
16
|
|
|
6
17
|
vertical-align: top;
|
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { render } from '@testing-library/react'
|
|
3
3
|
import { DocumentItemsCount } from './'
|
|
4
|
+
// import { DocumentItemsCountProps } from './DocumentItemsCount.types'
|
|
5
|
+
|
|
6
|
+
import styles from './DocumentItemsCount.module.css'
|
|
4
7
|
|
|
5
8
|
describe('Document Items Count', () => {
|
|
9
|
+
// let props: DocumentItemsCountProps
|
|
10
|
+
|
|
6
11
|
const renderComponent = () =>
|
|
7
12
|
render(<DocumentItemsCount type="card" items={4} />)
|
|
8
13
|
|
|
9
14
|
it('should have root style', () => {
|
|
10
|
-
const {
|
|
15
|
+
const { getByTestId } = renderComponent()
|
|
16
|
+
|
|
17
|
+
const documentItemsCount = getByTestId('document-items-count')
|
|
11
18
|
|
|
12
|
-
expect(
|
|
19
|
+
expect(documentItemsCount).toHaveClass(styles.root)
|
|
13
20
|
})
|
|
14
21
|
})
|
|
@@ -45,9 +45,9 @@ export const DocumentItemsCount: React.FC<DocumentItemsCountProps> = ({
|
|
|
45
45
|
)}`
|
|
46
46
|
|
|
47
47
|
return (
|
|
48
|
-
|
|
48
|
+
<div data-testid="document-items-count" className={styles.root}>
|
|
49
49
|
{children}
|
|
50
|
-
<span className={styles.
|
|
51
|
-
|
|
50
|
+
<span className={styles.items}>{itemsCount}</span>
|
|
51
|
+
</div>
|
|
52
52
|
)
|
|
53
53
|
}
|
package/src/Meta/Meta.module.css
CHANGED
|
@@ -4,20 +4,4 @@
|
|
|
4
4
|
display: block;
|
|
5
5
|
|
|
6
6
|
font-family: $secondaryFont;
|
|
7
|
-
|
|
8
|
-
display: flex;
|
|
9
|
-
flex-flow: column nowrap;
|
|
10
|
-
|
|
11
|
-
gap: 40px;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
.root h3 {
|
|
15
|
-
font-size: 20px;
|
|
16
|
-
font-weight: bold;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.layout {
|
|
20
|
-
display: flex;
|
|
21
|
-
flex-flow: column nowrap;
|
|
22
|
-
gap: 20px;
|
|
23
7
|
}
|
|
@@ -8,8 +8,6 @@ import { SvgSymbol } from '../SvgSymbol'
|
|
|
8
8
|
import { PreviewWrapper } from '../_storybook/PreviewWrapper'
|
|
9
9
|
|
|
10
10
|
import styles from './Meta.stories.module.css'
|
|
11
|
-
import { MetaContainer } from './MetaContainer'
|
|
12
|
-
import { MetaMock } from './Meta.mock'
|
|
13
11
|
|
|
14
12
|
export default {
|
|
15
13
|
title: 'Main / Meta',
|
|
@@ -21,8 +19,8 @@ export default {
|
|
|
21
19
|
|
|
22
20
|
const Example: React.FC = () => {
|
|
23
21
|
return (
|
|
24
|
-
|
|
25
|
-
<div className={styles.
|
|
22
|
+
<>
|
|
23
|
+
<div className={styles.root}>
|
|
26
24
|
<h3>В карточке</h3>
|
|
27
25
|
<Meta>
|
|
28
26
|
<MetaItem>
|
|
@@ -40,7 +38,7 @@ const Example: React.FC = () => {
|
|
|
40
38
|
))}
|
|
41
39
|
</Meta>
|
|
42
40
|
</div>
|
|
43
|
-
<div className={styles.
|
|
41
|
+
<div className={styles.root}>
|
|
44
42
|
<h3>В материале</h3>
|
|
45
43
|
|
|
46
44
|
<Meta styleContext="isInMaterial">
|
|
@@ -54,53 +52,8 @@ const Example: React.FC = () => {
|
|
|
54
52
|
<Timestamp publishedAt={1558353600} type="date" locale="en" />
|
|
55
53
|
</MetaItem>
|
|
56
54
|
</Meta>
|
|
57
|
-
<div className={styles.layout}>
|
|
58
|
-
<h3>Блочная</h3>
|
|
59
|
-
<MetaContainer
|
|
60
|
-
block={MetaMock}
|
|
61
|
-
lang="ru"
|
|
62
|
-
styleContext={[]}
|
|
63
|
-
isRead={false}
|
|
64
|
-
isListened={false}
|
|
65
|
-
isInBookmarks={false}
|
|
66
|
-
/>
|
|
67
|
-
</div>
|
|
68
|
-
<div
|
|
69
|
-
className={styles.layout}
|
|
70
|
-
style={
|
|
71
|
-
{
|
|
72
|
-
'--metaText': `pink`,
|
|
73
|
-
'--metaFill': 'currentColor'
|
|
74
|
-
} as React.CSSProperties
|
|
75
|
-
}
|
|
76
|
-
>
|
|
77
|
-
<h3>CSS Props</h3>
|
|
78
|
-
|
|
79
|
-
<Meta styleContext="isCustom">
|
|
80
|
-
<MetaItem bullets>
|
|
81
|
-
<MetaItemLive /> Онлайн
|
|
82
|
-
</MetaItem>
|
|
83
|
-
<MetaItem bullets>
|
|
84
|
-
Источник: <a href="https://meduza.io">Meduza</a>
|
|
85
|
-
</MetaItem>
|
|
86
|
-
<MetaItem bullets>
|
|
87
|
-
<Timestamp publishedAt={1558353600} type="date" locale="en" />
|
|
88
|
-
</MetaItem>
|
|
89
|
-
</Meta>
|
|
90
|
-
<div className={styles.layout}>
|
|
91
|
-
<h3>Блочная</h3>
|
|
92
|
-
<MetaContainer
|
|
93
|
-
block={MetaMock}
|
|
94
|
-
lang="ru"
|
|
95
|
-
styleContext={[]}
|
|
96
|
-
isRead={false}
|
|
97
|
-
isListened={false}
|
|
98
|
-
isInBookmarks={false}
|
|
99
|
-
/>
|
|
100
|
-
</div>
|
|
101
|
-
</div>
|
|
102
55
|
</div>
|
|
103
|
-
|
|
56
|
+
</>
|
|
104
57
|
)
|
|
105
58
|
}
|
|
106
59
|
|
|
@@ -133,14 +133,6 @@ export const MetaContainer: React.FC<MetaContainerProps> = ({
|
|
|
133
133
|
)
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
-
case 'string': {
|
|
137
|
-
return (
|
|
138
|
-
<MetaItem bullets key={component.id}>
|
|
139
|
-
{component.text}
|
|
140
|
-
</MetaItem>
|
|
141
|
-
)
|
|
142
|
-
}
|
|
143
|
-
|
|
144
136
|
default: {
|
|
145
137
|
return null
|
|
146
138
|
}
|
|
@@ -6,6 +6,7 @@ import { Spoiler } from '../Spoiler'
|
|
|
6
6
|
import { HalfBlock } from '../HalfBlock'
|
|
7
7
|
import { Cover } from '../Cover'
|
|
8
8
|
import { RelatedRichBlock } from '../RelatedRichBlock'
|
|
9
|
+
import { ShopRelatedBlock } from '../ShopRelatedBlock'
|
|
9
10
|
import { BlockProvider } from '../utils/BlockContext'
|
|
10
11
|
|
|
11
12
|
export const RawHtmlBlock: React.FC<RawHtmlBlockProps> = ({
|
|
@@ -47,6 +48,10 @@ export const RawHtmlBlock: React.FC<RawHtmlBlockProps> = ({
|
|
|
47
48
|
return <RelatedRichBlock block={block} styleContext={styleContext} />
|
|
48
49
|
}
|
|
49
50
|
|
|
51
|
+
case 'related_shop': {
|
|
52
|
+
return <ShopRelatedBlock block={block} styleContext={styleContext} />
|
|
53
|
+
}
|
|
54
|
+
|
|
50
55
|
default: {
|
|
51
56
|
return (
|
|
52
57
|
<BlockProvider value={context}>
|
|
@@ -19,14 +19,6 @@
|
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
.root:last-child {
|
|
23
|
-
margin-bottom: 0;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.root:first-child {
|
|
27
|
-
margin-top: 0;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
22
|
.root::after {
|
|
31
23
|
position: absolute;
|
|
32
24
|
top: 0;
|
|
@@ -47,9 +39,7 @@
|
|
|
47
39
|
}
|
|
48
40
|
|
|
49
41
|
.root::after {
|
|
50
|
-
box-shadow:
|
|
51
|
-
inset 0 4px #b88b59,
|
|
52
|
-
inset 0 5px rgba(0, 0, 0, 0.2),
|
|
42
|
+
box-shadow: inset 0 4px #b88b59, inset 0 5px rgba(0, 0, 0, 0.2),
|
|
53
43
|
inset 0 0 0 1px rgba(0, 0, 0, 0.1);
|
|
54
44
|
}
|
|
55
45
|
|
|
@@ -18,7 +18,6 @@ import { MaterialNote } from '../MaterialNote'
|
|
|
18
18
|
import { SensitiveBlock } from '../SensitiveBlock'
|
|
19
19
|
import { DonatesTeaser } from '../DonatesTeaser'
|
|
20
20
|
import { AnnouncementInText } from '../AnnouncementInText'
|
|
21
|
-
import { RelatedBook } from '../RelatedBook'
|
|
22
21
|
|
|
23
22
|
export const RenderBlocks: React.FC<RenderBlocksProps> = ({
|
|
24
23
|
block,
|
|
@@ -75,7 +74,7 @@ export const RenderBlocks: React.FC<RenderBlocksProps> = ({
|
|
|
75
74
|
case 'divider':
|
|
76
75
|
case 'lead':
|
|
77
76
|
case 'lead_hr': {
|
|
78
|
-
return <SimpleBlock block={block} styleContext={styleContext} />
|
|
77
|
+
return <SimpleBlock block={block} styleContext={styleContext} id={block.id} />
|
|
79
78
|
}
|
|
80
79
|
|
|
81
80
|
case 'quote':
|
|
@@ -97,9 +96,6 @@ export const RenderBlocks: React.FC<RenderBlocksProps> = ({
|
|
|
97
96
|
case 'related': {
|
|
98
97
|
return <RelatedBlock block={block} styleContext={styleContext} />
|
|
99
98
|
}
|
|
100
|
-
case 'related_book': {
|
|
101
|
-
return <RelatedBook block={block} styleContext={styleContext} />
|
|
102
|
-
}
|
|
103
99
|
|
|
104
100
|
case 'source':
|
|
105
101
|
return <SourceBlock block={block} styleContext={styleContext} />
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
@import '../vars.css';
|
|
2
|
+
|
|
3
|
+
.root {
|
|
4
|
+
position: relative;
|
|
5
|
+
z-index: 10;
|
|
6
|
+
|
|
7
|
+
display: block;
|
|
8
|
+
overflow: hidden;
|
|
9
|
+
|
|
10
|
+
color: #000;
|
|
11
|
+
|
|
12
|
+
text-decoration: none;
|
|
13
|
+
|
|
14
|
+
border-radius: 8px;
|
|
15
|
+
outline-width: 0;
|
|
16
|
+
|
|
17
|
+
@media $mobile {
|
|
18
|
+
color: #fff;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.root:hover {
|
|
23
|
+
@media $mobile {
|
|
24
|
+
opacity: 0.95;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.root::after {
|
|
29
|
+
position: absolute;
|
|
30
|
+
top: 0;
|
|
31
|
+
right: 0;
|
|
32
|
+
bottom: 0;
|
|
33
|
+
left: 0;
|
|
34
|
+
z-index: 20;
|
|
35
|
+
|
|
36
|
+
border-radius: 8px;
|
|
37
|
+
|
|
38
|
+
content: '';
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.root::before {
|
|
42
|
+
display: block;
|
|
43
|
+
|
|
44
|
+
width: 100%;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.root::after {
|
|
48
|
+
box-shadow: inset 0 4px #b88b59, inset 0 5px rgba(0, 0, 0, 0.2),
|
|
49
|
+
inset 0 0 0 1px rgba(0, 0, 0, 0.1);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.root,
|
|
53
|
+
.wrapper {
|
|
54
|
+
margin: 16px 0;
|
|
55
|
+
|
|
56
|
+
@media $portraitTablet {
|
|
57
|
+
margin: 25px 0;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.overlay,
|
|
62
|
+
.overlayHeader {
|
|
63
|
+
position: absolute;
|
|
64
|
+
right: 0;
|
|
65
|
+
left: 0;
|
|
66
|
+
z-index: 10;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.overlay {
|
|
70
|
+
bottom: 0;
|
|
71
|
+
|
|
72
|
+
height: 295px;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.overlayHeader {
|
|
76
|
+
top: 0;
|
|
77
|
+
|
|
78
|
+
height: 150px;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.body {
|
|
82
|
+
display: flex;
|
|
83
|
+
flex-flow: column nowrap;
|
|
84
|
+
justify-content: flex-end;
|
|
85
|
+
|
|
86
|
+
padding: 12px 15px;
|
|
87
|
+
|
|
88
|
+
background-color: #f7f7f7;
|
|
89
|
+
|
|
90
|
+
@media $mobile {
|
|
91
|
+
position: absolute;
|
|
92
|
+
right: 0;
|
|
93
|
+
bottom: 0;
|
|
94
|
+
left: 0;
|
|
95
|
+
z-index: 10;
|
|
96
|
+
|
|
97
|
+
min-height: 295px;
|
|
98
|
+
padding: 20px;
|
|
99
|
+
|
|
100
|
+
background-color: transparent;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.hasGradient .body {
|
|
105
|
+
@media $mobile {
|
|
106
|
+
position: absolute;
|
|
107
|
+
right: 0;
|
|
108
|
+
bottom: 0;
|
|
109
|
+
left: 0;
|
|
110
|
+
z-index: 10;
|
|
111
|
+
|
|
112
|
+
min-height: 295px;
|
|
113
|
+
|
|
114
|
+
background-color: transparent;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.picture {
|
|
119
|
+
position: relative;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.picture::after {
|
|
123
|
+
position: absolute;
|
|
124
|
+
right: 1px;
|
|
125
|
+
bottom: 0;
|
|
126
|
+
left: 1px;
|
|
127
|
+
z-index: 10;
|
|
128
|
+
|
|
129
|
+
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
|
|
130
|
+
|
|
131
|
+
content: '';
|
|
132
|
+
|
|
133
|
+
@media $mobile {
|
|
134
|
+
content: '';
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.tag {
|
|
139
|
+
position: absolute;
|
|
140
|
+
top: 14px;
|
|
141
|
+
right: 15px;
|
|
142
|
+
left: 15px;
|
|
143
|
+
z-index: 10;
|
|
144
|
+
|
|
145
|
+
color: rgba(255, 255, 255, 0.7);
|
|
146
|
+
|
|
147
|
+
font-size: 12px;
|
|
148
|
+
|
|
149
|
+
@media $landscapeTablet {
|
|
150
|
+
top: 16px;
|
|
151
|
+
right: 20px;
|
|
152
|
+
left: 20px;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.center {
|
|
157
|
+
width: 100%;
|
|
158
|
+
max-width: 650px;
|
|
159
|
+
margin-right: auto;
|
|
160
|
+
margin-left: auto;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.title {
|
|
164
|
+
font-weight: 700;
|
|
165
|
+
font-size: 19px;
|
|
166
|
+
font-family: $secondaryFont;
|
|
167
|
+
line-height: 23px;
|
|
168
|
+
|
|
169
|
+
@media $landscapeTablet {
|
|
170
|
+
font-size: 1.3rem;
|
|
171
|
+
line-height: 1.6rem;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.price {
|
|
176
|
+
display: block;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/* Themes */
|
|
180
|
+
|
|
181
|
+
.dark {
|
|
182
|
+
color: #000;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
.dark .tag {
|
|
186
|
+
color: rgba(0, 0, 0, 0.7);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.light {
|
|
190
|
+
@media $mobile {
|
|
191
|
+
color: #fff;
|
|
192
|
+
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/* Display */
|
|
197
|
+
|
|
198
|
+
.mobile {
|
|
199
|
+
@media $mobile {
|
|
200
|
+
display: none;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.desktop {
|
|
205
|
+
display: none;
|
|
206
|
+
|
|
207
|
+
@media $mobile {
|
|
208
|
+
display: block;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { ShopRelatedBlock } from '.'
|
|
3
|
+
import { PreviewWrapper } from '../_storybook/PreviewWrapper'
|
|
4
|
+
|
|
5
|
+
import styles from './ShopRelatedBlock.stories.module.css'
|
|
6
|
+
import mock from './mock.json'
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
title: 'Main / ShopRelatedBlock',
|
|
10
|
+
component: ShopRelatedBlock,
|
|
11
|
+
parameters: {
|
|
12
|
+
themeWrapperSideBySide: true
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const Example: React.FC = () => {
|
|
17
|
+
return (
|
|
18
|
+
<>
|
|
19
|
+
<div className={styles.root}>
|
|
20
|
+
<div className={styles.card}>
|
|
21
|
+
<ShopRelatedBlock block={mock.rich} styleContext={['no_mods']} />
|
|
22
|
+
</div>
|
|
23
|
+
<div className={styles.card}>
|
|
24
|
+
<ShopRelatedBlock block={mock.rich_dark} styleContext={['no_mods']} />
|
|
25
|
+
</div>
|
|
26
|
+
<div className={styles.card}>
|
|
27
|
+
<ShopRelatedBlock
|
|
28
|
+
block={mock.rich_and_featured_mobile}
|
|
29
|
+
styleContext={['no_mods']}
|
|
30
|
+
/>
|
|
31
|
+
</div>
|
|
32
|
+
<div className={styles.card}>
|
|
33
|
+
<ShopRelatedBlock
|
|
34
|
+
block={mock.rich_and_featured_desktop}
|
|
35
|
+
styleContext={['no_mods']}
|
|
36
|
+
/>
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
</>
|
|
40
|
+
)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export const Default: React.FC = () => (
|
|
44
|
+
<>
|
|
45
|
+
<PreviewWrapper theme="light">
|
|
46
|
+
<Example />
|
|
47
|
+
</PreviewWrapper>
|
|
48
|
+
{/* <PreviewWrapper theme="dark">
|
|
49
|
+
<Example />
|
|
50
|
+
</PreviewWrapper> */}
|
|
51
|
+
</>
|
|
52
|
+
)
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { render } from '@testing-library/react'
|
|
3
|
+
import { ShopRelatedBlock } from '.'
|
|
4
|
+
import { ShopRelatedBlockProps } from './ShopRelatedBlock.types'
|
|
5
|
+
|
|
6
|
+
import styles from './ShopRelatedBlock.module.css'
|
|
7
|
+
|
|
8
|
+
describe('Related Rich Block', () => {
|
|
9
|
+
let props: ShopRelatedBlockProps
|
|
10
|
+
|
|
11
|
+
const renderComponent = () => render(<ShopRelatedBlock {...props} />)
|
|
12
|
+
|
|
13
|
+
it('should have root style', () => {
|
|
14
|
+
const { getByTestId } = renderComponent()
|
|
15
|
+
|
|
16
|
+
const ShopRelatedBlock = getByTestId('realated-rich-block')
|
|
17
|
+
|
|
18
|
+
expect(ShopRelatedBlock).toHaveClass(styles.root)
|
|
19
|
+
})
|
|
20
|
+
})
|