insomnia/app/ui/components/dropdowns/PreviewModeDropdown.js

31 lines
782 B
JavaScript
Raw Normal View History

import React, {PropTypes} from 'react';
import Dropdown from '../base/Dropdown';
import {PREVIEW_MODES, getPreviewModeName} from '../../../backend/previewModes';
2016-04-30 05:01:57 +00:00
const PreviewModeDropdown = ({updatePreviewMode}) => (
<Dropdown>
<button className="tall">
<i className="fa fa-caret-down"></i>
</button>
<ul>
{PREVIEW_MODES.map(previewMode => (
<li key={previewMode}>
<button onClick={() => {
updatePreviewMode(previewMode);
}}>{getPreviewModeName(previewMode)}</button>
</li>
))}
</ul>
</Dropdown>
);
2016-04-30 05:01:57 +00:00
PreviewModeDropdown.propTypes = {
// Functions
updatePreviewMode: PropTypes.func.isRequired,
2016-04-30 05:01:57 +00:00
// Required
previewMode: PropTypes.string.isRequired
};
export default PreviewModeDropdown;