• Stars
    star
    256
  • Rank 159,219 (Top 4 %)
  • Language
    TypeScript
  • Created almost 6 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Convert your links into rich previews

React-Tiny-Link

Convert your links into beautiful previews

Yet anotherReact link preview component with cards for web without a specific backend.

npm version npm GitHub code size in bytes NPM

All Contributors

NPM

CORS enabled?

No. You may need a CORS proxy to use this component. But if you dont have one, we made the component to use https://cors-anywhere.herokuapp.com as default proxy. Thanks to Rob. It saves my time for accessing urls.

Installation


npm install --save react-tiny-link

Usage & Configuration

import { ReactTinyLink } from 'react-tiny-link'
;<ReactTinyLink
  cardSize="small"
  showGraphic={true}
  maxLine={2}
  minLine={1}
  url="https://www.amazon.com/Steve-Madden-Mens-Jagwar-10-5/dp/B016X44MKA/ref=lp_18637582011_1_1?srs=18637582011&ie=UTF8&qid=1550721409&sr=8-1"
/>

Props & methods

PropName Description PropType value required
url URL to be display as preview string true
cardSize Size of the card string default (small) small,large false
maxLine Maximum number of line to ellipsis number 2 false
minLine Minimum number of line to ellipsis number 1 false
width Width of the link preview card number default(100vw) false
header Default Header content string null false
description Default description content string null false
proxyUrl Proxy URL to pass that resolve CORS string default(https://cors-anywhere.herokuapp.com) false
showGraphic Boolean value to display graphics boolean default(true) false
autoPlay Boolean value to play the media if provided url is video boolean default(false) false
defaultMedia Default value to provide the media for failure cases string N.A false
noCache Disables cache of link result boolean default(false) false
onError Error callback on when the url failed to fetch onError(error:Error) N.A false
onSuccess Success callback on when the url was fetched successfully onSuccess(data:IResponseData) N.A false
onClick Click event which will allow to add custom implementation onClick event if it was not provided the component itself will render as <a></a>. onClick(e:Event,data:IResponseData) default(null) false
loadSecureUrl Load only secure ( https:// ) resources. If no secure resource was found, then don't render the <img> and <video> element boolean default(false) false
requestHeaders Request headers that will override the fetch headers Record<string, string>; default(false) false

Hook usage

import { useScrapper } from 'react-tiny-link'

const [result, loading, error] = useScrapper({
  url:
    'https://www.amazon.com/Steve-Madden-Mens-Jagwar-10-5/dp/B016X44MKA/ref=lp_18637582011_1_1?srs=18637582011&ie=UTF8&qid=1550721409&sr=8-1',
})

Next.JS

For Next.Js you will have to turn off ssr false and use dynamic import. Because react-tiny-link uses styled-components as styling library which uses browser API window to attach scCGSHMRCache and stuffs after build.

import dynamic from "next/dynamic";
const ReactTinyLink = dynamic(
  () => {
    return import("react-tiny-link").then((mod) => mod.ReactTinyLink);
  },
  { ssr: false }
);

Params

PropName Description PropType value required
url URL to be display as preview string true
proxyUrl Proxy URL to pass that resolve CORS string default(https://cors-anywhere.herokuapp.com) false
defaultMedias Default value to provide the media for failure cases string[] N.A false
defaultValue Default response to provide for failure cases IReactTinyLinkData N.A false
noCache Disables cache of link result boolean default(false) false
onError Error callback on when the url failed to fetch onError(error:Error) N.A false
onSuccess Success callback on when the url was fetched successfully onSuccess(data:IResponseData) N.A false

Demo App &

CodeSandbox

Edit React Tiny Link

Contributing

  1. Fork it

  2. Create your feature branch (git checkout -b my-new-feature)

  3. Commit your changes (git commit -am 'Added some feature')

  4. Push to the branch (git push origin my-new-feature)

  5. Create new Pull Request

Contributors

Thanks goes to these wonderful people (emoji key):


Vladimir Moushkov

💻

Serhii Khoma

💻 🐛

Hitesh Kumar

💻 🐛

VadymMoiseyenkoAgiliway

💻 🐛

nastikue

🐛

sndsabin

💻 🐛

Aviskar KC

🐛 💻

Alexandre Bernard

🐛 💻

Liz

💻 💡

This project follows the all-contributors specification. Contributions of any kind welcome!

License

MIT

Twitter Follow

More Repositories

1

go-legofy

Golang legofy which legolize images look as if they are made out of 1x1 LEGO blocks
Go
27
star
2

Rabbit-Go

Rabbit converter for Golang
Go
5
star
3

react-smrt-map-selector

Singapore Mrt Stations Map React Component
JavaScript
5
star
4

mintotp-ruby

MinTOTP is a minimal TOTP generator written in Ruby.
Ruby
5
star
5

MyanmarGeojson

Myanmar Geojson for both province level and township level
4
star
6

lovely-cart

Playing around with redis MQ and WS
TypeScript
3
star
7

mmezykeyboard

Easy typing myanmar fonts for android
Java
3
star
8

lay-zate-api

To Provide Flight status Information for all airports.
Python
3
star
9

Save_Gradle

To overcome painful gradle sync for android devs
JavaScript
3
star
10

Dictionary

Simple Cross platform Geological Dictionary Project with Java swing
Java
3
star
11

rabbit-rust

Rabbit Converter for Rust(RustLang)
Rust
3
star
12

golang-designpatterns-myanmar

Golang Design Patterns with explanation in Myanmar
Go
3
star
13

30-sec-knowledge

The modified version of 30 sec knowledge https://chrome.google.com/webstore/detail/30-seconds-of-knowledge/mmgplondnjekobonklacmemikcnhklla?hl=en
TypeScript
3
star
14

EN-MM-Geology-Dictionary

English To Myanmar Mobile Geology Dictionary
Java
2
star
15

winhtaikaung

2
star
16

LayZate

To Know The Flight Status of Myanmar Airports
Java
2
star
17

ramzan_timetable

Time Table for Ramdhan
Java
1
star
18

lovely-feedback

Feed Back collection API with UI
TypeScript
1
star
19

db-proxy

Database Proxy Server Written in Go
Go
1
star
20

rails-devcontainer-template

VScode devcontainer template built from scratch with ruby on rails and node with nvm
Dockerfile
1
star
21

translate-bot-dcube

Go
1
star
22

lisptick

Lisptick for SICP
Common Lisp
1
star
23

go-morse

Go Morse encode <-> decode with golang
Go
1
star
24

winhtaikaung.github.io

Win Htaik Aung Thoughts and Ideas
1
star
25

gotabase

A RDBMS written in golang
1
star
26

react-onedrive-picker

React Onedrive Sharepoint File picker
TypeScript
1
star
27

kodilty

JavaScript
1
star
28

sg-mom-pass-status-check

To ease the process of Checking Pass from MOM(SG)
Python
1
star
29

pmf

Nothing here , just want to keep track some habits :)
JavaScript
1
star
30

rabbit-converter-sql

Apply MM Unicode <-> Zawgyi conversion to Database Level
PLpgSQL
1
star
31

vscode-kwee-phyo-ipsum

Curated list of myanmar place holder texts extension from kwee phyo speech
JavaScript
1
star
32

MuzikRestPack

DemoAndroidApp Client for RestPackSerializer Application with Clean Architecture
Java
1
star
33

GeologicalDictionaryApi

Python
1
star