@dhaiwat10/react-link-preview
Advanced tools
Comparing version 1.4.0 to 1.5.0
@@ -1,2 +0,2 @@ | ||
import e from"axios";import n,{useRef as t,useState as o,useEffect as r}from"react";!function(e,n){void 0===n&&(n={});var t=n.insertAt;if(e&&"undefined"!=typeof document){var o=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css","top"===t&&o.firstChild?o.insertBefore(r,o.firstChild):o.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}}("/* common */\n.Container {\n text-align: left;\n background-color: white;\n display: flex;\n flex-direction: column;\n border-radius: 7px;\n border: 1px solid #ccc;\n color: black;\n transition: 0.3s all ease;\n height: fit-content; }\n .Container:hover {\n background-color: #f7f7f7;\n cursor: pointer; }\n\n.Secondary {\n color: #646464; }\n\n.LowerContainer {\n padding: 10px; }\n\n.Title {\n margin-top: 0;\n margin-bottom: 10px; }\n\n.Image {\n width: 100%;\n border-top-left-radius: 7px;\n border-top-right-radius: 7px;\n background-size: cover;\n background-repeat: no-repeat;\n height: 30vh; }\n\n.SiteDetails {\n margin-top: 10px; }\n\n/* sm */\n@media (max-width: 640px) {\n .Description {\n display: none; } }\n\n/* md */\n@media (min-width: 641px) and (max-width: 768px) {\n .Description {\n display: none; } }\n");var a=function(a){var i=a.url,l=a.className,c=void 0===l?"":l,d=a.width,s=a.height,m=a.descriptionLength,p=a.borderRadius,u=a.imageHeight,h=a.textAlign,g=a.margin,f=a.fallback,x=void 0===f?null:f,b=a.backgroundColor,v=void 0===b?"white":b,y=a.primaryTextColor,C=void 0===y?"black":y,k=a.secondaryTextColor,w=void 0===k?"rgb(100, 100, 100)":k,E=a.borderColor,N=void 0===E?"#ccc":E,T=t(!0),S=o(),R=S[0],D=S[1];if(r((function(){return e.get("https://rlp-proxy.herokuapp.com/v2?url="+i).then((function(e){console.log(e),T.current&&D(e.data.metadata)})).catch((function(e){console.error(e),console.error("No metadata could be found for the given URL."),T.current&&D(null)})),function(){T.current=!1}}),[i]),!R)return n.createElement(n.Fragment,null,x);var L=R.image,A=R.description,I=R.title,B=R.siteName,z=R.hostname;return n.createElement("div",{onClick:function(){window.open(i,"_blank")},className:"Container "+c,style:{width:d,height:s,borderRadius:p,textAlign:h,margin:g,backgroundColor:v,borderColor:N}},L&&n.createElement("div",{style:{borderTopLeftRadius:p,borderTopRightRadius:p,backgroundImage:"url("+L+")",height:u},className:"Image"}),n.createElement("div",{className:"LowerContainer"},n.createElement("h3",{className:"Title",style:{color:C}},I),A&&n.createElement("span",{className:"Description Secondary",style:{color:w}},m&&A.length>m?A.slice(0,m)+"...":A),n.createElement("div",{className:"Secondary SiteDetails",style:{color:w}},B&&n.createElement("span",null,B," • "),n.createElement("span",null,z))))};export{a as LinkPreview}; | ||
import e from"axios";import n,{useRef as t,useState as r,useEffect as o}from"react";import i from"react-loading-skeleton";function a(e,n){void 0===n&&(n={});var t=n.insertAt;if(e&&"undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===t&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}a("/* common */\n.Container {\n text-align: left;\n background-color: white;\n display: flex;\n flex-direction: column;\n border-radius: 7px;\n border: 1px solid #ccc;\n color: black;\n transition: 0.3s all ease;\n height: fit-content; }\n .Container:hover {\n background-color: #f7f7f7;\n cursor: pointer; }\n\n.Secondary {\n color: #646464; }\n\n.LowerContainer {\n padding: 10px; }\n\n.Title {\n margin-top: 0;\n margin-bottom: 10px; }\n\n.Image {\n width: 100%;\n border-top-left-radius: 7px;\n border-top-right-radius: 7px;\n background-size: cover;\n background-repeat: no-repeat;\n height: 30vh; }\n\n.SiteDetails {\n margin-top: 10px; }\n\n/* sm */\n@media (max-width: 640px) {\n .Description {\n display: none; } }\n\n/* md */\n@media (min-width: 641px) and (max-width: 768px) {\n .Description {\n display: none; } }\n");a(".skeleton-container {\n border-radius: 7px;\n border: 1px solid #eee; }\n\n.skeleton-lower-container {\n padding: 10px; }\n");var l=function(e){var t=e.width,r=void 0===t?"100%":t,o=e.imageHeight,a=void 0===o?"30vh":o;return n.createElement("div",{className:"skeleton-container",style:{width:r}},n.createElement(i,{width:r,height:a}),n.createElement("div",{className:"skeleton-lower-container"},n.createElement(i,{count:3})))},c=function(i){var a=i.url,c=i.className,d=void 0===c?"":c,s=i.width,m=i.height,p=i.descriptionLength,u=i.borderRadius,h=i.imageHeight,g=i.textAlign,f=i.margin,x=i.fallback,v=void 0===x?null:x,b=i.backgroundColor,y=void 0===b?"white":b,k=i.primaryTextColor,w=void 0===k?"black":k,C=i.secondaryTextColor,E=void 0===C?"rgb(100, 100, 100)":C,N=i.borderColor,T=void 0===N?"#ccc":N,S=t(!0),R=r(),D=R[0],L=R[1],A=r(!0),H=A[0],I=A[1];if(o((function(){return I(!0),e.get("https://rlp-proxy.herokuapp.com/v2?url="+a).then((function(e){console.log(e),S.current&&(L(e.data.metadata),I(!1))})).catch((function(e){console.error(e),console.error("No metadata could be found for the given URL."),S.current&&(L(null),I(!1))})),function(){S.current=!1}}),[a]),H)return n.createElement(l,{width:s,imageHeight:h});if(!D)return n.createElement(n.Fragment,null,v);var B=D.image,z=D.description,F=D.title,U=D.siteName,_=D.hostname;return n.createElement("div",{onClick:function(){window.open(a,"_blank")},className:"Container "+d,style:{width:s,height:m,borderRadius:u,textAlign:g,margin:f,backgroundColor:y,borderColor:T}},B&&n.createElement("div",{style:{borderTopLeftRadius:u,borderTopRightRadius:u,backgroundImage:"url("+B+")",height:h},className:"Image"}),n.createElement("div",{className:"LowerContainer"},n.createElement("h3",{className:"Title",style:{color:w}},F),z&&n.createElement("span",{className:"Description Secondary",style:{color:E}},p&&z.length>p?z.slice(0,p)+"...":z),n.createElement("div",{className:"Secondary SiteDetails",style:{color:E}},U&&n.createElement("span",null,U," • "),n.createElement("span",null,_))))};export{c as LinkPreview}; | ||
//# sourceMappingURL=index.esm.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("axios"),t=require("react");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=n(e),o=n(t);!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===n&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}("/* common */\n.Container {\n text-align: left;\n background-color: white;\n display: flex;\n flex-direction: column;\n border-radius: 7px;\n border: 1px solid #ccc;\n color: black;\n transition: 0.3s all ease;\n height: fit-content; }\n .Container:hover {\n background-color: #f7f7f7;\n cursor: pointer; }\n\n.Secondary {\n color: #646464; }\n\n.LowerContainer {\n padding: 10px; }\n\n.Title {\n margin-top: 0;\n margin-bottom: 10px; }\n\n.Image {\n width: 100%;\n border-top-left-radius: 7px;\n border-top-right-radius: 7px;\n background-size: cover;\n background-repeat: no-repeat;\n height: 30vh; }\n\n.SiteDetails {\n margin-top: 10px; }\n\n/* sm */\n@media (max-width: 640px) {\n .Description {\n display: none; } }\n\n/* md */\n@media (min-width: 641px) and (max-width: 768px) {\n .Description {\n display: none; } }\n");exports.LinkPreview=function(e){var n=e.url,a=e.className,i=void 0===a?"":a,l=e.width,d=e.height,c=e.descriptionLength,s=e.borderRadius,u=e.imageHeight,m=e.textAlign,p=e.margin,f=e.fallback,h=void 0===f?null:f,g=e.backgroundColor,b=void 0===g?"white":g,x=e.primaryTextColor,v=void 0===x?"black":x,y=e.secondaryTextColor,C=void 0===y?"rgb(100, 100, 100)":y,k=e.borderColor,w=void 0===k?"#ccc":k,E=t.useRef(!0),N=t.useState(),T=N[0],S=N[1];if(t.useEffect((function(){return r.default.get("https://rlp-proxy.herokuapp.com/v2?url="+n).then((function(e){console.log(e),E.current&&S(e.data.metadata)})).catch((function(e){console.error(e),console.error("No metadata could be found for the given URL."),E.current&&S(null)})),function(){E.current=!1}}),[n]),!T)return o.default.createElement(o.default.Fragment,null,h);var R=T.image,L=T.description,D=T.title,A=T.siteName,I=T.hostname;return o.default.createElement("div",{onClick:function(){window.open(n,"_blank")},className:"Container "+i,style:{width:l,height:d,borderRadius:s,textAlign:m,margin:p,backgroundColor:b,borderColor:w}},R&&o.default.createElement("div",{style:{borderTopLeftRadius:s,borderTopRightRadius:s,backgroundImage:"url("+R+")",height:u},className:"Image"}),o.default.createElement("div",{className:"LowerContainer"},o.default.createElement("h3",{className:"Title",style:{color:v}},D),L&&o.default.createElement("span",{className:"Description Secondary",style:{color:C}},c&&L.length>c?L.slice(0,c)+"...":L),o.default.createElement("div",{className:"Secondary SiteDetails",style:{color:C}},A&&o.default.createElement("span",null,A," • "),o.default.createElement("span",null,I))))}; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("axios"),t=require("react"),n=require("react-loading-skeleton");function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=r(e),o=r(t),i=r(n);function l(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],a=document.createElement("style");a.type="text/css","top"===n&&r.firstChild?r.insertBefore(a,r.firstChild):r.appendChild(a),a.styleSheet?a.styleSheet.cssText=e:a.appendChild(document.createTextNode(e))}}l("/* common */\n.Container {\n text-align: left;\n background-color: white;\n display: flex;\n flex-direction: column;\n border-radius: 7px;\n border: 1px solid #ccc;\n color: black;\n transition: 0.3s all ease;\n height: fit-content; }\n .Container:hover {\n background-color: #f7f7f7;\n cursor: pointer; }\n\n.Secondary {\n color: #646464; }\n\n.LowerContainer {\n padding: 10px; }\n\n.Title {\n margin-top: 0;\n margin-bottom: 10px; }\n\n.Image {\n width: 100%;\n border-top-left-radius: 7px;\n border-top-right-radius: 7px;\n background-size: cover;\n background-repeat: no-repeat;\n height: 30vh; }\n\n.SiteDetails {\n margin-top: 10px; }\n\n/* sm */\n@media (max-width: 640px) {\n .Description {\n display: none; } }\n\n/* md */\n@media (min-width: 641px) and (max-width: 768px) {\n .Description {\n display: none; } }\n");l(".skeleton-container {\n border-radius: 7px;\n border: 1px solid #eee; }\n\n.skeleton-lower-container {\n padding: 10px; }\n");var d=function(e){var t=e.width,n=void 0===t?"100%":t,r=e.imageHeight,a=void 0===r?"30vh":r;return o.default.createElement("div",{className:"skeleton-container",style:{width:n}},o.default.createElement(i.default,{width:n,height:a}),o.default.createElement("div",{className:"skeleton-lower-container"},o.default.createElement(i.default,{count:3})))};exports.LinkPreview=function(e){var n=e.url,r=e.className,i=void 0===r?"":r,l=e.width,c=e.height,s=e.descriptionLength,u=e.borderRadius,m=e.imageHeight,f=e.textAlign,p=e.margin,h=e.fallback,g=void 0===h?null:h,v=e.backgroundColor,x=void 0===v?"white":v,b=e.primaryTextColor,y=void 0===b?"black":b,k=e.secondaryTextColor,w=void 0===k?"rgb(100, 100, 100)":k,E=e.borderColor,C=void 0===E?"#ccc":E,N=t.useRef(!0),S=t.useState(),T=S[0],R=S[1],L=t.useState(!0),D=L[0],q=L[1];if(t.useEffect((function(){return q(!0),a.default.get("https://rlp-proxy.herokuapp.com/v2?url="+n).then((function(e){console.log(e),N.current&&(R(e.data.metadata),q(!1))})).catch((function(e){console.error(e),console.error("No metadata could be found for the given URL."),N.current&&(R(null),q(!1))})),function(){N.current=!1}}),[n]),D)return o.default.createElement(d,{width:l,imageHeight:m});if(!T)return o.default.createElement(o.default.Fragment,null,g);var A=T.image,H=T.description,I=T.title,_=T.siteName,j=T.hostname;return o.default.createElement("div",{onClick:function(){window.open(n,"_blank")},className:"Container "+i,style:{width:l,height:c,borderRadius:u,textAlign:f,margin:p,backgroundColor:x,borderColor:C}},A&&o.default.createElement("div",{style:{borderTopLeftRadius:u,borderTopRightRadius:u,backgroundImage:"url("+A+")",height:m},className:"Image"}),o.default.createElement("div",{className:"LowerContainer"},o.default.createElement("h3",{className:"Title",style:{color:y}},I),H&&o.default.createElement("span",{className:"Description Secondary",style:{color:w}},s&&H.length>s?H.slice(0,s)+"...":H),o.default.createElement("div",{className:"Secondary SiteDetails",style:{color:w}},_&&o.default.createElement("span",null,_," • "),o.default.createElement("span",null,j))))}; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@dhaiwat10/react-link-preview", | ||
"license": "MIT", | ||
"version": "1.4.0", | ||
"version": "1.5.0", | ||
"private": false, | ||
@@ -27,3 +27,4 @@ "description": "React library to preview links.", | ||
"dependencies": { | ||
"axios": "^0.21.1" | ||
"axios": "^0.21.1", | ||
"react-loading-skeleton": "^2.2.0" | ||
}, | ||
@@ -30,0 +31,0 @@ "peerDependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
26952
12
66
4
+ Added@babel/code-frame@7.26.2(transitive)
+ Added@babel/generator@7.26.9(transitive)
+ Added@babel/helper-module-imports@7.25.9(transitive)
+ Added@babel/helper-string-parser@7.25.9(transitive)
+ Added@babel/helper-validator-identifier@7.25.9(transitive)
+ Added@babel/parser@7.26.9(transitive)
+ Added@babel/runtime@7.26.9(transitive)
+ Added@babel/template@7.26.9(transitive)
+ Added@babel/traverse@7.26.9(transitive)
+ Added@babel/types@7.26.9(transitive)
+ Added@emotion/cache@10.0.29(transitive)
+ Added@emotion/core@10.3.1(transitive)
+ Added@emotion/css@10.0.27(transitive)
+ Added@emotion/hash@0.8.0(transitive)
+ Added@emotion/memoize@0.7.4(transitive)
+ Added@emotion/serialize@0.11.16(transitive)
+ Added@emotion/sheet@0.9.4(transitive)
+ Added@emotion/stylis@0.8.5(transitive)
+ Added@emotion/unitless@0.7.5(transitive)
+ Added@emotion/utils@0.11.3(transitive)
+ Added@emotion/weak-memoize@0.2.5(transitive)
+ Added@jridgewell/gen-mapping@0.3.8(transitive)
+ Added@jridgewell/resolve-uri@3.1.2(transitive)
+ Added@jridgewell/set-array@1.2.1(transitive)
+ Added@jridgewell/sourcemap-codec@1.5.0(transitive)
+ Added@jridgewell/trace-mapping@0.3.25(transitive)
+ Added@types/parse-json@4.0.2(transitive)
+ Addedbabel-plugin-emotion@10.2.2(transitive)
+ Addedbabel-plugin-macros@2.8.0(transitive)
+ Addedbabel-plugin-syntax-jsx@6.18.0(transitive)
+ Addedcallsites@3.1.0(transitive)
+ Addedconvert-source-map@1.9.0(transitive)
+ Addedcosmiconfig@6.0.0(transitive)
+ Addedcsstype@2.6.21(transitive)
+ Addeddebug@4.4.0(transitive)
+ Addederror-ex@1.3.2(transitive)
+ Addedescape-string-regexp@1.0.5(transitive)
+ Addedfind-root@1.1.0(transitive)
+ Addedfunction-bind@1.1.2(transitive)
+ Addedglobals@11.12.0(transitive)
+ Addedhasown@2.0.2(transitive)
+ Addedimport-fresh@3.3.1(transitive)
+ Addedis-arrayish@0.2.1(transitive)
+ Addedis-core-module@2.16.1(transitive)
+ Addedjsesc@3.1.0(transitive)
+ Addedjson-parse-even-better-errors@2.3.1(transitive)
+ Addedlines-and-columns@1.2.4(transitive)
+ Addedms@2.1.3(transitive)
+ Addedparent-module@1.0.1(transitive)
+ Addedparse-json@5.2.0(transitive)
+ Addedpath-parse@1.0.7(transitive)
+ Addedpath-type@4.0.0(transitive)
+ Addedpicocolors@1.1.1(transitive)
+ Addedreact-loading-skeleton@2.2.0(transitive)
+ Addedregenerator-runtime@0.14.1(transitive)
+ Addedresolve@1.22.10(transitive)
+ Addedresolve-from@4.0.0(transitive)
+ Addedsource-map@0.5.7(transitive)
+ Addedsupports-preserve-symlinks-flag@1.0.0(transitive)
+ Addedyaml@1.10.2(transitive)