Add table for menu, and fix up editors.

This commit is contained in:
Dorian 2017-11-04 22:59:46 -04:00
parent 4a673defeb
commit 34d4fee593
2 changed files with 33 additions and 12 deletions

View File

@ -9,7 +9,7 @@ Panel containing control elements for managing sites and pages.
import {h, Component} from 'preact'; /** @jsx h*/ import {h, Component} from 'preact'; /** @jsx h*/
import {observer} from 'mobx-observer'; import {observer} from 'mobx-observer';
import {Form, FormGroup, Col, Input, Label} from 'reactstrap'; import {Form, FormGroup, Col, Input, Label, Table} from 'reactstrap';
import {UserLogin} from './UserLoginForm'; import {UserLogin} from './UserLoginForm';
import {PageEditor} from './PageEditor'; import {PageEditor} from './PageEditor';
@ -46,6 +46,20 @@ import {Spacer} from '../layout';
panelStyle.marginLeft = '0'; panelStyle.marginLeft = '0';
} }
const menu = [];
let itemCounter = 0;
for (let item of siteStore.menu) {
let menuItem = (
<tr>
<th scope='row'>{itemCounter + 1}</th>
<td>{item.title}</td>
<td>{item.url}</td>
</tr>
);
menu.push(menuItem);
itemCounter++;
}
// TODO: Breakout into separate components. // TODO: Breakout into separate components.
const children = userStore.isUserLoggedIn const children = userStore.isUserLoggedIn
? ( ? (
@ -55,14 +69,14 @@ import {Spacer} from '../layout';
<Form horizontal> <Form horizontal>
<FormGroup row> <FormGroup row>
<Col xs='2'> <Col xs='2'>
<Label for='title'>Title</Label> <Label for='name'>Name</Label>
</Col> </Col>
<Col xs='10' > <Col xs='10' >
<Input <Input
id='title' id='title'
type='text' type='text'
placeholder='Title' placeholder='Name'
value={ siteStore.title } /> value={ siteStore.name } />
</Col> </Col>
</FormGroup> </FormGroup>
<FormGroup row> <FormGroup row>
@ -83,11 +97,18 @@ import {Spacer} from '../layout';
<Form horizontal> <Form horizontal>
<FormGroup row> <FormGroup row>
<Col xs='12'> <Col xs='12'>
<Input <Table>
id='menu' <thead>
type='text' <tr>
placeholder='favicon.ico' <th>Position</th>
value={ siteStore.config.favicon } /> <th>Label</th>
<th>Page</th>
</tr>
</thead>
<tbody>
{ menu }
</tbody>
</Table>
</Col> </Col>
</FormGroup> </FormGroup>
</Form> </Form>

View File

@ -77,14 +77,14 @@ export class PageEditor extends Component {
<Form horizontal> <Form horizontal>
<FormGroup row> <FormGroup row>
<Col xs='2'> <Col xs='2'>
<Label for='name'>Name</Label> <Label for='title'>Title</Label>
</Col> </Col>
<Col xs='10' > <Col xs='10' >
<Input <Input
id='name' id='title'
type='text' type='text'
placeholder='Name' placeholder='Name'
value={ pageStore.name } /> value={ pageStore.title } />
</Col> </Col>
</FormGroup> </FormGroup>
<FormGroup row> <FormGroup row>