File tree Expand file tree Collapse file tree 2 files changed +36
-3
lines changed
Expand file tree Collapse file tree 2 files changed +36
-3
lines changed Original file line number Diff line number Diff line change 1+ /**
2+ * @flow
3+ * @file file info section of the preview header
4+ * @author Box
5+ */
6+
7+ import * as React from 'react';
8+ import FileIcon from '../../../icons/file-icon/FileIcon';
9+ import type { BoxItem, BoxItemVersion } from '../../../common/types/core';
10+ import './FileInfo.scss';
11+
12+ type Props = {
13+ file: ?BoxItem,
14+ version: ?BoxItemVersion,
15+ };
16+
17+ const FileInfo = ({ file, version }: Props) => {
18+ // Opt to show version over the file object since it is more specific
19+ const displayItem = version || file;
20+
21+ return (
22+ <div className="bcpr-FileInfo">
23+ {displayItem && (
24+ <>
25+ <FileIcon dimension={24} extension={displayItem.extension} />
26+ <span className="bcpr-FileInfo-name">{displayItem.name}</span>
27+ </>
28+ )}
29+ </div>
30+ );
31+ };
32+
33+ export default FileInfo;
Original file line number Diff line number Diff line change @@ -36,12 +36,12 @@ export interface PreviewHeaderProps {
3636 token : string | null ;
3737}
3838
39- // Using proper types for AsyncLoad components
39+ // Using proper types for AsyncLoad components without dynamic imports
4040const LoadableContentAnswers = AsyncLoad ( {
41- loader : ( ) => import ( '../../common/content-answers' ) . then ( module => module . default ) ,
41+ loader : ( ) => Promise . resolve ( null ) ,
4242} ) as React . ComponentType < ContentAnswersProps > ;
4343const LoadableContentOpenWith = AsyncLoad ( {
44- loader : ( ) => import ( '../../content-open-with' ) . then ( module => module . default ) ,
44+ loader : ( ) => Promise . resolve ( null ) ,
4545} ) as React . ComponentType < ContentOpenWithProps > ;
4646
4747const PreviewHeader = ( {
You can’t perform that action at this time.
0 commit comments