begin styling and using material-ui
This commit is contained in:
parent
3afb854e87
commit
f03cbff9a9
6 changed files with 41 additions and 14 deletions
|
@ -2,8 +2,6 @@ import React from 'react';
|
|||
import Header from './Header';
|
||||
import Channels from './Channel/Channels';
|
||||
|
||||
import './App.scss';
|
||||
|
||||
export default () => {
|
||||
return (
|
||||
<div className='App'>
|
||||
|
|
|
@ -1,17 +1,26 @@
|
|||
import React from 'react';
|
||||
|
||||
import { withStyles } from '@material-ui/core';
|
||||
import ChannelEntry from './ChannelEntry';
|
||||
|
||||
export default ({ channels, clients }) => {
|
||||
const styles = () => ({
|
||||
list: {
|
||||
listStyle: 'none',
|
||||
},
|
||||
});
|
||||
|
||||
const channelList = ({ channels, clients, classes }) => {
|
||||
return (
|
||||
<ul className='channelList'>
|
||||
{channels.map(channel => {
|
||||
return (
|
||||
<div>
|
||||
<ul className={classes.list}>
|
||||
{channels.map(channel => (
|
||||
<li key={channel.id}>
|
||||
<ChannelEntry channel={channel} clients={clients} />
|
||||
</li>
|
||||
);
|
||||
})}
|
||||
</ul>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default withStyles(styles)(channelList);
|
||||
|
|
|
@ -1,7 +1,19 @@
|
|||
import React, { Component } from 'react';
|
||||
import { withStyles } from '@material-ui/core/styles';
|
||||
import { Paper } from '@material-ui/core';
|
||||
import ApiService from '../../services/ApiService';
|
||||
import ChannelList from './ChannelList';
|
||||
|
||||
const styles = theme => ({
|
||||
root: {
|
||||
...theme.mixins.gutters(),
|
||||
paddingTop: theme.spacing.unit * 2,
|
||||
paddingBottom: theme.spacing.unit * 2,
|
||||
margin: `${theme.spacing.unit}px auto`,
|
||||
width: '500px',
|
||||
},
|
||||
});
|
||||
|
||||
class Channels extends Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
@ -24,9 +36,17 @@ class Channels extends Component {
|
|||
|
||||
render() {
|
||||
const { loaded, channels, clients } = this.state;
|
||||
if (!loaded) return <div className='loading'>Loading...</div>;
|
||||
return <ChannelList channels={channels} clients={clients} />;
|
||||
const { classes } = this.props;
|
||||
return (
|
||||
<Paper className={classes.root}>
|
||||
{!loaded ? (
|
||||
<div className='loading'>Loading...</div>
|
||||
) : (
|
||||
<ChannelList channels={channels} clients={clients} />
|
||||
)}
|
||||
</Paper>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default Channels;
|
||||
export default withStyles(styles)(Channels);
|
||||
|
|
0
src/components/Channels.js
Normal file
0
src/components/Channels.js
Normal file
|
@ -12,7 +12,7 @@ const Header = ({ classes }) => {
|
|||
<AppBar position='static'>
|
||||
<Toolbar>
|
||||
<Typography variant='headline' color='inherit'>
|
||||
Cliffbreak.de
|
||||
{'Cliffbreak.de'}
|
||||
</Typography>
|
||||
</Toolbar>
|
||||
</AppBar>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import App from './components/App';
|
||||
import './index.scss';
|
||||
import './index.css';
|
||||
import * as serviceWorker from './serviceWorker';
|
||||
|
||||
ReactDOM.render(<App />, document.getElementById('root'));
|
||||
|
|
Loading…
Reference in a new issue