• Stars
    star
    109
  • Rank 319,077 (Top 7 %)
  • Language
    CoffeeScript
  • License
    MIT License
  • Created about 10 years ago
  • Updated over 5 years ago

Reviews

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

Repository Details

React component for serving high-resolution images to devices with retina displays

react-retina-image

React component for serving high-resolution images to devices with retina displays

Demo

http://kyleamathews.github.io/react-retina-image/

Install

npm install react-retina-image

Usage

Available props:

  • checkIfRetinaImgExists โ€” test if retina image exists before swapping it in. If you're sure there's a retina image available, it's safe to set this to false. Defaults to true.
  • forceOriginalDimensions โ€” sets width/height of retina image to original image. Note, this doesn't work if checkIfRetinaImgExists is set to false as then the original image is never loaded. In this case you'll need to set the width manually either as a prop or using css. Defaults to true.
  • retinaImageSuffix โ€” defaults to @2x but you can change this if you use a different naming convention.
  • onLoad โ€”ย handle the image onLoad event.
  • onError โ€”ย handle the image onError event.
  • src โ€” string or array for the image srcs. See the demo for examples of how to format your src string or array.
var React = require('react');
var RetinaImage = require('react-retina-image');

React.createClass({
  render: function () {
    <RetinaImage src="./images/balloon.jpg" checkIfRetinaImgExists=false />
  }
});

// Can also pass in array of srcs.
React.createClass({
  render: function () {
    <RetinaImage
       src={["./images/balloon.jpg", "./images/bigger-balloon.jpg"]} />
  }
});

Attribution

This component is largely a port of retina.js to React.js

More Repositories

1

typography.js

A powerful toolkit for building websites with beautiful design
JavaScript
3,825
star
2

typefaces

NPM packages for Open Source typefaces
CSS
2,603
star
3

react-headroom

Hide your header until you need it
JavaScript
1,828
star
4

react-spinkit

A collection of loading indicators animated with CSS for React
CSS
1,491
star
5

docker-nginx

Nginx Docker image for easy hosting of static sites
Nginx
337
star
6

react-gravatar

React component for rendering a gravatar profile image
JavaScript
279
star
7

coffee-react-quickstart

Quickstart for building React single page apps using Coffeescript, Gulp, Webpack, and React-Router
CoffeeScript
254
star
8

superagent-bluebird-promise

Add promise support to superagent using Bluebird
CoffeeScript
183
star
9

element-resize-event

Library to make it easy to listen for element resize events
JavaScript
175
star
10

react-sparkline

React component for rendering simple sparklines
CoffeeScript
147
star
11

trpc-crdt

tRPC integrations for CRDTs: CRDT-native RPC calls
TypeScript
129
star
12

blog

my blog!
JavaScript
124
star
13

react-markdown-textarea

Component for React to create textareas for entering Markdown with built-in preview inspired by Github's design
CoffeeScript
120
star
14

react-micro-bar-chart

React component for micro bar-charts rendered with D3
CoffeeScript
112
star
15

facebook-export

Tools to help administer your Facebook groups
CoffeeScript
100
star
16

react-responsive-grid

Power tools for building responsive layouts with React
CoffeeScript
91
star
17

react-component-gallery

React component for creating an evenly spaced gallery of children components
CoffeeScript
88
star
18

react-icon-factory

Simply add icon SVGs and the react icon factory will manufacture a custom icon component!
JavaScript
66
star
19

cjsx-loader

coffee-react-transform loader module for webpack
Makefile
53
star
20

react-smart-time-ago

Show relative "time ago" dates for anything in last two weeks and absolute dates from then on back
JavaScript
33
star
21

react-component-width-mixin

React mixin which sets width as state variable and updates as component changes shape
JavaScript
29
star
22

react-simple-table

For when you just want a table
CoffeeScript
23
star
23

isRetina

Simple function which determines if your code is running on a high DPR device or not
JavaScript
23
star
24

