|
1 | 1 | import { Chat, ChatProps } from "../chat"; |
2 | | -import { parseAttributes } from "./attributes"; |
| 2 | +import { BlockAttributes } from "./attributes"; |
3 | 3 |
|
4 | 4 | export interface BlockProps { |
5 | 5 | focusable?: boolean, |
6 | | - attributes: object, |
| 6 | + attributes: BlockAttributes, |
7 | 7 | iframeUrl: URL, |
8 | 8 | } |
9 | 9 |
|
10 | 10 | export function Block(props: BlockProps) { |
11 | | - const attributes = parseAttributes(props.attributes); |
| 11 | + const { focusable, iframeUrl } = props; |
| 12 | + const { |
| 13 | + instanceId, |
| 14 | + defaultHomeserver, |
| 15 | + roomId, |
| 16 | + height, |
| 17 | + borderWidth, |
| 18 | + borderRadius, |
| 19 | + borderStyle, |
| 20 | + borderColor, |
| 21 | + } = props.attributes; |
12 | 22 |
|
13 | 23 | const style = { |
14 | | - height: attributes.height ? attributes.height.toString() : '', |
15 | | - borderWidth: attributes.borderWidth ? attributes.borderWidth.toString() : 0, |
16 | | - borderRadius: attributes.borderRadius ? attributes.borderRadius.toString() : "", |
17 | | - borderStyle: attributes.borderStyle ?? '', |
18 | | - borderColor: attributes.borderColor ?? '', |
| 24 | + height: height ? height.toString() : '', |
| 25 | + borderWidth: borderWidth ? borderWidth.toString() : 0, |
| 26 | + borderRadius: borderRadius ? borderRadius.toString() : "", |
| 27 | + borderStyle: borderStyle ?? '', |
| 28 | + borderColor: borderColor ?? '', |
19 | 29 | }; |
20 | 30 |
|
21 | 31 | const chatProps: ChatProps = { |
22 | | - focusable: props.focusable, |
23 | | - iframeUrl: props.iframeUrl, |
24 | | - defaultHomeserver: attributes.defaultHomeserver, |
25 | | - roomId: attributes.roomId, |
| 32 | + focusable, |
| 33 | + iframeUrl, |
| 34 | + instanceId, |
| 35 | + defaultHomeserver, |
| 36 | + roomId, |
26 | 37 | }; |
27 | 38 |
|
28 | 39 | return ( |
|
0 commit comments