Skip to content

Instantly share code, notes, and snippets.

@GimYoungPhil
Created April 7, 2016 08:38
Show Gist options
  • Save GimYoungPhil/26a1e329001dc71bef71d0279ba1ce76 to your computer and use it in GitHub Desktop.
Save GimYoungPhil/26a1e329001dc71bef71d0279ba1ce76 to your computer and use it in GitHub Desktop.
.card-img,
.card-img-overlay {
cursor: pointer;
}
.card-img-overlay {
display: flex;
align-items: center;
}
@media (min-width: 544px) {
.card-columns {
-webkit-column-count: 2;
-moz-column-count: 2;
column-count: 2;
-webkit-column-gap: 1.25rem;
-moz-column-gap: 1.25rem;
column-gap: 1.25rem;
}
}
require('./css/column.css');
var classNames = require('classnames');
var React = require('react');
var Column = React.createClass({
getInitialState: function() {
return {
showContext: false
};
},
render: function() {
var showContext = this.state.showContext;
var data = this.props.data;
return (
<div className="card card-shadow card-column m-b-2">
<div className={classNames('card-img', 'p-a-2', {'invisible': !showContext})}
ref="content" onClick={this.handleContentClick}>
<p>
{data.contents}
</p>
</div>
<div className={classNames('card-img-overlay', 'p-a-3', {'invisible': showContext})}
ref="overlay" onClick={this.handleOverlayClick}>
<p className="f-s-26">
{data.title}
</p>
</div>
</div>
)
},
handleOverlayClick: function() {
this.setState({
showContext: true
});
},
handleContentClick: function() {
this.setState({
showContext: false
});
}
});
module.exports = Column;
@GimYoungPhil
Copy link
Author

bootstrap v4
react

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment