Fakultas Ilmu Komputer UI

Commit 481e7ba7 authored by sirinbaisa's avatar sirinbaisa
Browse files

[#42][#140653601] Tambahan Top menu

parent 99509ca8
import React from 'react';
import TopMenu from './components/TopMenu';
import Footer from './components/Footer';
import Server from './lib/Server';
const defaultPicture = 'http://semantic-ui.com/images/avatar/small/elliot.jpg';
export default class Dashboard extends React.Component {
static propTypes = {
user: React.PropTypes.object.isRequired,
route: React.PropTypes.object.isRequired,
params: React.PropTypes.object.isRequired,
children: React.PropTypes.oneOfType([
React.PropTypes.arrayOf(React.PropTypes.node),
React.PropTypes.node,
]).isRequired,
user: React.PropTypes.object.isRequired,
};
static getInfo(user) {
const role = user.role;
if (role === 'student') {
return user.data.student;
} else if (role === 'company') {
return user.data.company;
}
return 0;
}
constructor(props) {
super(props);
/* istanbul ignore next */
const data = Dashboard.getInfo(this.props.user);
this.state = {
id: data.id,
name: data.name,
email: data.user.email,
photo: data.photo,
};
}
render = () => (
<div>
<TopMenu user={this.props.user} />
<div className="content"> {this.props.children} </div>
<Footer />
<TopMenu
name={this.state.name} email={this.state.email}
photo={this.state.photo ? this.state.photo : defaultPicture}
/>
{this.props.children}
</div>
)
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment