Type to search GIFs
+-
+ {results.data.map((gif) => {
+ const { id, images, title, alt_text } = gif;
+ const {
+ fixed_height_small,
+ fixed_height_downsampled,
+ fixed_height,
+ original,
+ } = images;
+ const theImage = fixed_height_small?.url
+ ? fixed_height_small
+ : fixed_height_downsampled?.url
+ ? fixed_height_downsampled
+ : fixed_height;
+ let { url, webp, width, height } = theImage;
+ if (+height > 100) {
+ width = (width / height) * 100;
+ height = 100;
+ }
+ const urlObj = new URL(url);
+ const strippedURL = urlObj.origin + urlObj.pathname;
+ let strippedWebP;
+ if (webp) {
+ const webpObj = new URL(webp);
+ strippedWebP = webpObj.origin + webpObj.pathname;
+ }
+ return (
+
-
+
{ + const { mp4, url } = original; + const theURL = mp4 || url; + const urlObj = new URL(theURL); + const strippedURL = urlObj.origin + urlObj.pathname; + onClose(); + onSelect({ + url: strippedURL, + type: mp4 ? 'video/mp4' : 'image/gif', + alt_text: alt_text || title, + }); + }} + > + + +
+ );
+ })}
+
+ {results.pagination?.offset > 0 && (
+
No results
+Error loading GIFs
+