-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
145 lines (131 loc) · 4.23 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
/* eslint-disable react/jsx-no-target-blank */
import { Component } from 'react';
import { Card, List, Row, Col, Calendar, Layout, BackTop } from 'antd';
import Link from 'umi/link';
import moment from 'moment';
import 'moment/locale/zh-cn';
import style from './style.less';
import NProgress from 'nprogress'
import 'nprogress/nprogress.css'
import hljs from 'highlight.js'
import marked from 'marked';
marked.setOptions({
renderer: new marked.Renderer(),
gfm: true,
tables: true,
breaks: false,
pedantic: false,
sanitize: false,
smartLists: true,
smartypants: false,
highlight: function(code) {
hljs.initHighlightingOnLoad()
return hljs.highlightAuto(code).value;
},
});
class BasicLayout extends Component {
state = {
menuList: [
{ name: '首页', link: '/' },
{ name: '分类', link: '/categories' },
{ name: '关于', link: '/about' },
],
friendsBlogs: [
{ name: 'fifsky', link: 'https://fifsky.com/' },
{ name: 'JinXin', link: 'https://laravel.sh-jinger.com' },
],
noopener: 'noopener',
};
UNSAFE_componentWillUpdate() {
NProgress.start()
}
componentDidUpdate () {
NProgress.done()
}
static onPanelChange() {
// return console.log(1)
}
render() {
moment.locale('zh-cn');
// moment({ hour:15, minute:10 })
// const startTime = moment()
// startTime.startOf('hour').fromNow()
return (
<div id="app">
<Layout style={{ overflow: 'hidden' }}>
<div className={style.topMargin}/>
<Row type="flex" justify="space-around" gutter={{ xs: 8, sm: 16, md: 24 }}>
<Col span={3} offset={2} className="baseMargin">
<Row>
<Col span={24}>
<Card
title={<div>
<a href="https://github.com/wanchaochao" target="_blank">Little Bug</a>
<br/>
<p className={style.logoText}>努力让编程成为</p>
<br/>
<p className={style.logoText}>一门艺术</p>
</div>}
className={style.blogTitleCard}
>
<List
dataSource={this.state.menuList}
renderItem={item => (<List.Item>
<Link className="center" to={item.link}>{item.name}</Link>
</List.Item>)}
>
</List>
</Card>
</Col>
<Col span={24}>
<Card
className={style.blogBottomTitleCard}
title={<Row>
<Link to="/">
<Col span={12} className={style.cardRightBorder}>
<h5>分类</h5>
<p>8</p>
</Col>
</Link>
<Col span={12}>
<Link to="/categories">
<h5>日志</h5>
<p>25</p>
</Link>
</Col>
</Row>}
>
<div className="center">
<p>友情链接</p>
{this.state.friendsBlogs.map(item => {
return (<span className={style.friendLink} key={item.name}>
<a href={item.link} target="_blank">
{item.name}
</a>
</span>);
})}
</div>
</Card>
</Col>
</Row>
</Col>
<Col span={12}>
{this.props.children}
</Col>
<Col span={6}>
<div style={{ width: 300, border: '1px solid #d9d9d9', borderRadius: 4, backgroundColor: '#fff' }}>
<Calendar fullscreen={false} onPanelChange={BasicLayout.onPanelChange}/>
</div>
</Col>
</Row>
</Layout>
<div>
<BackTop>
<div className={style.antBackTopInner}>UP</div>
</BackTop>
</div>
</div>
);
}
}
export default BasicLayout;