Skip to content

Commit 28764ae

Browse files
committed
fix: address comments
1 parent eadbc19 commit 28764ae

File tree

6 files changed

+43
-62
lines changed

6 files changed

+43
-62
lines changed

src/elements/content-sharing/ContentSharing.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,49 +16,49 @@ import SharingModal from './SharingModal';
1616
// $FlowFixMe
1717
import { ContentSharingV2 } from './ContentSharingV2';
1818
import { CLIENT_NAME_CONTENT_SHARING, CLIENT_VERSION, DEFAULT_HOSTNAME_API } from '../../constants';
19-
import type { ItemType, StringMap } from '../../common/types/core';
2019

20+
import type { ItemType, StringMap } from '../../common/types/core';
2121
import type { USMConfig } from '../../features/unified-share-modal/flowTypes';
2222
import type { FeatureConfig } from '../common/feature-checking';
2323

2424
import '../common/base.scss';
2525
import '../common/fonts.scss';
2626
import '../common/modal.scss';
2727

28-
type ContentSharingProps = {
28+
interface ContentSharingProps {
2929
/** apiHost - API hostname. Defaults to https://api.box.com */
30-
apiHost: string,
30+
apiHost: string;
3131
/** children - Children for the element to open the Unified Share Modal */
32-
children?: React.Element<any>,
32+
children?: React.Element<any>;
3333
/** config - Configuration object that shows/hides features in the USM */
34-
config?: USMConfig,
34+
config?: USMConfig;
3535
/**
3636
* customButton - Clickable element for opening the SharingModal component.
3737
* This property should always be used in conjunction with displayInModal.
3838
*/
39-
customButton?: React.Element<any>,
39+
customButton?: React.Element<any>;
4040
/**
4141
* displayInModal - Whether the SharingModal component should be displayed in a modal.
4242
* If false, the SharingModal component will appear as a form within the surrounding page.
4343
* This property can be used with or without a customButton. If used without a customButton,
4444
* the modal will appear on page load. See ContentSharing.stories.js for examples.
4545
*/
46-
displayInModal: boolean,
46+
displayInModal: boolean;
4747
/** features - Features for the element */
48-
features?: FeatureConfig,
48+
features?: FeatureConfig;
4949
/** itemID - Box file or folder ID */
50-
itemID: string,
50+
itemID: string;
5151
/** itemType - "file" or "folder" */
52-
itemType: ItemType,
52+
itemType: ItemType;
5353
/** language - Language used for the element */
54-
language: string,
54+
language: string;
5555
/** messages - Localized strings used by the element */
56-
messages?: StringMap,
56+
messages?: StringMap;
5757
/** token - Valid access token */
58-
token: string,
58+
token: string;
5959
/** uuid - Unique identifier, used for refreshing element visibility when called from the ES6 wrapper */
60-
uuid?: string,
61-
};
60+
uuid?: string;
61+
}
6262

6363
const createAPI = (apiHost, itemID, itemType, token) =>
6464
new API({

src/elements/content-sharing/ContentSharingV2.tsx

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,20 @@ import { UnifiedShareModal } from '@box/unified-share-modal';
55
import Internationalize from '../common/Internationalize';
66
import Providers from '../common/Providers';
77

8-
import type { ContentSharingV2Props } from './types';
8+
import type { ItemType, StringMap } from '../../common/types/core';
9+
10+
interface ContentSharingV2Props {
11+
/** children - Children for the element to open the Unified Share Modal */
12+
children?: React.ReactElement;
13+
/** itemID - Box file or folder ID */
14+
itemID: string;
15+
/** itemType - "file" or "folder" */
16+
itemType: ItemType;
17+
/** language - Language used for the element */
18+
language: string;
19+
/** messages - Localized strings used by the element */
20+
messages?: StringMap;
21+
}
922

1023
function ContentSharingV2({ children, itemID, itemType, language, messages }: ContentSharingV2Props) {
1124
// Retrieve item from API later

src/elements/content-sharing/stories/ContentSharing.stories.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,16 @@ export const withCustomButton = {
1313
},
1414
};
1515

16+
export const withContentSharingV2Enabled = {
17+
args: {
18+
children: <button>Open Unified Share Modal</button>,
19+
features: {
20+
...global.FEATURE_FLAGS,
21+
contentSharingV2: true,
22+
},
23+
},
24+
};
25+
1626
export default {
1727
title: 'Elements/ContentSharing',
1828
component: ContentSharing,
@@ -31,13 +41,3 @@ export default {
3141
},
3242
},
3343
};
34-
35-
export const ContentSharingV2Enabled: StoryObj = {
36-
args: {
37-
children: <button>Open Unified Share Modal</button>,
38-
features: {
39-
...global.FEATURE_FLAGS,
40-
contentSharingV2: true,
41-
},
42-
},
43-
};

src/elements/content-sharing/stories/ContentSharingV2.stories.tsx

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { DEFAULT_HOSTNAME_API, TYPE_FILE, TYPE_FOLDER } from '../../../constants';
1+
import * as React from 'react';
2+
import { TYPE_FILE, TYPE_FOLDER } from '../../../constants';
23
import { ContentSharingV2 } from '../ContentSharingV2';
34

45
export const Basic = {};
@@ -7,19 +8,10 @@ export default {
78
title: 'Elements/ContentSharingV2',
89
component: ContentSharingV2,
910
args: {
10-
apiHost: DEFAULT_HOSTNAME_API,
11+
children: <button>Open Unified Share Modal</button>,
1112
features: global.FEATURE_FLAGS,
12-
hasProviders: true,
13-
language: 'en',
1413
itemType: TYPE_FILE,
1514
itemID: global.FILE_ID,
16-
messages: {
17-
en: {
18-
contentSharingV2: 'Content Sharing V2',
19-
},
20-
},
21-
token: global.TOKEN,
22-
theme: 'light',
2315
},
2416
argTypes: {
2517
itemType: {

src/elements/content-sharing/stories/tests/ContentSharingV2-visual.stories.tsx

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,13 @@
1-
import { DEFAULT_HOSTNAME_API, TYPE_FILE } from '../../../../constants';
1+
import { TYPE_FILE } from '../../../../constants';
22
import { ContentSharingV2 } from '../../ContentSharingV2';
33

44
export default {
55
title: 'Elements/ContentSharingV2/tests/visual-regression-tests',
66
component: ContentSharingV2,
77
args: {
8-
apiHost: DEFAULT_HOSTNAME_API,
98
features: global.FEATURE_FLAGS,
10-
hasProviders: true,
11-
language: 'en',
129
itemType: TYPE_FILE,
1310
itemID: global.FILE_ID,
14-
messages: {
15-
en: {
16-
contentSharingV2: 'Content Sharing V2',
17-
},
18-
},
19-
token: global.TOKEN,
20-
theme: 'light',
2111
},
2212
};
2313

src/elements/content-sharing/types.ts

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)