This repository has been archived by the owner on Jul 26, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
component-blocks.tsx
62 lines (60 loc) · 1.62 KB
/
component-blocks.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import React from 'react';
import { NotEditable, component, fields } from '@keystone-next/fields-document/component-blocks';
import ReactPlayer from "react-player"
// naming the export componentBlocks is important because the Admin UI
// expects to find the components like on the componentBlocks export
export const componentBlocks = {
quote: component({
component: ({ attribution, content }) => {
return (
<div
style={{
borderLeft: '3px solid #CBD5E0',
paddingLeft: 16,
}}
>
<div style={{ fontStyle: 'italic', color: '#4A5568' }}>{content}</div>
<div style={{ fontWeight: 'bold', color: '#718096' }}>
<NotEditable>— </NotEditable>
{attribution}
</div>
</div>
);
},
label: 'Quote',
props: {
content: fields.child({
kind: 'block',
placeholder: 'Quote...',
formatting: { inlineMarks: 'inherit', softBreaks: 'inherit' },
links: 'inherit',
}),
attribution: fields.child({ kind: 'inline', placeholder: 'Attribution...' }),
},
chromeless: true,
}),
video: component({
component: props => {
return (
<div
contentEditable={false}
style={{
padding: '0 0 0 0',
position: 'relative',
userSelect: "none",
}} >
<ReactPlayer
url={props.url.value}
/>
</div>
)
},
label: "Video",
props: {
url: fields.url({
label: 'Video URL',
defaultValue: 'https://www.youtube.com/'
})
},
})
};