This repository was archived by the owner on Jun 28, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 372
Expand file tree
/
Copy pathindex.js
More file actions
90 lines (82 loc) · 2.83 KB
/
index.js
File metadata and controls
90 lines (82 loc) · 2.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
import React, { PropTypes } from 'react';
import { connect } from 'react-redux';
import Link from 'react-router/lib/Link';
import NavDropdown from 'react-bootstrap/lib/NavDropdown';
import { surahType, optionsType } from 'types';
import * as OptionsActions from 'redux/actions/options.js';
import SearchInput from 'components/SearchInput';
import SurahsDropdown from 'components/SurahsDropdown';
import ReadingModeToggle from 'components/ReadingModeToggle';
import NightModeToggle from 'components/NightModeToggle';
import FontSizeDropdown from 'components/FontSizeDropdown';
import LocaleFormattedMessage from 'components/LocaleFormattedMessage';
// TODO: import VersesDropdown from 'components/VersesDropdown';
import InformationToggle from 'components/InformationToggle';
import GlobalNav from '../index';
const styles = require('../style.scss');
const GlobalNavSurah = ({ surah, surahs, setOption, options, ...props }) => (
<GlobalNav
{...props}
leftControls={[
<SurahsDropdown title={surah.name.simple} surahs={surahs} />,
<NavDropdown
id="hidden-dropdown"
className={`visible-xs-inline-block ${styles.optionsDropdown}`}
title={<LocaleFormattedMessage id="settings.options" defaultMessage="Options" />}
>
<FontSizeDropdown
fontSize={options.fontSize}
onOptionChange={setOption}
/>
<InformationToggle
onToggle={setOption}
isToggled={options.isShowingSurahInfo}
/>
<ReadingModeToggle
isToggled={options.isReadingMode}
onToggle={setOption}
/>
<NightModeToggle />
</NavDropdown>,
<div className="navbar-form navbar-left hidden-xs hidden-sm">
<SearchInput className="search-input" />
</div>,
<li className="visible-xs-inline-block visible-sm-inline-block">
<Link to="/search">
<i className="ss-icon ss-search" style={{ verticalAlign: 'sub' }} />
</Link>
</li>
]}
rightControls={[
<FontSizeDropdown
fontSize={options.fontSize}
onOptionChange={setOption}
/>,
<InformationToggle
onToggle={setOption}
isToggled={options.isShowingSurahInfo}
/>,
<ReadingModeToggle
isToggled={options.isReadingMode}
onToggle={setOption}
/>,
<NightModeToggle />
]}
/>
);
GlobalNavSurah.propTypes = {
surah: surahType.isRequired,
surahs: PropTypes.objectOf(surahType).isRequired,
options: optionsType.isRequired,
setOption: PropTypes.func.isRequired,
};
function mapStateToProps(state, ownProps) {
const surahId = parseInt(ownProps.params.surahId, 10);
const surah: Object = state.surahs.entities[surahId];
return {
surah,
surahs: state.surahs.entities,
options: state.options
};
}
export default connect(mapStateToProps, OptionsActions)(GlobalNavSurah);