Skip to content

Instantly share code, notes, and snippets.

@Breta01
Last active November 5, 2016 23:44
Show Gist options
  • Save Breta01/10f3a009aab78c9816ff960752fd1416 to your computer and use it in GitHub Desktop.
Save Breta01/10f3a009aab78c9816ff960752fd1416 to your computer and use it in GitHub Desktop.
import React from 'react';
// Gamecard based on MDL Cards
const Gamecard = React.createClass({
render: function() {
// JS object containing CSS like syntax
// We can use other variables in it (e.g. props)
const CardImage = {
height: '175px',
background: 'url("' + this.props.image + '") center / cover'
};
return (
<div className="gcard mdl-card">
{/* Passing the JS object with CSS to the style attribute */}
<div className="mdl-card__title" style={ CardTitle }>
<h2 className="mdl-card__title-text">{ this.props.title }</h2>
</div>
<div className="mdl-card__supporting-text">
{ this.props.description }
</div>
<div className="mdl-card__actions mdl-card--border">
<a className="mdl-button mdl-button--colored mdl-js-button mdl-js-ripple-effect">
START
</a>
</div>
</div>
);
}
});
export default Gamecard;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment