react-media-library
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -46,4 +46,3 @@ import React, { useState } from "react"; | ||
.map((element, index) => { | ||
return (React.createElement(Col, { key: index, xs: 12, sm: 6, md: 4, lg: 3, className: "mb-3" }, | ||
React.createElement(FileLibraryCard, Object.assign({ cardClickCallback: (item) => setSelectedItem(item), selectedItem: selectedItem }, element)))); | ||
return (React.createElement(Col, { key: index, xs: 12, sm: 6, md: 4, lg: 3, className: "mb-3", onClick: () => setSelectedItem(element) }, React.createElement(props.libraryCardComponent, Object.assign({ selectedItem }, element)))); | ||
}); | ||
@@ -69,4 +68,5 @@ } | ||
sortAscending: false, | ||
libraryCardComponent: FileLibraryCard, | ||
}; | ||
export default FileLibrary; | ||
//# sourceMappingURL=FileLibrary.js.map |
@@ -14,3 +14,3 @@ import React from "react"; | ||
const FileLibraryCard = (props) => { | ||
return (React.createElement(Card, { onClick: () => props.cardClickCallback(props), bg: (props.selectedItem !== undefined && props.selectedItem._id === props._id) ? "primary" : undefined }, | ||
return (React.createElement(Card, { bg: (props.selectedItem !== undefined && props.selectedItem._id === props._id) ? "primary" : undefined }, | ||
(props.thumbnailUrl) && (React.createElement(Card.Img, { variant: "top", src: props.thumbnailUrl, style: imgStyle })), | ||
@@ -17,0 +17,0 @@ (props.title || props.description) && (React.createElement(Card.Body, null, |
@@ -9,3 +9,3 @@ import * as React from "react"; | ||
React.createElement(Modal.Body, null, | ||
React.createElement(ReactMediaLibraryTabs, { fileLibraryList: props.fileLibraryList, fileUploadCallback: props.fileUploadCallback, fileSelectCallback: props.fileSelectCallback, fileDeleteCallback: props.fileDeleteCallback })))); | ||
React.createElement(ReactMediaLibraryTabs, { fileLibraryList: props.fileLibraryList, fileUploadCallback: props.fileUploadCallback, fileSelectCallback: props.fileSelectCallback, fileDeleteCallback: props.fileDeleteCallback, libraryCardComponent: props.libraryCardComponent })))); | ||
}; | ||
@@ -12,0 +12,0 @@ ReactMediaLibrary.defaultProps = { |
@@ -12,5 +12,5 @@ import * as React from "react"; | ||
(props.fileLibraryList.length > 0) && (React.createElement(Tab, { eventKey: "library", title: "Library" }, | ||
React.createElement(FileLibrary, { fileLibraryList: props.fileLibraryList, fileSelectCallback: props.fileSelectCallback, fileDeleteCallback: props.fileDeleteCallback }))))); | ||
React.createElement(FileLibrary, { fileLibraryList: props.fileLibraryList, fileSelectCallback: props.fileSelectCallback, fileDeleteCallback: props.fileDeleteCallback, libraryCardComponent: props.libraryCardComponent }))))); | ||
}; | ||
export default ReactMediaLibraryTabs; | ||
//# sourceMappingURL=ReactMediaLibraryTabs.js.map |
{ | ||
"name": "react-media-library", | ||
"version": "1.0.0", | ||
"description": "React Media Library is a UI package similar to the WordPress' media library, but for React. It features file drag-and-drop as well as a library to select previously uploaded files.", | ||
"version": "1.0.1", | ||
"description": "React Media Library is a UI package similar to the WordPress media library, but for React. It features file drag-and-drop as well as a library to select previously uploaded files.", | ||
"homepage": "https://github.com/Richard1320/React-Media-Library#readme", | ||
"main": "build/index.js", | ||
@@ -11,2 +12,12 @@ "types": "types/index.d.ts", | ||
}, | ||
"keywords": [ | ||
"react", | ||
"reactjs", | ||
"react-dom", | ||
"react-bootstrap", | ||
"drag-and-drop", | ||
"filemanager", | ||
"file-manager", | ||
"file-manager-ui" | ||
], | ||
"scripts": { | ||
@@ -18,4 +29,4 @@ "dev": "tsc -w", | ||
}, | ||
"author": "", | ||
"license": "UNLICENSED", | ||
"author": "Richard Hung <richardhung111@gmail.com> (http://www.magicmediamuse.com)", | ||
"license": "MIT", | ||
"devDependencies": { | ||
@@ -47,3 +58,7 @@ "@types/chai": "^4.2.2", | ||
"react-dom": "^16.X.X" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/Richard1320/React-Media-Library/issues", | ||
"email": "richardhung111@gmail.com" | ||
} | ||
} |
@@ -9,2 +9,17 @@ # React Media Library | ||
## Table of Contents | ||
- [Installation](#installation) | ||
- [Component](#component) | ||
- [Props List](#props-list) | ||
- [Functions](#functions) | ||
- [fileUploadCallback](#fileuploadcallback) | ||
- [fileSelectCallback](#fileselectcallback) | ||
- [fileDeleteCallback](#filedeletecallback) | ||
- [Interfaces](#interfaces) | ||
- [FileMeta](#filemeta) | ||
- [FileLibraryListItem](#FileLibraryListItem) | ||
- [Example](#example) | ||
- [Screenshots](#screenshots) | ||
## Installation | ||
@@ -30,2 +45,3 @@ | ||
fileLibraryList | array | `[]` | Array of files to display in the library tab. Each item in the array has to be of type [FileLibraryListItem](#filelibrarylistitem). | ||
libraryCardComponent | React.FC | [FileLibraryCard](src/components/FileLibraryCard.tsx) | Custom rendering component for the card in the library tab. See [FileLibraryCard](src/components/FileLibraryCard.tsx) as an example. | ||
sortProperty | "title", "createdAt", "size" or "fileName" | "createdAt" | Sorting property for files in the library. | ||
@@ -87,4 +103,4 @@ sortAscending | boolean | false | Sort direction | ||
fileName | string | Filename of uploaded file. | ||
type | string | The ASCII-encoded string in lower case representing the media type. See [File API Size](https://www.w3.org/TR/FileAPI/#dfn-size) | ||
size | number | The size of the byte sequence in number of bytes. See [File API Type](https://www.w3.org/TR/FileAPI/#dfn-type) | ||
type | string | The ASCII-encoded string in lower case representing the media type. See [File API Type](https://www.w3.org/TR/FileAPI/#dfn-type) | ||
size | number | The size of the byte sequence in number of bytes. See [File API Size](https://www.w3.org/TR/FileAPI/#dfn-size) | ||
@@ -212,1 +228,7 @@ ### FileLibraryListItem | ||
``` | ||
## Screenshots | ||
![Upload Tab](docs/images/screenshot-upload.jpg) | ||
![Library Tab](docs/images/screenshot-library.jpg) |
@@ -0,1 +1,3 @@ | ||
import React from "react"; | ||
export interface FileLibraryListItem { | ||
@@ -9,2 +11,3 @@ _id: string | number; | ||
fileName?: string; | ||
[key: string]: any; | ||
@@ -19,2 +22,3 @@ } | ||
fileDeleteCallback?: (item: FileLibraryListItem) => void; | ||
libraryCardComponent?: React.FC<any>; | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Misc. License Issues
License(Experimental) A package's licensing information has fine-grained problems.
Found 1 instance in 1 package
No contributors or author data
MaintenancePackage does not specify a list of contributors or an author in package.json.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
268467
44
0
722
0
0
231