gatsby-starter-theme-ui

Fork of the Gatsby default starter but with theme-ui
JavaScript
19
star
25

react-autoupdate-time

Renders a <time> element that autoupdates at a configurable interval
CoffeeScript
19
star
26

og_mailinglist

Drupal Module that converts individual Organic Groups into mailing lists.
PHP
18
star
27

compass-vertical-rhythm

A port-in-progress of the Compass vertical rhythm library
CoffeeScript
18
star
28

check-gatsby-caching

Checks if your Gatsby site's cache-control headers are correct and optimized
JavaScript
18
star
29

Fuzzymatcher.js

Fuzzymatching library optimized for powering auto-complete widgets
JavaScript
18
star
30

docker-nginx-reverse-proxy-ssl

Docker image for creating simple reverse proxy with ssl termination
Shell
17
star
31

linux-config

my personal config files
Vim Script
16
star
32

color-pairs-picker

Given a color, it picks pleasing and well contrasted background and foreground colors
CoffeeScript
14
star
33

react-page-width

React mixin so a component can always know the current page width
CoffeeScript
13
star
34

Eduglu-Chatroom

Awesome Drupal-groups aware Chatroom built on Node.js
JavaScript
12
star
35

toml-loader

TOML loader module for webpack
JavaScript
11
star
36

makersgtd

Yet Another GTD Single Page App
CoffeeScript
10
star
37

engagement

Track when a user is engaging with a page
CoffeeScript
9
star
38

docker-nodejs-base

Base for building node.js web apps. Node.js, Ruby, Bundler, etc.
9
star
39

hapi-rethinkdb-thinky

Hapi plugin that automatically loads your Thinky models for RethinkDB
CoffeeScript
9
star
40

modularscale

Calculate a modular scale
CoffeeScript
9
star
41

image-exists

Check if an image exists
JavaScript
8
star
42

aiocalendar

All-in-one calendar feature built in Drupal
JavaScript
8
star
43

gray-percentage

Convenience function to get a gray value by percentage e.g. gray(60) -> "hsl(0,0%,60%)"
CoffeeScript
8
star
44

react-component-starter

Quickstart for creating a Coffeescript React component with examples
JavaScript
8
star
45

phpmailer

a temporary (hopefully) fork of PHPMailer to work on some changes we need for OG Mailinglist. The issue for our changes can be found at http://sourceforge.net/tracker/?func=detail&aid=3080711&group_id=26031&atid=385707
PHP
7
star
46

react-ghost-button

A simple react-ghost-button
CoffeeScript
7
star
47

gatsby-starter-building-blog

Gatsby v2 starter with colors taken from a photo of a building in Berkeley, CA
JavaScript
6
star
48

Journal

Backbone.js / Node.js multi-user journal app
CoffeeScript
6
star
49

gatsby-theme-cooper-hewitt

JavaScript
6
star
50

gatsby-starter-theme-cooper-hewitt

Starter for gatsby-theme-cooper-hewitt
JavaScript
6
star
51

gatsby-starter-blog-child-theme

Starter for creating a child theme for gatsby-theme-blog
JavaScript
6
star
52

react-html-elements-styleguide

React styleguide component
JavaScript
6
star
53

react-message

React component for showing status messages
CoffeeScript
6
star
54

eduglu_features

Core eduglue features
PHP
5
star
55

Family-History-Distro-features

Features for the Family History Drupal Distro
PHP
5
star
56

create-gatsby-fs-routes

wee prototype
JavaScript
5
star
57

electric-cloudflare-kv-sync

Demo showing how to sync data with ElectricSQL from Postgres to Cloudflare's Workers KV
TypeScript
5
star
58

eduglu_make

Drush Make file for eduglu
4
star
59

docker-xelatex

Docker container with Xelatex and high quality free fonts installed
Shell
4
star
60

reactive-static-generation-benchmarks

Benchmarks for testing Reactive Static Generation vs SSG/SSR
TypeScript
4
star
61

index-gatsby-blog-demo

Gatsby starter for a Contentful project.
JavaScript
4
star
62

gatsby-plugin-emoji-cursor

Gatsby plugin to add emjois which trail behind your cursor
JavaScript
4
star
63

brunch-backbone-widgets

Reusable Widgets for apps built with Backbone.js + Brunch + Sass/Compass
JavaScript
4
star
64

lmdb-backed-array

LMDB-backed array implementation for node.js for lowering memory usage for huge arrays.
JavaScript
4
star
65

every-second

A Gatsby site which which updates a time counter every second
CSS
4
star
66

hapi-dynamic-scope

Create dynamic route scopes based on information in the request
JavaScript
4
star
67

gatsby-plugin-inspector

Use Node.js inspector API to sample CPU/memory of a Gatsby build
JavaScript
4
star
68

gatsby-shopify-wordpress-demo

A Gatsby starter using the latest Shopify plugin showcasing a store with product overview, individual product pages, and a cart
JavaScript
4
star
69

backbone.js-practice

JavaScript
3
star
70

agility-gatsby-starter2

A sample GatsbyJS website using the Agility CMS Gatsby source plugin
3
star
71

Family-History-distro-HTML-mockup

mockup yo
JavaScript
3
star
72

eduglu_profile

Install profile (think distro) for Drupal
3
star
73

gatsby-starter-shopify

A Gatsby starter using the latest Shopify plugin showcasing a store with product overview, individual product pages, and a cart
JavaScript
3
star
74

test-recipes

some API ideas
JavaScript
3
star
75

gatsby-starter-theme-hyde

Starter for gatsby-theme-hyde
JavaScript
3
star
76

gatsby-cli-exploration

exploring some ideas for new UI for gatsby cli
JavaScript
3
star
77

reactjs-twitter-stream-example

Example React.js / Node.js app that streams tweets
JavaScript
3
star
78

hapi-death

Help Hapi.js die gracefully by intercepting SIGINT and SIGTERM and calling server.stop()
JavaScript
3
star
79

familyhistorydistro

Drupal Family History Distro
PHP
3
star
80

sanity-kitchen-sink

Kitchen Sink
JavaScript
2
star
81

atrium_book

port of atrium_book to Eduglu, KIT-complient, likely soon to be superceeded by new atrium_book version
PHP
2
star
82

BYU-Starter-Drupal-Profile

.make file and .profile file for a basic BYU Drupall install
2
star
83

hapi-influx

Hapi plugin to create a shared InfluxDB client
CoffeeScript
2
star
84

gc-functions-test

JavaScript
2
star
85

fun-with-fauna

JavaScript
2
star
86

image-processing-benchmark

CSS
2
star
87

notesfromquarantinechurch-blog

JavaScript
2
star
88

react-flickr-example

Flickr search page build with React
CSS
2
star
89

gatsby-source-airtable-demo

TypeScript
2
star
90

bug-report-123

JavaScript
2
star
91

Drupal-Flot

Fork of Drupal flot module to keep track of patches / changes I make
PHP
2
star
92

trello-flow

Create a Cumulative Flow Diagram from your Trello Board(s)
CoffeeScript
2
star
93

file-upload-tests

Testing the fastest way to upload files w/ Node.js on Linux
JavaScript
2
star
94

preview-testing

Gatsby starter for a Contentful project from the community.
JavaScript
2
star
95

react-simple-form-inline-styles

Simple inline styles for React forms
CoffeeScript
2
star
96

agility-starter-2

JavaScript
2
star
97

gatsby-site

Gatsby Site
JavaScript
2
star
98

the-nope-game

thenopegame.com (or whatever the domain will be)
JavaScript
2
star
99

static-query-bug-repo

JavaScript
2
star
100

my-new-contentful-blog

Gatsby starter for a Contentful project from the community.
JavaScript
2
star