Skip to content

Instantly share code, notes, and snippets.

@adammark
Last active July 12, 2017 12:35
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adammark/d618cc1d9e595a58c65fd5be10900858 to your computer and use it in GitHub Desktop.
Save adammark/d618cc1d9e595a58c65fd5be10900858 to your computer and use it in GitHub Desktop.
var Stars = function (props) {
var rating = props.rating || 0; // rating from 0 to 5, inclusive, in increments of 0.5
var label = props.label || null; // a label to describe the contents (for accessibility)
var src = "./img/stars_" + rating + ".svg";
return <img src={src} width="78" height="13" aria-label={label} data-tooltip={label}/>;
};
module.exports = Stars;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment