-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds collection items #22
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,26 @@ | ||
import React from 'react' | ||
|
||
import { CollectionItemHeader, CollectionItemStats } from '../index' | ||
import { CollectionItemHeader, CollectionItemStats, CollectionItemAssets } from '../index' | ||
|
||
const CollectionItem = (props) => { | ||
return ( | ||
<div> | ||
<CollectionItemHeader title={props.title} image={props.image} /> | ||
<CollectionItemStats date={props.date} /> | ||
<CollectionItemHeader title={props.title} image={props.image} assets={props.assets} /> | ||
<CollectionItemStats type={props.type} subType={props.subType} classifications={props.classifications} /> | ||
<CollectionItemAssets itemId={props.itemId} assets={props.assets} /> | ||
</div> | ||
) | ||
} | ||
|
||
CollectionItem.propTypes = { | ||
itemId: React.PropTypes.string, | ||
image: React.PropTypes.object.isRequired, | ||
title: React.PropTypes.string.isRequired, | ||
date: React.PropTypes.string.isRequired, | ||
date: React.PropTypes.string, | ||
type: React.PropTypes.string.isRequired, | ||
subType: React.PropTypes.string.isRequired, | ||
classifications: React.PropTypes.array.isRequired, | ||
assets: React.PropTypes.object, | ||
} | ||
|
||
export default CollectionItem |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import React from 'react' | ||
import { Link } from 'react-router' | ||
|
||
const CollectionItemAssets = (props) => { | ||
const assetTypes = Object.keys(props.assets) | ||
return ( | ||
<div> | ||
{assetTypes.map(typeName => <div key={typeName}><Link to={`/collection/${props.itemId}/${typeName}`}>{typeName}</Link></div>)} | ||
</div> | ||
) | ||
} | ||
|
||
CollectionItemAssets.propTypes = { | ||
itemId: React.PropTypes.string, | ||
assets: React.PropTypes.object, | ||
} | ||
|
||
export default CollectionItemAssets |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import React from 'react' | ||
|
||
const DeepZoom = (props) => { | ||
return ( | ||
<div> | ||
<iframe width="640" height="360" src={props.url} frameBorder="0" allowFullScreen /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
</div> | ||
) | ||
} | ||
|
||
DeepZoom.propTypes = { | ||
url: React.PropTypes.string.isRequired, | ||
} | ||
|
||
export default DeepZoom |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import React from 'react' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Mixes Route and Redux. Not sure if this is best way to do it. But otherwise I would be creating a route that just has a container than then has the same stuff. Extra layer, didn't seem to be a good reason for it. |
||
import { connect } from 'react-redux' | ||
|
||
import DeepZoom from './DeepZoom' | ||
|
||
const DeepZoomRoute = (props) => { | ||
if (!props.deepzoomAssets || props.deepzoomAssets.length === 0) { | ||
return <div><h2>No deep zoom images found.</h2></div> | ||
} | ||
|
||
return ( | ||
<div> | ||
<p>Deep zoom images for <b>{props.title}</b></p> | ||
{props.deepzoomAssets.map((url) => | ||
<DeepZoom key={url} url={url} /> | ||
)} | ||
</div> | ||
) | ||
} | ||
|
||
DeepZoomRoute.propTypes = { | ||
itemId: React.PropTypes.string.isRequired, | ||
title: React.PropTypes.string.isRequired, | ||
assets: React.PropTypes.object.isRequired, | ||
deepzoomAssets: React.PropTypes.array.isRequired, | ||
} | ||
|
||
const mapStateToProps = ({ collectionItems }, ownProps) => { | ||
const item = collectionItems.collectionItems[ownProps.params.id] | ||
return { | ||
itemId: item.id, | ||
title: item.title, | ||
assets: item.assets, | ||
deepzoomAssets: item.assets ? item.assets.deepzoom : [], | ||
} | ||
} | ||
|
||
const DeepZoomRouteContainer = connect(mapStateToProps)(DeepZoomRoute) | ||
|
||
|
||
export default DeepZoomRouteContainer |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import DeepZoom from './DeepZoom' | ||
import DeepZoomRoute from './DeepZoomRoute' | ||
|
||
export { | ||
DeepZoom, | ||
DeepZoomRoute, | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import React from 'react' | ||
|
||
const Model3d = (props) => { | ||
return ( | ||
<div> | ||
<iframe width="640" height="480" src={props.url} frameBorder="0" allowFullScreen /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Need to change width to 100%. Height is also a bit much for the iphone 4, but we can deal with that when we style. |
||
</div> | ||
) | ||
} | ||
|
||
Model3d.propTypes = { | ||
url: React.PropTypes.string.isRequired, | ||
} | ||
|
||
export default Model3d |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can now lint things :)