|
| 1 | +/* |
| 2 | +* |
| 3 | +* Header |
| 4 | +* |
| 5 | +*/ |
| 6 | + |
| 7 | +importReactfrom'react' |
| 8 | +import{inject,observer}from'mobx-react' |
| 9 | +importkeydownfrom'react-keydown' |
| 10 | + |
| 11 | +// import Link from 'next/link' |
| 12 | +import{Button}from'../../components' |
| 13 | + |
| 14 | +import{ |
| 15 | +makeDebugger, |
| 16 | +storeSelector, |
| 17 | +getSVGIconPath, |
| 18 | +}from'../../utils/functions' |
| 19 | + |
| 20 | +import{ |
| 21 | +Header, |
| 22 | +Router, |
| 23 | +Admin, |
| 24 | +Search, |
| 25 | +Notification, |
| 26 | +HeaderIcon, |
| 27 | +User, |
| 28 | +}from'./styles' |
| 29 | + |
| 30 | +import*aslogicfrom'./logic' |
| 31 | + |
| 32 | +constdebug=makeDebugger('C:Header') |
| 33 | + |
| 34 | +classHeaderContainerextendsReact.Component{ |
| 35 | +componentWillMount(){ |
| 36 | +debug('mount') |
| 37 | +logic.init(this.props.header) |
| 38 | +} |
| 39 | + |
| 40 | +/* eslint-disable class-methods-use-this */ |
| 41 | + @keydown(['ctrl+p']) |
| 42 | +openDoraemon(){ |
| 43 | +// debug('openDoraemon') |
| 44 | +logic.openDoraemon() |
| 45 | +} |
| 46 | +/* eslint-enable class-methods-use-this */ |
| 47 | + |
| 48 | +render(){ |
| 49 | +return( |
| 50 | +<Headerid="whereCallShowDoraemon"> |
| 51 | +<Router>Javascript / Elixir / go</Router> |
| 52 | +<Admin> |
| 53 | +<Button>管理页</Button> |
| 54 | +</Admin> |
| 55 | +<SearchonClick={logic.openDoraemon}> |
| 56 | +<HeaderIconpath={getSVGIconPath('header_search')}/> |
| 57 | +</Search> |
| 58 | +<NotificationonClick={logic.openPreview}> |
| 59 | +<HeaderIconpath={getSVGIconPath('notification')}/> |
| 60 | +</Notification> |
| 61 | +<UseronClick={logic.openPreview.bind(this,'user')}> |
| 62 | +<HeaderIconpath={getSVGIconPath('header_user')}/> |
| 63 | +</User> |
| 64 | +</Header> |
| 65 | +) |
| 66 | +} |
| 67 | +} |
| 68 | + |
| 69 | +exportdefaultinject(storeSelector('header'))(observer(HeaderContainer)) |