-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add file-to-array-buffer to storybook
- Loading branch information
Showing
3 changed files
with
68 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<!--THIS FILE IS AUTO GENERATED. This file is generated from JSDoc comments in app/components/file-to-array-buffer.js. To make changes, first edit that file and run "yarn gen-story-md file-to-array-buffer" to re-generate the content.--> | ||
|
||
## FileToArrayBuffer | ||
`FileToArrayBuffer` is a component that will allow you to pick a file from the local file system. Once | ||
loaded, this file will be emitted as a JS ArrayBuffer to the passed `onChange` callback. | ||
|
||
**Params** | ||
|
||
| Param | Type | Default | Description | | ||
| --- | --- | --- | --- | | ||
| onChange | <code>function</code> | <code></code> | The function to call when the file read is complete. This function recieves the file as a JS ArrayBuffer | | ||
| [label] | <code>String</code> | <code></code> | Text to use as the label for the file input If null, a default will be rendered | | ||
| type | <code>String</code> | <code></code> | Text to use as help under the file input | | ||
|
||
**Example** | ||
|
||
```js | ||
<FileToArrayBuffer @onChange={{action (mut file)}} /> | ||
``` | ||
|
||
**See** | ||
|
||
- [Uses of FileToArrayBuffer](https://github.com/hashicorp/vault/search?l=Handlebars&q=FileToArrayBuffer+OR+file-to-array-buffer) | ||
- [FileToArrayBuffer Source Code](https://github.com/hashicorp/vault/blob/master/ui/app/components/file-to-array-buffer.js) | ||
|
||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
|
||
import hbs from 'htmlbars-inline-precompile'; | ||
import { storiesOf } from '@storybook/ember'; | ||
import notes from './file-to-array-buffer.md'; | ||
|
||
|
||
storiesOf('FileToArrayBuffer/', module) | ||
.addParameters({ options: { showPanel: true } }) | ||
.add(`FileToArrayBuffer`, () => ({ | ||
template: hbs` | ||
<h5 class="title is-5">File To Array Buffer</h5> | ||
<FileToArrayBuffer @onChange={{this.onChange}} /> | ||
{{#if this.fileName}} | ||
{{this.fileName}} as bytes: {{this.fileBytes}} | ||
{{/if}} | ||
`, | ||
context: { | ||
onChange(file, name) { | ||
This comment has been minimized.
Sorry, something went wrong.
andaley
Contributor
|
||
console.log(`${name} contents as an ArrayBuffer:`, file); | ||
}, | ||
}, | ||
}), | ||
{notes} | ||
); |
is
type
used anywhere? i didn't see it in the component source code or infile-to-array-buffer.hbs
either :o