1 |
|
2 |
|
3 |
|
4 |
|
5 | 'use strict'
|
6 |
|
7 | import React, {PropTypes as types} from 'react'
|
8 | import classnames from 'classnames'
|
9 | import ApPhoto from './ap_photo'
|
10 | import {ApPureMixin} from 'apeman-react-mixins'
|
11 |
|
12 |
|
13 | const ApPaperPhoto = React.createClass({
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 | propTypes: {
|
20 |
|
21 | imgSrc: types.string.isRequired,
|
22 |
|
23 | imgWidth: types.number,
|
24 |
|
25 | imgHeight: types.number,
|
26 |
|
27 | imgScale: types.string,
|
28 |
|
29 | onTap: types.func
|
30 | },
|
31 |
|
32 | mixins: [
|
33 | ApPureMixin
|
34 | ],
|
35 |
|
36 | statics: {},
|
37 |
|
38 | getInitialState () {
|
39 | return {}
|
40 | },
|
41 |
|
42 | getDefaultProps () {
|
43 | return {
|
44 | imgSrc: null,
|
45 | imgWidth: 256,
|
46 | imgHeight: 192,
|
47 | imgScale: 'fill',
|
48 | onTap: null
|
49 | }
|
50 | },
|
51 |
|
52 | render () {
|
53 | const s = this
|
54 | let { props } = s
|
55 |
|
56 | let { imgWidth, imgHeight } = props
|
57 |
|
58 | return (
|
59 | <ApPhoto className={ classnames('ap-paper-photo', props.className)}
|
60 | imgSrc={ props.imgSrc }
|
61 | imgWidth={ imgWidth }
|
62 | imgHeight={ imgHeight }
|
63 | imgScale={ props.imgScale }
|
64 | onTap={ props.onTap }>
|
65 | <div className="ap-paper-photo-shadow ap-paper-photo-shadow-left"/>
|
66 | <div className="ap-paper-photo-shadow ap-paper-photo-shadow-right"/>
|
67 | <div className="ap-paper-photo-text">
|
68 | { props.children }
|
69 | </div>
|
70 | </ApPhoto>
|
71 | )
|
72 | }
|
73 | })
|
74 |
|
75 | export default ApPaperPhoto
|