From 4c7ed7102aa5fdf3245ce1113614fee2d15fbd07 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Fri, 24 Jul 2020 19:56:27 +0200 Subject: checklist dropdown --- .../views/viewer/checklist/checklist.dropdown.js | 51 ++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 animism-align/frontend/app/views/viewer/checklist/checklist.dropdown.js (limited to 'animism-align/frontend/app/views/viewer/checklist/checklist.dropdown.js') diff --git a/animism-align/frontend/app/views/viewer/checklist/checklist.dropdown.js b/animism-align/frontend/app/views/viewer/checklist/checklist.dropdown.js new file mode 100644 index 0000000..0ed2f0d --- /dev/null +++ b/animism-align/frontend/app/views/viewer/checklist/checklist.dropdown.js @@ -0,0 +1,51 @@ +import React, { Component } from 'react' +import { connect } from 'react-redux' + +import actions from 'app/actions' +import { ROMAN_NUMERALS } from 'app/constants' +import { Arrow } from '../nav/viewer.icons' + +class ChecklistDropdown extends Component { + state = { + open: false, + } + handleOpen() { + this.setState({ open: !this.state.open }) + } + handleSelect(index) { + this.props.onChange(index) + this.setState({ open: false }) + } + render() { + const { sections, currentSection } = this.props + const { open } = this.state + return ( +
+
+
this.handleOpen()}> + {currentSection === 'all' ? 'View All' : 'Section ' + ROMAN_NUMERALS[currentSection]} +
+ +
+
+
+ {sections.map(section => ( +
this.handleSelect(section.index)}> + {'Section '}{ROMAN_NUMERALS[section.index]} +
+ ))} +
+
+
+ ) + } +} + +const mapStateToProps = state => ({ + sections: state.viewer.sections, +}) + +export default connect(mapStateToProps)(ChecklistDropdown) -- cgit v1.2.3-70-g09d2