diff --git a/src/components/UI/AppHeader/AppHeader.css b/src/components/UI/AppHeader/AppHeader.css new file mode 100644 index 00000000..c1406f5d --- /dev/null +++ b/src/components/UI/AppHeader/AppHeader.css @@ -0,0 +1,17 @@ +:root { + --foregroundColor: #fff; + --backgroundColor: #272e30; + --textFieldBorderColor: #e7e7e7; + --highlightFGColor: #fff; + --highlightBGColor: #3ab7a5; +} + +.appBar { + background-color: var(--backgroundColor); +} + +.createBtn { + position: fixed; + right: 2rem; + top: 3.5rem; +} diff --git a/src/components/UI/AppHeader/AppHeader.js b/src/components/UI/AppHeader/AppHeader.js new file mode 100644 index 00000000..1c0e4946 --- /dev/null +++ b/src/components/UI/AppHeader/AppHeader.js @@ -0,0 +1,83 @@ +import React from 'react'; +import pluralize from 'pluralize'; +import { IndexLink } from 'react-router'; +import { Menu, MenuItem, Button } from 'react-toolbox'; +import AppBar from 'react-toolbox/lib/app_bar'; +import FindBar from '../../../containers/FindBar'; +import styles from './AppHeader.css'; + +export default class AppHeader extends React.Component { + + // props: { + // // collections: React., + // // commands, + // // defaultCommands + // } + + state = { + createMenuActive: false + } + + handleCreatePostClick = collectionName => { + const { onCreateEntryClick } = this.props; + if (onCreateEntryClick) { + onCreateEntryClick(collectionName); + } + } + + onCreateButtonClick = () => { + this.setState({ + createMenuActive: true + }); + } + + onCreateMenuHide = () => { + this.setState({ + createMenuActive: false + }); + } + + render() { + const { collections, commands, defaultCommands } = this.props; + const { createMenuActive } = this.state; + + return ( + + + Dashboard + + + + + ); + } +} diff --git a/src/components/UI/index.js b/src/components/UI/index.js index 87b473a5..f99eba1c 100644 --- a/src/components/UI/index.js +++ b/src/components/UI/index.js @@ -2,3 +2,4 @@ export { default as Card } from './card/Card'; export { default as Loader } from './loader/Loader'; export { default as Icon } from './icon/Icon'; export { default as Toast } from './toast/Toast'; +export { default as AppHeader } from './AppHeader/AppHeader'; diff --git a/src/containers/App.js b/src/containers/App.js index c784d614..391fa4af 100644 --- a/src/containers/App.js +++ b/src/containers/App.js @@ -1,21 +1,21 @@ import React from 'react'; -import { connect } from 'react-redux'; -import { IndexLink } from 'react-router'; import pluralize from 'pluralize'; +import { connect } from 'react-redux'; +import { Layout, Panel } from 'react-toolbox'; import { loadConfig } from '../actions/config'; import { loginUser } from '../actions/auth'; import { currentBackend } from '../backends/backend'; -import { Loader } from '../components/UI'; import { SHOW_COLLECTION, CREATE_COLLECTION, HELP, createNewEntryInCollection } from '../actions/findbar'; -import FindBar from './FindBar'; +import { AppHeader, Loader } from '../components/UI'; import styles from './App.css'; class App extends React.Component { + componentDidMount() { this.props.dispatch(loadConfig()); } @@ -68,7 +68,7 @@ class App extends React.Component { id: `show_${collection.get('name')}`, pattern: `Show ${pluralize(collection.get('label'))}`, type: SHOW_COLLECTION, - payload: { collectionName:collection.get('name') } + payload: { collectionName: collection.get('name') } }); if (defaultCommands.length < 5) defaultCommands.push(`show_${collection.get('name')}`); @@ -78,7 +78,7 @@ class App extends React.Component { id: `create_${collection.get('name')}`, pattern: `Create new ${pluralize(collection.get('label'), 1)}(:itemName as ${pluralize(collection.get('label'), 1)} Name)`, type: CREATE_COLLECTION, - payload: { collectionName:collection.get('name') } + payload: { collectionName: collection.get('name') } }); } }); @@ -89,7 +89,7 @@ class App extends React.Component { return { commands, defaultCommands }; } - handleCreatePostClick = collectionName => { + onCreateEntryClick = collectionName => { this.props.dispatch( createNewEntryInCollection(collectionName) ); @@ -117,32 +117,19 @@ class App extends React.Component { const { commands, defaultCommands } = this.generateFindBarCommands(); return ( -
-
- - Dashboard - -
- + + + +
+ {children}
-
- { - collections.map(collection => - ) - } -
-
-
- {children} -
-
+ + ); } }