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.4.0 to 1.5.0

components/LinkPreview/Skeleton.d.ts

2

index.esm.js

@@ -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

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