mirror of
https://github.com/fazo96/ipfs-boards
synced 2025-01-09 12:19:49 +01:00
wip boards view
This commit is contained in:
parent
067973533a
commit
752799e0a8
@ -1,6 +1,6 @@
|
||||
import React, { Component } from 'react';
|
||||
import { Switch, Route, withRouter } from 'react-router-dom';
|
||||
import Feed from './Feed'
|
||||
import Boards from '../containers/Boards'
|
||||
import PostEditor from '../containers/PostEditor'
|
||||
import 'semantic-ui-css/semantic.css'
|
||||
|
||||
@ -8,8 +8,8 @@ class App extends Component {
|
||||
render() {
|
||||
return (
|
||||
<Switch>
|
||||
<Route path='/post/new' component={PostEditor} />
|
||||
<Route path='/' component={Feed} />
|
||||
<Route path='/p/new' component={PostEditor} />
|
||||
<Route path='/' component={Boards} />
|
||||
</Switch>
|
||||
);
|
||||
}
|
||||
|
9
src/components/Boards.js
Normal file
9
src/components/Boards.js
Normal file
@ -0,0 +1,9 @@
|
||||
import React from 'react'
|
||||
import { List } from 'semantic-ui-react'
|
||||
import BoardsItem from './BoardsItem'
|
||||
|
||||
export default function Boards({ boards }) {
|
||||
return <List divided relaxed>
|
||||
{boards.map(board => <BoardsItem {...board} />)}
|
||||
</List>
|
||||
}
|
12
src/components/BoardsItem.js
Normal file
12
src/components/BoardsItem.js
Normal file
@ -0,0 +1,12 @@
|
||||
import React from 'react'
|
||||
import { List } from 'semantic-ui-react'
|
||||
|
||||
export default function BoardsItem(props) {
|
||||
return <List.Item>
|
||||
<List.Icon name='board' size='large' verticalAlign='middle' />
|
||||
<List.Content>
|
||||
<List.Header>Board Name</List.Header>
|
||||
<List.Description>Updated 10 mins ago</List.Description>
|
||||
</List.Content>
|
||||
</List.Item>
|
||||
}
|
0
src/containers/Board.js
Normal file
0
src/containers/Board.js
Normal file
24
src/containers/Boards.js
Normal file
24
src/containers/Boards.js
Normal file
@ -0,0 +1,24 @@
|
||||
import React from 'react'
|
||||
import { connect } from 'react-redux'
|
||||
import BoardsComponent from '../components/Boards'
|
||||
|
||||
function Boards({ boards }) {
|
||||
return <BoardsComponent boards={boards} />
|
||||
}
|
||||
|
||||
function mapStateToProps(state){
|
||||
return {
|
||||
boards: state.boards.boards
|
||||
}
|
||||
}
|
||||
|
||||
function mapDispatchToProps(dispatch){
|
||||
return {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(Boards)
|
13
src/reducers/boards.js
Normal file
13
src/reducers/boards.js
Normal file
@ -0,0 +1,13 @@
|
||||
|
||||
function getInitialState() {
|
||||
return {
|
||||
boards: []
|
||||
}
|
||||
}
|
||||
|
||||
export default function BoardsReducer(state = getInitialState(), action) {
|
||||
switch (action.type) {
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
}
|
@ -1,6 +1,8 @@
|
||||
import { combineReducers } from 'redux'
|
||||
import postReducer from './post'
|
||||
import boardsReducer from './boards'
|
||||
|
||||
export default combineReducers({
|
||||
postEditor: postReducer
|
||||
postEditor: postReducer,
|
||||
boards: boardsReducer
|
||||
})
|
Loading…
Reference in New Issue
Block a user