react-hooks-giphy
Advanced tools
Comparing version 1.1.3 to 1.2.0
@@ -14,6 +14,12 @@ "use strict"; | ||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } | ||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } | ||
function Giphy(_ref) { | ||
var tag = _ref.tag, | ||
_ref$triggers = _ref.triggers, | ||
triggers = _ref$triggers === void 0 ? [] : _ref$triggers; | ||
triggers = _ref$triggers === void 0 ? [] : _ref$triggers, | ||
config = _objectWithoutProperties(_ref, ["tag", "triggers"]); | ||
var key = "V6AU97qCSCYVmbIC5UDppEiVM1xnuO9E"; | ||
@@ -40,5 +46,6 @@ var giphyUrl = "https://api.giphy.com/v1/gifs/random"; | ||
var title = config.title; | ||
return _react.default.createElement("div", null, loading && _react.default.createElement("p", null, "Loading..."), error && _react.default.createElement("p", null, "Error!"), data && _react.default.createElement("div", { | ||
className: "gif" | ||
}, _react.default.createElement("p", null, data.data.title), _react.default.createElement("img", { | ||
}, title && _react.default.createElement("p", null, data.data.title), _react.default.createElement("img", { | ||
alt: "Gif", | ||
@@ -45,0 +52,0 @@ src: data.data.image_original_url |
{ | ||
"name": "react-hooks-giphy", | ||
"version": "1.1.3", | ||
"version": "1.2.0", | ||
"description": "React component for displaying Gif using Giphy API", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -45,3 +45,3 @@ # react-hooks-giphy | ||
### Demo | ||
## Demo | ||
@@ -58,3 +58,3 @@ [Live Show](https://codesandbox.io/s/v8k2yw0pz0) | ||
### Get Random Gif | ||
### Get random gif | ||
@@ -65,3 +65,3 @@ ```js | ||
### Get Gif with a `Tag` | ||
### Get gif with a `tag` | ||
@@ -72,3 +72,3 @@ ```js | ||
### Pass in `triggers` to refresh with a new Gif | ||
### Pass in `triggers` to refresh with a new gif | ||
@@ -79,2 +79,13 @@ ```js | ||
## Configuring Options | ||
### Show gif title | ||
```js | ||
const config = { | ||
title: true | ||
}; | ||
<Giphy {...config} />; | ||
``` | ||
## Example | ||
@@ -81,0 +92,0 @@ |
9485
110
140