Skip to content

Instantly share code, notes, and snippets.

@sarimarton
Last active September 9, 2019 20:55
Show Gist options
  • Save sarimarton/8fc6d7862c33f63b8e5908abca8d1f74 to your computer and use it in GitHub Desktop.
Save sarimarton/8fc6d7862c33f63b8e5908abca8d1f74 to your computer and use it in GitHub Desktop.
TMDb UI
TMDb UI
HomePage
selectMovie -> DetailsPage
queryEntry -> SearchResults
queryClean -> Discovery
Discovery*
SearchResults
DetailsPage
goBack -> HomePage
function render (model) {
console.log(model)
return (<>
<h1>{model.active_states[0].parent.name}</h1>
<h2>{model.active_states[0].name}</h2>
<ThumbContainer {...{ model }} />
<DetailsPage visible={model.active_states[0].name === 'DetailsPage'} />
</>)
}
function ThumbContainer (props) {
return (
<div style={{ display: 'flex' }}>
<Thumbnail onClick={() => props.model.emit('selectMovie')} />
<Thumbnail onClick={() => props.model.emit('selectMovie')} />
<Thumbnail onClick={() => props.model.emit('selectMovie')} />
</div>
)
}
function Thumbnail (props) {
return (
<div
class="thumbnail"
style={{
cursor: 'pointer',
margin: '10px',
background: '#aaf',
width: '50px',
height: '50px'
}}
{ ...props }
></div>
)
}
function DetailsPage (props) {
return (
<div style={{
display: props.visible ? 'block' : 'none'
}}>
Details
</div>
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment