-
Notifications
You must be signed in to change notification settings - Fork 345
Expand file tree
/
Copy pathContentSharing.js
More file actions
40 lines (36 loc) · 1.18 KB
/
ContentSharing.js
File metadata and controls
40 lines (36 loc) · 1.18 KB
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
/**
* @flow
* @file Base class for the Content Sharing ES6 wrapper
* @author Box
*/
import * as React from 'react';
import uniqueId from 'lodash/uniqueId';
import { createRoot } from 'react-dom/client';
import ES6Wrapper from './ES6Wrapper';
import ContentSharingReactComponent from '../content-sharing';
import { ITEM_TYPE_FILE } from '../../common/constants';
import type { ItemType } from '../../common/types/core';
class ContentSharing extends ES6Wrapper {
/** @inheritdoc */
render() {
const { itemType }: { itemType?: ItemType } = this.options;
if (!this.root) {
this.root = createRoot(this.container);
}
this.root.render(
<ContentSharingReactComponent
enableModernizedComponents={true}
itemID={this.id}
itemType={itemType || ITEM_TYPE_FILE}
language={this.language}
messages={this.messages}
token={this.token}
uuid={uniqueId('contentSharing_')}
{...this.options}
/>,
);
}
}
global.Box = global.Box || {};
global.Box.ContentSharing = ContentSharing;
export default ContentSharing;