Skip to content

Instantly share code, notes, and snippets.

@isavch
Last active March 28, 2018 12:53
Show Gist options
  • Select an option

  • Save isavch/7e7fff7846ae39109f32f120f96e6f78 to your computer and use it in GitHub Desktop.

Select an option

Save isavch/7e7fff7846ae39109f32f120f96e6f78 to your computer and use it in GitHub Desktop.
certona
class GlassCertonaWithOverlap extends Component {
state = {
deviceSize: 0,
cardSize: 0,
style: {}
}
getCardImage = card => {
const { clientWidth } = card.querySelector('img')
this.setState({
style: getOverlapStyle(clientWidth, this.props.componentOverlap)
})
}
onSizeChange = deviceSize => {
this.setState({ deviceSize })
}
render() {
return (
<div style={this.state.style}>
<GlassResizeTracker onChange={onSizeChange} />
<GlassCertonaCarousel
getCardImage={this.getCardImage}
title={this.props.title}
scheme={this.props.certona_zone_id}
count={parseInt(this.props.certona_recommendation_count, 10) || 16}
/>
</div>
)
}
}
const renderRecommendations = component => {
const contentFields = getContentFields(component)
const componentOverlap = getComponentOverlap(component)
return componentOverlap ? (
<GlassCertonaWithOverlap
title={contentFields.title}
scheme={contentFields.certona_zone_id}
count={parseInt(contentFields.certona_recommendation_count, 10) || 16}
/>
) : (
<GlassCertonaCarousel
title={contentFields.title}
scheme={contentFields.certona_zone_id}
count={parseInt(contentFields.certona_recommendation_count, 10) || 16}
className={'stack'}
/>
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment