diff --git a/app/modules/LibraryNav.jsx b/app/modules/LibraryNav.jsx index 162fe94..d751a80 100644 --- a/app/modules/LibraryNav.jsx +++ b/app/modules/LibraryNav.jsx @@ -7,11 +7,13 @@ import styles from 'material-ui/lib/styles' import List from 'material-ui/lib/lists/list' import ListItem from 'material-ui/lib/lists/list-item' import ActionGrade from 'material-ui/lib/svg-icons/action/grade' +import NoteBook from 'material-ui/lib/svg-icons/action/class' import History from 'material-ui/lib/svg-icons/action/history' import AddCircleOutline from 'material-ui/lib/svg-icons/content/add-circle-outline' import Folder from 'material-ui/lib/svg-icons/file/folder' import Delete from 'material-ui/lib/svg-icons/action/delete' import Divider from 'material-ui/lib/divider' +import { SelectableContainerEnhance } from 'material-ui/lib/hoc/selectable-enhance' const colors = styles.Colors @@ -25,106 +27,179 @@ const {AppBar, Mixins, RaisedButton, FlatButton, + Badge, + TextField, Dialog, Styles, Tab, Tabs, Paper} = mui +let SelectableList = SelectableContainerEnhance(List) + +function wrapState(ComposedComponent) { + const StateWrapper = React.createClass({ + getInitialState() { + return {selectedIndex: 0}; + }, + handleUpdateSelectedIndex(e, index) { + this.setState({ + selectedIndex: index, + }); + }, + render() { + return ( + + ); + }, + }); + return StateWrapper; +} + +SelectableList = wrapState(SelectableList); + const DefaultRawTheme = Styles.LightRawTheme export default class LibraryNav extends React.Component { constructor(props){ super(props) - this.state = {open: false, items: []} + this.state = { + open: false, + navItems: [ + { + 'name': 'Entries', + 'icon': , + 'notes': 10 + }, + { + 'name': 'Starred', + 'icon': , + 'notes': 1 + }, + { + 'name': 'Recents', + 'icon': , + 'notes': 10 + }, + { + 'name': 'Trash', + 'icon': , + 'notes': 0 + }, + { + 'name': 'All Notes', + 'icon': , + 'notes': 0 + }, + + ], + notebooks: [ + {'state': 'editing', 'title': '', 'notes': 0}, + {'state': 'displaying', 'title': 'FieldNotes', 'notes': 10} + ] + } } static get childContextTypes(){ return {muiTheme: React.PropTypes.object} } - handleOpen = () => { - console.log(this); - this.setState({open: true}) - }; - - handleClose = () => { - this.setState({open: false}) - }; - getChildContext() { return { muiTheme: ThemeManager.getMuiTheme(DefaultRawTheme) } } - displayDialog(){ - console.log(this) - } - - readDir = () => { - console.log(fs.readdirSync('.')) - }; - - entriesTapped = () => { - var items = this.state.items - items.push({name: 'Stuff '+(items.length+1), id: items.length}) - this.setState({items: items}) - }; - blank(){ } + newNotebookUnfocus = (i) => { + + var nb = this.state.notebooks[i] + var tf = this.refs["textField"+i] + var notebookName = tf.getValue() + if (notebookName){ + nb.title = notebookName + nb.state = 'displaying' + this.setState({notebooks: this.state.notebooks}) + } + }; + + addNotebookTapped = () => { + var nbs = this.state.notebooks + nbs.push({'state': 'editing', + 'title': '', + 'notes': 0}) + this.setState({notebooks: nbs}) + }; + + newNotebookTyped = (i) => { + }; + render(){ return (
- - } - className="noselect"/> - } - className="noselect" /> - } - className="noselect" /> - } - className="noselect" /> - } - className="noselect" /> - {this.state.items.map(function(item){ + + {this.state.navItems.map(function(item, i){ return } + value={i} className="noselect"/>; })} - +
NoteBooks
}> + + {this.state.notebooks.map((notebook, i) =>{ + var l = null + + if (notebook.state == 'editing'){ + l = } + leftIcon={} + rightIcon={} + /> + } + else{ + l = } + rightIcon={} + /> + } + return l + })} diff --git a/style.css b/style.css index 8306001..6aad9b3 100644 --- a/style.css +++ b/style.css @@ -22,5 +22,5 @@ body, html{ } #library-nav{ border-right: solid 1px #d9d9d9; - width: 200px; + width: 300px; }