@meduza/ui-kit-2 0.1.19 → 0.1.21
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/dist/Cover/Cover.types.d.ts +21 -1
- package/dist/DotsOnImage/DotsOnImage.types.d.ts +1 -1
- package/dist/Image/Image.types.d.ts +1 -6
- package/dist/ListBlock/ListBlock.stories.d.ts +2 -1
- package/dist/ListBlock/ListBlock.types.d.ts +7 -1
- package/dist/RelatedBlock/RelatedBlock.types.d.ts +14 -1
- package/dist/RelatedRichBlock/RelatedRichBlock.stories.d.ts +10 -0
- package/dist/RelatedRichBlock/RelatedRichBlock.types.d.ts +4 -0
- package/dist/RelatedRichBlock/index.d.ts +3 -0
- package/dist/RichTitle/RichTitle.types.d.ts +8 -1
- package/dist/SimpleTitle/SimpleTitle.types.d.ts +6 -1
- package/dist/SourceBlock/SourceBlock.types.d.ts +12 -1
- package/dist/index.d.ts +1 -0
- package/dist/types.d.ts +6 -0
- package/dist/ui-kit-2.cjs.development.js +147 -47
- package/dist/ui-kit-2.cjs.development.js.map +1 -1
- package/dist/ui-kit-2.cjs.production.min.js +1 -1
- package/dist/ui-kit-2.cjs.production.min.js.map +1 -1
- package/dist/ui-kit-2.esm.js +147 -48
- package/dist/ui-kit-2.esm.js.map +1 -1
- package/dist/ui-kit.css +1157 -961
- package/dist/utils/converCase.d.ts +2 -0
- package/dist/utils/generateGradient.d.ts +1 -1
- package/package.json +4 -1
- package/src/.DS_Store +0 -0
- package/src/BookmarkButton/BookmarkButton.test.tsx +17 -4
- package/src/CardTitle/CardTitle.test.tsx +4 -3
- package/src/ChapterBlock/ChapterBlock.test.tsx +4 -3
- package/src/Cover/Cover.test.tsx +3 -3
- package/src/Cover/Cover.types.ts +22 -1
- package/src/Cover/index.tsx +1 -1
- package/src/DocumentItemsCount/DocumentItemsCount.test.tsx +4 -3
- package/src/DotsOnImage/DotsOnImage.test.tsx +4 -2
- package/src/DotsOnImage/DotsOnImage.types.ts +1 -1
- package/src/EmbedBlock/EmbedBlock.test.tsx +16 -3
- package/src/EmbedBlock/index.tsx +1 -1
- package/src/GroupedBlock/GroupedBlock.test.tsx +5 -3
- package/src/HalfBlock/HalfBlock.test.tsx +4 -3
- package/src/Image/Image.test.tsx +3 -0
- package/src/Image/Image.types.ts +1 -6
- package/src/Image/RenderPicture.tsx +1 -1
- package/src/ImportantLead/ImportantLead.test.tsx +10 -8
- package/src/ImportantLead/mock.json +6 -0
- package/src/Lazy/Lazy.test.tsx +3 -0
- package/src/ListBlock/ListBlock.stories.tsx +2 -1
- package/src/ListBlock/ListBlock.test.tsx +8 -4
- package/src/ListBlock/ListBlock.types.ts +6 -1
- package/src/ListBlock/index.tsx +1 -1
- package/src/ListBlock/mock.json +1 -1
- package/src/MaterialNote/MaterialNote.test.tsx +4 -3
- package/src/Meta/Meta.module.css +1 -1
- package/src/QuoteBlock/QuoteBlock.test.tsx +4 -3
- package/src/RawHtmlBlock/RawHtmlBlock.test.tsx +18 -9
- package/src/RawHtmlBlock/mock.json +6 -0
- package/src/RelatedBlock/RelatedBlock.test.tsx +4 -3
- package/src/RelatedBlock/RelatedBlock.types.ts +14 -1
- package/src/RelatedRichBlock/RelatedRichBlock.module.css +165 -0
- package/src/RelatedRichBlock/RelatedRichBlock.stories.module.css +12 -0
- package/src/RelatedRichBlock/RelatedRichBlock.stories.tsx +55 -0
- package/src/RelatedRichBlock/RelatedRichBlock.test.tsx +20 -0
- package/src/RelatedRichBlock/RelatedRichBlock.types.ts +4 -0
- package/src/RelatedRichBlock/index.tsx +105 -0
- package/src/RelatedRichBlock/mock.json +354 -0
- package/src/RenderBlocks/RenderBlocks.stories.module.css +3 -0
- package/src/RenderBlocks/RenderBlocks.stories.tsx +4 -1
- package/src/RenderBlocks/RenderBlocks.test.tsx +15 -9
- package/src/RenderBlocks/index.tsx +5 -0
- package/src/RenderBlocks/mock.json +83 -0
- package/src/RichTitle/RichTitle.module.css +37 -7
- package/src/RichTitle/RichTitle.test.tsx +4 -3
- package/src/RichTitle/RichTitle.types.ts +8 -1
- package/src/SimpleBlock/SimpleBlock.test.tsx +16 -9
- package/src/SimpleBlock/mock.json +6 -0
- package/src/SimpleTitle/SimpleTitle.test.tsx +4 -3
- package/src/SimpleTitle/SimpleTitle.types.ts +6 -1
- package/src/SourceBlock/SourceBlock.test.tsx +4 -3
- package/src/SourceBlock/SourceBlock.types.ts +13 -1
- package/src/Spoiler/Spoiler.test.tsx +4 -3
- package/src/Table/Table.test.tsx +3 -3
- package/src/Timestamp/Timestamp.test.tsx +4 -3
- package/src/ToolbarButton/ToolbarButton.test.tsx +8 -3
- package/src/_storybook/PreviewWrapper/PreviewWrapper.module.css +3 -1
- package/src/index.tsx +1 -0
- package/src/types.ts +6 -0
- package/src/utils/{toCamel.ts → converCase.ts} +3 -0
- package/src/utils/generateGradient.ts +21 -15
- package/dist/utils/toCamel.d.ts +0 -1
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"blocks": [
|
|
3
|
+
{
|
|
4
|
+
"type": "p",
|
|
5
|
+
"data": "Hello Component",
|
|
6
|
+
"length": 0,
|
|
7
|
+
"id": "1-a3d239200edd759999e5493fd4a6311710f16774927df9907ffbabf57a915a901f"
|
|
8
|
+
},
|
|
3
9
|
{
|
|
4
10
|
"type": "lead",
|
|
5
11
|
"data": "В России качество медицинской помощи даже в одной больнице может значительно отличаться. Это прямое следствие того, что обучение врачей и проверку их знаний и навыков нельзя назвать хорошими. При этом у самих медицинских специалистов даже нет возможности понять, что с ними что-то не так: им дают дипломы, им разрешают работать. И если студент, ординатор или состоявшийся врач захотят получить хорошее образование (и будут понимать, что это значит), у них, скорее всего, возникнут проблемы, потому что в государственном секторе таких возможностей может не быть вообще либо они окажутся труднодоступны. В последнее время все чаще публично выступают люди, которые недовольны таким положением вещей. Они не только говорят о недостатках образования, которые видят, но и пытаются хотя бы локально что-то изменить. «Медуза» решила рассказать о некоторых студентах, врачах и благотворителях, которые меняют то, что им не нравится в вузах, ординатуре и в целом образовании врачей (и заодно объясняем, что не устраивает этих людей).",
|
|
@@ -5,10 +5,11 @@ import { SimpleTitleProps } from './SimpleTitle.types'
|
|
|
5
5
|
|
|
6
6
|
import styles from './SimpleTitle.module.css'
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
let props: SimpleTitleProps
|
|
8
|
+
import mock from './mock.json'
|
|
10
9
|
|
|
11
|
-
|
|
10
|
+
describe('Simple Title', () => {
|
|
11
|
+
const renderComponent = () =>
|
|
12
|
+
render(<SimpleTitle block={mock as SimpleTitleProps['block']} />)
|
|
12
13
|
|
|
13
14
|
it('should have root style', () => {
|
|
14
15
|
const { getByTestId } = renderComponent()
|
|
@@ -5,10 +5,11 @@ import { SourceBlockProps } from './SourceBlock.types'
|
|
|
5
5
|
|
|
6
6
|
import styles from './SourceBlock.module.css'
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
let props: SourceBlockProps
|
|
8
|
+
import mock from './mock.json'
|
|
10
9
|
|
|
11
|
-
|
|
10
|
+
describe('Source Block', () => {
|
|
11
|
+
const renderComponent = () =>
|
|
12
|
+
render(<SourceBlock block={mock as SourceBlockProps['block']} />)
|
|
12
13
|
|
|
13
14
|
it('should have root style', () => {
|
|
14
15
|
const { getByTestId } = renderComponent()
|
|
@@ -5,10 +5,11 @@ import { SpoilerProps } from './Spoiler.types'
|
|
|
5
5
|
|
|
6
6
|
import styles from './Spoiler.module.css'
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
let props: SpoilerProps
|
|
8
|
+
import mock from './mock.json'
|
|
10
9
|
|
|
11
|
-
|
|
10
|
+
describe('Spoiler', () => {
|
|
11
|
+
const renderComponent = () =>
|
|
12
|
+
render(<Spoiler block={mock as SpoilerProps['block']} />)
|
|
12
13
|
|
|
13
14
|
it('should have root style', () => {
|
|
14
15
|
const { getByTestId } = renderComponent()
|
package/src/Table/Table.test.tsx
CHANGED
|
@@ -4,11 +4,11 @@ import { Table } from './'
|
|
|
4
4
|
import { TableProps } from './Table.types'
|
|
5
5
|
|
|
6
6
|
import styles from './Table.module.css'
|
|
7
|
+
import mock from './mock.json'
|
|
7
8
|
|
|
8
9
|
describe('Table', () => {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const renderComponent = () => render(<Table {...props} />)
|
|
10
|
+
const renderComponent = () =>
|
|
11
|
+
render(<Table block={mock as TableProps['block']} />)
|
|
12
12
|
|
|
13
13
|
it('should have root style', () => {
|
|
14
14
|
const { getByTestId } = renderComponent()
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { render } from '@testing-library/react'
|
|
3
3
|
import { Timestamp } from './'
|
|
4
|
-
import { TimestampProps } from './Timestamp.types'
|
|
4
|
+
// import { TimestampProps } from './Timestamp.types'
|
|
5
5
|
|
|
6
6
|
import styles from './Timestamp.module.css'
|
|
7
7
|
|
|
8
8
|
describe('Timestamp', () => {
|
|
9
|
-
let props: TimestampProps
|
|
9
|
+
// let props: TimestampProps
|
|
10
10
|
|
|
11
|
-
const renderComponent = () =>
|
|
11
|
+
const renderComponent = () =>
|
|
12
|
+
render(<Timestamp publishedAt={1526024185} type="fromNow" />)
|
|
12
13
|
|
|
13
14
|
it('should have root style', () => {
|
|
14
15
|
const { getByTestId } = renderComponent()
|
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { render } from '@testing-library/react'
|
|
3
3
|
import { ToolbarButton } from './'
|
|
4
|
-
import { ToolbarButtonProps } from './ToolbarButton.types'
|
|
4
|
+
// import { ToolbarButtonProps } from './ToolbarButton.types'
|
|
5
5
|
|
|
6
6
|
import styles from './ToolbarButton.module.css'
|
|
7
7
|
|
|
8
8
|
describe('Toolbar Button', () => {
|
|
9
|
-
let props: ToolbarButtonProps
|
|
9
|
+
// let props: ToolbarButtonProps
|
|
10
10
|
|
|
11
|
-
const renderComponent = () =>
|
|
11
|
+
const renderComponent = () =>
|
|
12
|
+
render(
|
|
13
|
+
<ToolbarButton type="fb" onClick={(): void => alert('Hello Button')}>
|
|
14
|
+
42
|
|
15
|
+
</ToolbarButton>
|
|
16
|
+
)
|
|
12
17
|
|
|
13
18
|
it('should have root style', () => {
|
|
14
19
|
const { getByTestId } = renderComponent()
|
package/src/index.tsx
CHANGED
package/src/types.ts
ADDED
|
@@ -1,19 +1,25 @@
|
|
|
1
|
-
const generateGradient = (color: string): string => {
|
|
2
|
-
const
|
|
3
|
-
[
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
const generateGradient = (color: string, type: string): string => {
|
|
2
|
+
const steps = {
|
|
3
|
+
mediaBlockBottom: [
|
|
4
|
+
[0, 7],
|
|
5
|
+
[0.08, 12],
|
|
6
|
+
[0.16, 17],
|
|
7
|
+
[0.22, 21],
|
|
8
|
+
[0.32, 26],
|
|
9
|
+
[0.42, 32],
|
|
10
|
+
[0.52, 38],
|
|
11
|
+
[0.62, 47],
|
|
12
|
+
[0.72, 57],
|
|
13
|
+
[0.82, 65],
|
|
14
|
+
[1, 82]
|
|
15
|
+
],
|
|
16
|
+
mediaBlockTop: [
|
|
17
|
+
[0.5, 0],
|
|
18
|
+
[0, 97]
|
|
19
|
+
]
|
|
20
|
+
}
|
|
15
21
|
|
|
16
|
-
const gradient =
|
|
22
|
+
const gradient = steps[type].map((i) => `rgba(${color}, ${i[0]}) ${i[1]}%`)
|
|
17
23
|
|
|
18
24
|
return `linear-gradient(-180deg, ${gradient})`
|
|
19
25
|
}
|
package/dist/utils/toCamel.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const toCamel: (s: string) => string;
|