New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@dhaiwat10/react-link-preview

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dhaiwat10/react-link-preview - npm Package Compare versions

Comparing version 1.7.0 to 1.7.1

2

index.esm.js

@@ -1,2 +0,2 @@

import e from"axios";import n,{useRef as t,useState as r,useEffect as o}from"react";import a from"react-loading-skeleton";function i(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))}}i("/* 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: #fafafa !important;\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 background-position: center;\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");i(".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,i=void 0===o?"30vh":o,l=e.margin;return n.createElement("div",{className:"skeleton-container",style:{width:r,margin:l}},n.createElement(a,{width:r,height:i}),n.createElement("div",{className:"skeleton-lower-container"},n.createElement(a,{count:3})))},c=function(a){var i=a.url,c=a.className,d=void 0===c?"":c,s=a.width,m=a.height,p=a.descriptionLength,u=a.borderRadius,g=a.imageHeight,h=a.textAlign,f=a.margin,v=a.fallback,x=void 0===v?null:v,b=a.backgroundColor,y=void 0===b?"white":b,k=a.primaryTextColor,w=void 0===k?"black":k,E=a.secondaryTextColor,C=void 0===E?"rgb(100, 100, 100)":E,N=a.borderColor,T=void 0===N?"#ccc":N,L=a.showLoader,S=void 0===L||L,R=a.customLoader,D=void 0===R?null:R,A=t(!0),H=r(),I=H[0],B=H[1],F=r(!0),z=F[0],U=F[1];if(o((function(){return U(!0),e.get("https://rlp-proxy.herokuapp.com/v2?url="+i).then((function(e){console.log(e),A.current&&(B(e.data.metadata),U(!1))})).catch((function(e){console.error(e),console.error("No metadata could be found for the given URL."),A.current&&(B(null),U(!1))})),function(){A.current=!1}}),[i]),z&&S)return D?n.createElement(n.Fragment,null,D):n.createElement(l,{width:s,imageHeight:g,margin:f});if(!I)return n.createElement(n.Fragment,null,x);var _=I.image,j=I.description,q=I.title,G=I.siteName,J=I.hostname;return n.createElement("div",{onClick:function(){window.open(i,"_blank")},className:"Container "+d,style:{width:s,height:m,borderRadius:u,textAlign:h,margin:f,backgroundColor:y,borderColor:T}},n.createElement("div",{style:{borderTopLeftRadius:u,borderTopRightRadius:u,backgroundImage:"url("+_+")",height:g},className:"Image"}),n.createElement("div",{className:"LowerContainer"},n.createElement("h3",{className:"Title",style:{color:w}},q),j&&n.createElement("span",{className:"Description Secondary",style:{color:C}},p&&j.length>p?j.slice(0,p)+"...":j),n.createElement("div",{className:"Secondary SiteDetails",style:{color:C}},G&&n.createElement("span",null,G," • "),n.createElement("span",null,J))))};export{c as LinkPreview};
import e,{useRef as n,useState as t,useEffect as r}from"react";import o 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: #fafafa !important;\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 background-position: center;\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 i=function(n){var t=n.width,r=void 0===t?"100%":t,a=n.imageHeight,i=void 0===a?"30vh":a,l=n.margin;return e.createElement("div",{className:"skeleton-container",style:{width:r,margin:l}},e.createElement(o,{width:r,height:i}),e.createElement("div",{className:"skeleton-lower-container"},e.createElement(o,{count:3})))},l=function(o){var a=o.url,l=o.className,c=void 0===l?"":l,d=o.width,s=o.height,m=o.descriptionLength,u=o.borderRadius,p=o.imageHeight,h=o.textAlign,g=o.margin,f=o.fallback,v=void 0===f?null:f,b=o.backgroundColor,x=void 0===b?"white":b,y=o.primaryTextColor,k=void 0===y?"black":y,w=o.secondaryTextColor,E=void 0===w?"rgb(100, 100, 100)":w,C=o.borderColor,N=void 0===C?"#ccc":C,T=o.showLoader,L=void 0===T||T,S=o.customLoader,R=void 0===S?null:S,D=n(!0),A=t(),H=A[0],I=A[1],B=t(!0),F=B[0],j=B[1];if(r((function(){return j(!0),fetch("https://rlp-proxy.herokuapp.com/v2?url="+a).then((function(e){return e.json()})).then((function(e){console.log(e),D.current&&(I(e.metadata),j(!1))})).catch((function(e){console.error(e),console.error("No metadata could be found for the given URL."),D.current&&(I(null),j(!1))})),function(){D.current=!1}}),[a]),F&&L)return R?e.createElement(e.Fragment,null,R):e.createElement(i,{width:d,imageHeight:p,margin:g});if(!H)return e.createElement(e.Fragment,null,v);var z=H.image,U=H.description,_=H.title,q=H.siteName,G=H.hostname;return e.createElement("div",{onClick:function(){window.open(a,"_blank")},className:"Container "+c,style:{width:d,height:s,borderRadius:u,textAlign:h,margin:g,backgroundColor:x,borderColor:N}},e.createElement("div",{style:{borderTopLeftRadius:u,borderTopRightRadius:u,backgroundImage:"url("+z+")",height:p},className:"Image"}),e.createElement("div",{className:"LowerContainer"},e.createElement("h3",{className:"Title",style:{color:k}},_),U&&e.createElement("span",{className:"Description Secondary",style:{color:E}},m&&U.length>m?U.slice(0,m)+"...":U),e.createElement("div",{className:"Secondary SiteDetails",style:{color:E}},q&&e.createElement("span",null,q," • "),e.createElement("span",null,G))))};export{l 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"),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: #fafafa !important;\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 background-position: center;\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,l=e.margin;return o.default.createElement("div",{className:"skeleton-container",style:{width:n,margin:l}},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,g=e.fallback,h=void 0===g?null:g,v=e.backgroundColor,b=void 0===v?"white":v,x=e.primaryTextColor,y=void 0===x?"black":x,k=e.secondaryTextColor,w=void 0===k?"rgb(100, 100, 100)":k,E=e.borderColor,C=void 0===E?"#ccc":E,N=e.showLoader,S=void 0===N||N,T=e.customLoader,L=void 0===T?null:T,R=t.useRef(!0),D=t.useState(),q=D[0],A=D[1],H=t.useState(!0),I=H[0],_=H[1];if(t.useEffect((function(){return _(!0),a.default.get("https://rlp-proxy.herokuapp.com/v2?url="+n).then((function(e){console.log(e),R.current&&(A(e.data.metadata),_(!1))})).catch((function(e){console.error(e),console.error("No metadata could be found for the given URL."),R.current&&(A(null),_(!1))})),function(){R.current=!1}}),[n]),I&&S)return L?o.default.createElement(o.default.Fragment,null,L):o.default.createElement(d,{width:l,imageHeight:m,margin:p});if(!q)return o.default.createElement(o.default.Fragment,null,h);var j=q.image,B=q.description,F=q.title,P=q.siteName,z=q.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:b,borderColor:C}},o.default.createElement("div",{style:{borderTopLeftRadius:u,borderTopRightRadius:u,backgroundImage:"url("+j+")",height:m},className:"Image"}),o.default.createElement("div",{className:"LowerContainer"},o.default.createElement("h3",{className:"Title",style:{color:y}},F),B&&o.default.createElement("span",{className:"Description Secondary",style:{color:w}},s&&B.length>s?B.slice(0,s)+"...":B),o.default.createElement("div",{className:"Secondary SiteDetails",style:{color:w}},P&&o.default.createElement("span",null,P," • "),o.default.createElement("span",null,z))))};
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("react-loading-skeleton");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=n(e),a=n(t);function o(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))}}o("/* 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: #fafafa !important;\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 background-position: center;\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");o(".skeleton-container {\n border-radius: 7px;\n border: 1px solid #eee; }\n\n.skeleton-lower-container {\n padding: 10px; }\n");var i=function(e){var t=e.width,n=void 0===t?"100%":t,o=e.imageHeight,i=void 0===o?"30vh":o,l=e.margin;return r.default.createElement("div",{className:"skeleton-container",style:{width:n,margin:l}},r.default.createElement(a.default,{width:n,height:i}),r.default.createElement("div",{className:"skeleton-lower-container"},r.default.createElement(a.default,{count:3})))};exports.LinkPreview=function(t){var n=t.url,a=t.className,o=void 0===a?"":a,l=t.width,d=t.height,c=t.descriptionLength,s=t.borderRadius,u=t.imageHeight,m=t.textAlign,f=t.margin,p=t.fallback,h=void 0===p?null:p,g=t.backgroundColor,v=void 0===g?"white":g,b=t.primaryTextColor,x=void 0===b?"black":b,y=t.secondaryTextColor,k=void 0===y?"rgb(100, 100, 100)":y,w=t.borderColor,E=void 0===w?"#ccc":w,C=t.showLoader,N=void 0===C||C,S=t.customLoader,T=void 0===S?null:S,L=e.useRef(!0),R=e.useState(),D=R[0],j=R[1],A=e.useState(!0),H=A[0],I=A[1];if(e.useEffect((function(){return I(!0),fetch("https://rlp-proxy.herokuapp.com/v2?url="+n).then((function(e){return e.json()})).then((function(e){console.log(e),L.current&&(j(e.metadata),I(!1))})).catch((function(e){console.error(e),console.error("No metadata could be found for the given URL."),L.current&&(j(null),I(!1))})),function(){L.current=!1}}),[n]),H&&N)return T?r.default.createElement(r.default.Fragment,null,T):r.default.createElement(i,{width:l,imageHeight:u,margin:f});if(!D)return r.default.createElement(r.default.Fragment,null,h);var _=D.image,q=D.description,B=D.title,F=D.siteName,P=D.hostname;return r.default.createElement("div",{onClick:function(){window.open(n,"_blank")},className:"Container "+o,style:{width:l,height:d,borderRadius:s,textAlign:m,margin:f,backgroundColor:v,borderColor:E}},r.default.createElement("div",{style:{borderTopLeftRadius:s,borderTopRightRadius:s,backgroundImage:"url("+_+")",height:u},className:"Image"}),r.default.createElement("div",{className:"LowerContainer"},r.default.createElement("h3",{className:"Title",style:{color:x}},B),q&&r.default.createElement("span",{className:"Description Secondary",style:{color:k}},c&&q.length>c?q.slice(0,c)+"...":q),r.default.createElement("div",{className:"Secondary SiteDetails",style:{color:k}},F&&r.default.createElement("span",null,F," • "),r.default.createElement("span",null,P))))};
//# sourceMappingURL=index.js.map
{
"name": "@dhaiwat10/react-link-preview",
"license": "MIT",
"version": "1.7.0",
"version": "1.7.1",
"private": false,

@@ -27,3 +27,2 @@ "description": "React library to preview links.",

"dependencies": {
"axios": "^0.21.1",
"react-loading-skeleton": "^2.2.0"

@@ -30,0 +29,0 @@ },

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc