-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #447 from netlify/kitchen-sink
Add kitchen sink example, restore object/list previews
- Loading branch information
Showing
21 changed files
with
181 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.switch { | ||
display: inline-block; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import React, { PropTypes } from 'react'; | ||
import previewStyle from './defaultPreviewStyle'; | ||
|
||
export default function DatePreview({ value }) { | ||
export default function DateTimePreview({ value }) { | ||
return <div style={previewStyle}>{value ? value.toString() : null}</div>; | ||
} | ||
|
||
DatePreview.propTypes = { | ||
value: PropTypes.node, | ||
DateTimePreview.propTypes = { | ||
value: PropTypes.object, | ||
}; |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,12 @@ | ||
import React, { PropTypes, Component } from 'react'; | ||
import { resolveWidget } from '../Widgets'; | ||
import previewStyle from './defaultPreviewStyle'; | ||
import ObjectPreview from './ObjectPreview'; | ||
|
||
export default class ListPreview extends Component { | ||
widgetFor = (field, value) => { | ||
const { getAsset } = this.props; | ||
const widget = resolveWidget(field.get('widget')); | ||
return (<div key={field.get('name')}>{React.createElement(widget.preview, { | ||
key: field.get('name'), | ||
value: value && value.get(field.get('name')), | ||
field, | ||
getAsset, | ||
})}</div>); | ||
}; | ||
|
||
render() { | ||
const { field, value } = this.props; | ||
const fields = field && field.get('fields'); | ||
if (fields) { | ||
return value ? (<div style={previewStyle}> | ||
{value.map((val, index) => <div key={index}> | ||
{fields && fields.map(f => this.widgetFor(f, val))} | ||
</div>)} | ||
</div>) : null; | ||
} | ||
|
||
return <div style={previewStyle}>{value ? value.join(', ') : null}</div>; | ||
} | ||
} | ||
const ListPreview = ObjectPreview; | ||
|
||
ListPreview.propTypes = { | ||
value: PropTypes.node, | ||
field: PropTypes.node, | ||
getAsset: PropTypes.func.isRequired, | ||
}; | ||
|
||
export default ListPreview; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.