Skip to content

Commit 1b76928

Browse files
authored
Fix: Add missing base css entries needed for preview ui element (#33)
1 parent 8971f17 commit 1b76928

3 files changed

Lines changed: 15 additions & 9 deletions

File tree

README.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
Box UI Elements are pre-built UI components that allow developers to add features of the main Box web application into their own applications. They can be used to navigate through, upload, preview, and select content stored on Box and are available both as React components and framework-agnostic JavaScript libraries.
1010

1111
# Usage
12-
The instructions below describe how to use the UI Elements in a [React](https://facebook.github.io/react) application. If instead you would like to include the framework-agnostic libraries as scripts, refer to our [developer documentation](https://developer.box.com/docs/box-ui-elements). Continue reading below for how to import the UI Elements as React components. You can also reference https://github.com/box/box-ui-elements-demo for a minimal React application using the Explorer UI Element.
12+
The instructions below describe how to use the UI Elements in a [React](https://facebook.github.io/react) application. If instead you would like to include the framework-agnostic libraries as scripts, refer to our [developer documentation](https://developer.box.com/docs/box-ui-elements). Continue reading below for how to import the UI Elements as React components. You can also reference https://github.com/box/box-ui-elements-demo or https://github.com/box/box-content-preview-demo for minimal React applications using the Explorer UI Element and Preview UI Element respectively.
1313

1414
## Installation
1515
`yarn add box-ui-elements` or `npm install box-ui-elements`
@@ -219,12 +219,13 @@ render(
219219

220220
<img src="https://user-images.githubusercontent.com/1075325/27419184-596b485c-56d4-11e7-8d42-c65328089c95.png" width="75%"/>
221221

222-
***The Box Content Preview has a slightly different interface than the other components. Instead of importing localizations like the examples above, it requires a locale (defaults to en-US) to be passed in. This will automatically pull in the corresponding preview bundle and dynamically load it. It will also dynamically load the required CSS file.***
222+
***The Box Content Preview has a slightly different interface than the other components. Instead of importing localizations like in the examples above, it requires a locale (defaults to en-US) to be passed in. This will automatically pull in the corresponding preview bundle and dynamically load it. It will also dynamically load the additional required CSS file needed for preview.***
223223

224224
```js
225225
import React from 'react';
226226
import { render } from 'react-dom';
227227
import { ContentPreview } from 'box-ui-elements';
228+
import 'box-ui-elements/dist/preview.css';
228229

229230
const token = 'ACCESS_TOKEN';
230231
const fileId = 'FILE_ID';
@@ -241,15 +242,17 @@ render(
241242
### Props
242243
| Prop | Type | Default | Description |
243244
| --- | --- | --- | --- |
244-
| token* | string | | *See the [developer docs](https://developer.box.com/docs/box-content-preview#section-initialization-and-options).* |
245+
| token* | string | | *See the [developer docs](https://developer.box.com/docs/box-content-preview#section-options).* |
245246
| fileId* | string | | The id of the file to preview. |
246247
| locale | string | `en-US` | Locale for this component. |
247248
| onLoad | function | | Callback function for when a file preview loads. |
248-
| collection | Array&lt;string&gt; | `[]` | *See the [developer docs](https://developer.box.com/docs/box-content-preview#section-initialization-and-options).* |
249-
| header | string | `light` | *See the [developer docs](https://developer.box.com/docs/box-content-preview#section-initialization-and-options).* |
250-
| logoUrl | string | | *See the [developer docs](https://developer.box.com/docs/box-content-preview#section-initialization-and-options).* |
251-
| sharedLink | string | | *See the [developer docs](https://developer.box.com/docs/box-content-preview#section-initialization-and-options).* |
252-
| sharedLinkPassword | string | | *See the [developer docs](https://developer.box.com/docs/box-content-preview#section-initialization-and-options).* |
249+
| collection | Array&lt;string&gt; | `[]` | *See the [developer docs](https://developer.box.com/docs/box-content-preview#section-options).* |
250+
| showAnnotations | boolean | false | *See the [developer docs](https://developer.box.com/docs/box-content-preview#section-options).* |
251+
| showDownload | boolean | false | *See the [developer docs](https://developer.box.com/docs/box-content-preview#section-options).* |
252+
| header | string | `light` | *See the [developer docs](https://developer.box.com/docs/box-content-preview#section-options).* |
253+
| logoUrl | string | | *See the [developer docs](https://developer.box.com/docs/box-content-preview#section-options).* |
254+
| sharedLink | string | | *See the [developer docs](https://developer.box.com/docs/box-content-preview#section-options).* |
255+
| sharedLinkPassword | string | | *See the [developer docs](https://developer.box.com/docs/box-content-preview#section-options).* |
253256

254257

255258
# Questions

build/webpack.npm.config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ module.exports = {
1212
picker: path.resolve('src/components/ContentPicker/index.js'),
1313
explorer: path.resolve('src/components/ContentExplorer/index.js'),
1414
uploader: path.resolve('src/components/ContentUploader/index.js'),
15-
tree: path.resolve('src/components/ContentTree/index.js')
15+
tree: path.resolve('src/components/ContentTree/index.js'),
16+
preview: path.resolve('src/components/ContentPreview/index.js')
1617
},
1718
output: {
1819
path: path.resolve('dist'),

src/components/ContentPreview/ContentPreview.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ import {
1313
DEFAULT_PREVIEW_VERSION,
1414
DEFAULT_PREVIEW_LOCALE
1515
} from '../../constants';
16+
import '../fonts.scss';
17+
import '../base.scss';
1618

1719
type DefaultProps = {|
1820
apiHost: string,

0 commit comments

Comments
 (0)