Fakultas Ilmu Komputer UI
Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Fasilkom UI Open Source Software
Kape
Commits
481e7ba7
Commit
481e7ba7
authored
May 22, 2017
by
sirinbaisa
Browse files
[#42][#140653601] Tambahan Top menu
parent
99509ca8
Changes
1
Hide whitespace changes
Inline
Side-by-side
assets/js/Dashboard.jsx
View file @
481e7ba7
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
>
)
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment