forked from nsjcy/frontEnd/nsjcy

liuwh
2020-02-24 2bcd556961208b80af1cb157633c594faab1eca2
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
import React from 'react';
// import { Link } from 'react-router-dom';
// import { Modal } from 'antd-mobile';
// import { Icon } from 'antd';
import HeadLabel from '../HeadLabel';
import chunk from 'lodash/chunk';
import './index.scss';
 
export default function IndexEntry({ entries, head, onClick }) {
  return (
    <div className="index-entry-main">
      <HeadLabel head={head} />
      {
        chunk(entries, 3).map((entries, index) => (
          <div key={index} className="index-entry-body">
            {
              entries.map((entry, index) => (
                <Entry key={index} {...entry} onClick={onClick} />
              ))
            }
          </div>
        ))
      }
 
    </div>
  );
}
 
function Entry({ icon, text, path, count, onClick }) {
  return (
    <div className="index-entry-item" onClick={() => onClick(path)}>
      <div className="index-entry-wrap">
        <img className="index-entry-icon" src={icon} />
        {
          (count || null) && <div className="index-entry-count">{count}</div>
        }
      </div>
      <div className="index-entry-text">{text}</div>
    </div>
  );
}