1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 | 'use strict'
|
7 |
|
8 | import React, {PropTypes as types} from 'react'
|
9 | import {ApStyle} from 'apeman-react-style'
|
10 |
|
11 |
|
12 | const ApSpinnerStyle = React.createClass({
|
13 | propTypes: {
|
14 | type: types.string,
|
15 | style: types.object
|
16 | },
|
17 | getDefaultProps () {
|
18 | return {
|
19 | type: 'text/css',
|
20 | style: {}
|
21 | }
|
22 | },
|
23 | statics: {
|
24 | styleData (config) {
|
25 | return {
|
26 | all: {
|
27 | '.ap-spinner': {
|
28 | textAlign: 'center',
|
29 | display: 'none'
|
30 | },
|
31 | '.ap-spinner.ap-spinner-enabled': {
|
32 | display: 'inline-flex',
|
33 | justifyContent: 'center',
|
34 | alignItems: 'center',
|
35 | width: '100%',
|
36 | height: '100%'
|
37 | },
|
38 | '.ap-spinner-icon': {
|
39 | display: 'inline-block',
|
40 | margin: '0 4px',
|
41 | transition: 'opacity 100ms',
|
42 | opacity: 1
|
43 | },
|
44 | '.ap-spinner-cover': {
|
45 | position: 'absolute',
|
46 | left: 0,
|
47 | top: 0,
|
48 | right: 0,
|
49 | bottom: 0,
|
50 | zIndex: 4,
|
51 | justifyContent: 'center',
|
52 | alignItems: 'center',
|
53 | background: ApStyle.COVER_BACKGROUND,
|
54 | color: ApStyle.COVER_COLOR
|
55 | }
|
56 | },
|
57 | small: {},
|
58 | medium: {},
|
59 | large: {}
|
60 | }
|
61 | }
|
62 | },
|
63 | render () {
|
64 | const s = this
|
65 | let { props } = s
|
66 |
|
67 | let { all, small, medium, large } = ApSpinnerStyle.styleData(props)
|
68 |
|
69 | return (
|
70 | <ApStyle data={ Object.assign(all, props.style) }
|
71 | smallMediaData={ small }
|
72 | mediumMediaData={ medium }
|
73 | largeMediaData={ large }
|
74 | >{ props.children }</ApStyle>
|
75 | )
|
76 | }
|
77 | })
|
78 |
|
79 | export default ApSpinnerStyle
|