Removing old topbar

This commit is contained in:
Unknown committed 2018-11-08 14:31:48 +01:00
1 parent 2a8aa2e095
commit a53266f050
4 files changed
+77 -119

No files matched your search

-23
View File
@@ -1,23 +0,0 @@
import {
Search,
GamepadRounded,
AccessibilityNew,
LibraryAdd,
} from '@material-ui/icons';
const data = [
{
title: 'Look for an event', to: '/events/', icon: Search, text: '',
},
{
title: 'Events you are enrolled in', to: '/events/my', icon: GamepadRounded, text: '',
},
{
title: 'Your hosted competition', to: '/events/host', icon: AccessibilityNew, text: '',
},
{
title: 'Host a new competition', to: '/events/create', icon: LibraryAdd, text: '',
},
];
export default data;
+33 -34
View File
@@ -1,43 +1,42 @@
import React from 'react';
import { Link } from 'react-router-dom';
import classNames from 'classnames';
import {
AppBar, Toolbar, Typography, Button,
} from '@material-ui/core';
import { Typography } from '@material-ui/core';
import { withStyles } from '@material-ui/core/styles';
import datas from './data';
import styles from './styles';
const TopBar = ({ classes }) => {
const buttons = datas.map((data, index) => {
const Icon = data.icon;
class TopBar extends React.Component {
render() {
const {
classes,
size,
title,
text,
} = this.props;
if (size === 'big') {
return (
<div className={classes.rootBig}>
<div className={classes.captions}>
<Typography className={classes.title} variant='headline' align='center'>{title}</Typography>
<Typography className={classes.text} variant='subheading' align='center'>{text}</Typography>
</div>
</div>
);
}
if (size === 'medium') {
return (
<div className={classes.rootMedium}>
<div className={classes.captions}>
<Typography className={classes.title} variant='headline' align='center'>{title}</Typography>
<Typography className={classes.text} variant='subheading' align='center'>{text}</Typography>
</div>
</div>
);
}
return (
<Button
key={index}
variant='text'
size='small'
className={classNames(classes.button, classes.cssRoot)}
title={data.title}
component={Link}
to={data.to}>
<Icon className={classNames(classes.leftIcon, classes.iconSmall)} />
{data.text}
</Button>);
});
return (
<div className={classes.root}>
<AppBar position='static' color='secondary'>
<Toolbar>
<Typography variant='h5' color='inherit' className={classes.flex}>
Manage competition
</Typography>
{buttons}
</Toolbar>
</AppBar>
</div>
);
};
<div className={classes.rootSmall} />
);
}
}
export default withStyles(styles)(TopBar);
+31 -19
View File
@@ -1,26 +1,38 @@
const styles = theme => ({
root: {
flexGrow: 1,
const styles = () => ({
rootBig: {
backgroundImage: 'url(https://aacorporatesitedevelop.azurewebsites.net/img/photos/connect.jpg)',
width: '100%',
height: '100vh',
},
flex: {
flexGrow: 1,
marginLeft: 30,
rootMedium: {
backgroundImage: 'url(https://aacorporatesitedevelop.azurewebsites.net/img/photos/connect.jpg)',
width: '100%',
height: '50vh',
},
cssRoot: {
color: '#FFFFFF',
backgroundColor: theme.palette.secondary,
'&:hover': {
backgroundColor: theme.palette.dark,
},
whiteSpace: 'nowrap',
paddingRight: 2 * theme.spacing.unit,
paddingLeft: 2 * theme.spacing.unit,
rootSmall: {
backgroundImage: 'url(https://aacorporatesitedevelop.azurewebsites.net/img/photos/connect.jpg)',
width: '100%',
height: '220px',
},
leftIcon: {
marginRight: theme.spacing.unit,
captions: {
position: 'relative',
top: '50%',
transform: 'translateY(-50%)',
},
iconSmall: {
fontSize: 20,
title: {
fontFamily: 'Saira',
color: 'white',
fontSize: '64px',
lineHeight: '78px',
fontWeight: 100,
},
text: {
fontFamily: 'Saira',
color: 'white',
fontSize: '20px',
lineHeight: '30px',
fontWeight: 600,
padding: '20px 0 0.5em 0',
},
});
+13 -43
View File
@@ -1,56 +1,26 @@
import React, { Component } from 'react';
import React from 'react';
import { Route, Switch } from 'react-router-dom';
import { MuiPickersUtilsProvider } from 'material-ui-pickers';
import LuxonUtils from 'material-ui-pickers/utils/luxon-utils';
import { getItem } from './utils/local-storage';
import TopBar from './Components/TopBar';
import Search from './Components/Search';
import Events from './Components/Events';
import HostedEvents from './Components/HostedEvents';
import EditEvent from './Components/Event/Edit';
import CreateEvent from './Components/Event/Create';
class App extends Component {
constructor(props) {
super(props);
this.state = {
user: null,
};
}
async componentDidMount() {
let user = await getItem('user');
if (user !== null && user !== undefined && user !== 'undefined') {
user = JSON.parse(user);
this.setState({ user });
}
}
render() {
let loggedIn;
if (this.state.user !== null) {
loggedIn = (<TopBar match={this.props.match} user={this.state.user} />);
} else {
loggedIn = '';
}
return (
<MuiPickersUtilsProvider utils={LuxonUtils}>
{loggedIn}
<Switch>
<Route exact path='/events/' component={Search} />
<Route path='/events/my' component={Events} />
<Route path='/events/create' component={CreateEvent} />
<Route path='/events/edit/:slug' component={EditEvent} />
<Route path='/events/show/:slug' component={EditEvent} />
<Route path='/events/host' component={HostedEvents} />
</Switch>
</MuiPickersUtilsProvider>
);
}
}
const App = () => (
<MuiPickersUtilsProvider utils={LuxonUtils}>
<Switch>
<Route exact path='/events/' component={Search} />
<Route path='/events/my' component={Events} />
<Route path='/events/create' component={CreateEvent} />
<Route path='/events/edit/:slug' component={EditEvent} />
<Route path='/events/show/:slug' component={EditEvent} />
<Route path='/events/host' component={HostedEvents} />
</Switch>
</MuiPickersUtilsProvider>
);
export default App;