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.0.1 to 1.0.2

4

components/LinkPreview/LinkPreview.d.ts

@@ -6,2 +6,6 @@ import React from 'react';

className?: string;
width?: string | number;
height?: string | number;
descriptionLength?: number;
borderRadius?: string | number;
}

@@ -8,0 +12,0 @@ interface Image {

2

index.esm.js

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

import e,{useState as n,useEffect as t}from"react";import r from"html-metadata-parser";import o from"classnames";!function(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))}}(".Container {\n background-color: white;\n display: flex;\n flex-direction: column;\n border-radius: 7px;\n border: 1px solid #ccc;\n padding: 10px; }\n .Container:hover {\n background-color: #f7f7f7;\n cursor: pointer; }\n\n.Image {\n width: 100%; }\n");var i=function(i){var a=i.url,l=i.className,c=o("Container",void 0===l?"":l),d=n(),s=d[0],m=d[1];if(t((function(){r.parser("https://thingproxy.freeboard.io/fetch/"+a,(function(e,n){console.log(n),m(n)}))}),[]),!s)return null;var p=s.images,u=s.og;return e.createElement("div",{onClick:function(){window.open(a,"_blank")},className:c},e.createElement("p",null,"Site name - ",u.site_name),p&&e.createElement("img",{className:"Image",src:u.image}),e.createElement("h3",null,"Title - ",u.title),e.createElement("p",null,"Description - ",u.description))};export{i as LinkPreview};
import e,{useRef as n,useState as t,useEffect as i}from"react";import r from"html-metadata-parser";!function(e,n){void 0===n&&(n={});var t=n.insertAt;if(e&&"undefined"!=typeof document){var i=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css","top"===t&&i.firstChild?i.insertBefore(r,i.firstChild):i.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}}("/* common */\n.Container {\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 .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\n.SiteDetails {\n margin-top: 10px; }\n\n/* sm */\n@media (max-width: 640px) {\n .Container {\n width: 80vw;\n height: fit-content; }\n .Description {\n display: none; } }\n\n/* md */\n@media (min-width: 641px) and (max-width: 768px) {\n .Description {\n display: none; } }\n");var o=function(o){var a=o.url,c=o.className,s=void 0===c?"":c,d=o.width,l=o.height,m=o.descriptionLength,p=o.borderRadius,u=n(!0),h=t(),f=h[0],g=h[1];if(i((function(){return r.parser("https://thingproxy.freeboard.io/fetch/"+a).then((function(e){console.log(e),u.current&&g(e)})).catch((function(e){console.log(e),u.current&&g(null)})),function(){u.current=!1}}),[a]),!f)return null;var x=f.images,y=f.og,b=f.meta,w=y.description?y.description:b.description?b.description:null,v=new URL(a).hostname;return e.createElement("div",{onClick:function(){window.open(a,"_blank")},className:"Container "+s,style:{width:d,height:l,borderRadius:p}},x&&e.createElement("img",{className:"Image",src:y.image,style:{borderTopLeftRadius:p,borderTopRightRadius:p}}),e.createElement("div",{className:"LowerContainer"},e.createElement("h3",{className:"Title"},y.title?y.title:b.title),w&&e.createElement("span",{className:"Description Secondary"},m?w.slice(0,m)+"...":w),e.createElement("div",{className:"Secondary SiteDetails"},y.site_name&&e.createElement("span",null,y.site_name," • "),e.createElement("span",null,v))))};export{o as LinkPreview};
//# sourceMappingURL=index.esm.js.map

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

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("html-metadata-parser"),n=require("classnames");function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=r(e),i=r(t),l=r(n);!function(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))}}(".Container {\n background-color: white;\n display: flex;\n flex-direction: column;\n border-radius: 7px;\n border: 1px solid #ccc;\n padding: 10px; }\n .Container:hover {\n background-color: #f7f7f7;\n cursor: pointer; }\n\n.Image {\n width: 100%; }\n");exports.LinkPreview=function(t){var n=t.url,r=t.className,o=void 0===r?"":r,c=l.default("Container",o),d=e.useState(),u=d[0],s=d[1];if(e.useEffect((function(){i.default.parser("https://thingproxy.freeboard.io/fetch/"+n,(function(e,t){console.log(t),s(t)}))}),[]),!u)return null;var f=u.images,m=u.og;return a.default.createElement("div",{onClick:function(){window.open(n,"_blank")},className:c},a.default.createElement("p",null,"Site name - ",m.site_name),f&&a.default.createElement("img",{className:"Image",src:m.image}),a.default.createElement("h3",null,"Title - ",m.title),a.default.createElement("p",null,"Description - ",m.description))};
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),n=require("html-metadata-parser");function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=t(e),r=t(n);!function(e,n){void 0===n&&(n={});var t=n.insertAt;if(e&&"undefined"!=typeof document){var i=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css","top"===t&&i.firstChild?i.insertBefore(r,i.firstChild):i.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}}("/* common */\n.Container {\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 .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\n.SiteDetails {\n margin-top: 10px; }\n\n/* sm */\n@media (max-width: 640px) {\n .Container {\n width: 80vw;\n height: fit-content; }\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(n){var t=n.url,a=n.className,o=void 0===a?"":a,d=n.width,l=n.height,s=n.descriptionLength,c=n.borderRadius,u=e.useRef(!0),m=e.useState(),p=m[0],f=m[1];if(e.useEffect((function(){return r.default.parser("https://thingproxy.freeboard.io/fetch/"+t).then((function(e){console.log(e),u.current&&f(e)})).catch((function(e){console.log(e),u.current&&f(null)})),function(){u.current=!1}}),[t]),!p)return null;var h=p.images,g=p.og,x=p.meta,y=g.description?g.description:x.description?x.description:null,b=new URL(t).hostname;return i.default.createElement("div",{onClick:function(){window.open(t,"_blank")},className:"Container "+o,style:{width:d,height:l,borderRadius:c}},h&&i.default.createElement("img",{className:"Image",src:g.image,style:{borderTopLeftRadius:c,borderTopRightRadius:c}}),i.default.createElement("div",{className:"LowerContainer"},i.default.createElement("h3",{className:"Title"},g.title?g.title:x.title),y&&i.default.createElement("span",{className:"Description Secondary"},s?y.slice(0,s)+"...":y),i.default.createElement("div",{className:"Secondary SiteDetails"},g.site_name&&i.default.createElement("span",null,g.site_name," • "),i.default.createElement("span",null,b))))};
//# sourceMappingURL=index.js.map
{
"name": "@dhaiwat10/react-link-preview",
"license": "MIT",
"version": "1.0.1",
"version": "1.0.2",
"private": false,

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

"dependencies": {
"@types/storybook__react": "^5.2.1",
"classnames": "^2.2.6",

@@ -23,0 +22,0 @@ "html-metadata-parser": "^1.0.3"

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