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 ApConfirmDialogStyle = React.createClass({
|
13 | propTypes: {
|
14 | style: types.object,
|
15 | buttonHeight: types.number,
|
16 | highlightColor: types.string
|
17 | },
|
18 | getDefaultProps () {
|
19 | return {
|
20 | style: {},
|
21 | buttonHeight: 32,
|
22 | highlightColor: ApStyle.DEFAULT_HIGHLIGHT_COLOR,
|
23 | errorColor: ApStyle.ERROR_COLOR
|
24 | }
|
25 | },
|
26 | statics: {
|
27 | styleData (config) {
|
28 | let {
|
29 | buttonHeight,
|
30 | highlightColor,
|
31 | errorColor
|
32 | } = config
|
33 | let checkboxHeight = 32
|
34 | return {
|
35 | all: {
|
36 | '.ap-confirm-dialog .ap-dialog-body': {
|
37 | paddingBottom: `${buttonHeight + 8}px`,
|
38 | textAlign: 'center'
|
39 | },
|
40 | '.ap-confirm-dialog .ap-dialog-close-button-icon': {},
|
41 | '.ap-confirm-dialog-control': {
|
42 | display: 'block',
|
43 | textAlign: 'center',
|
44 | position: 'relative',
|
45 | left: 0,
|
46 | right: 0,
|
47 | bottom: 0,
|
48 | backgroundColor: `rgba(255,255,255,0.9)`,
|
49 | padding: `16px 0`
|
50 | },
|
51 | '.ap-confirm-dialog-button': {
|
52 | display: 'inline-block',
|
53 | width: `80%`,
|
54 | textAlign: 'center',
|
55 | border: `1px solid #EEE`,
|
56 | margin: `0 auto`,
|
57 | background: `${highlightColor}`,
|
58 | color: 'white',
|
59 | boxSizing: `border-box`,
|
60 | maxWidth: `320px`
|
61 | },
|
62 | '.ap-confirm-dialog-button-disabled, .ap-confirm-dialog-button-disabled:hover, .ap-confirm-dialog-button-disabled:active': {
|
63 | cursor: `default`,
|
64 | boxShadow: 'none',
|
65 | color: `#888`,
|
66 | borderColor: `#888`,
|
67 | backgroundColor: `#F0F0F0`
|
68 | },
|
69 | '.ap-confirm-dialog-checkbox': {
|
70 | margin: `8px auto`,
|
71 | lineHeight: `${checkboxHeight}px`,
|
72 | textAlign: 'left'
|
73 | },
|
74 | '.ap-confirm-dialog-checkbox i:before': {
|
75 | lineHeight: `${checkboxHeight}px`
|
76 | },
|
77 | '.ap-confirm-dialog-message': {
|
78 | fontSize: `smaller`,
|
79 | padding: `16px 0`
|
80 | },
|
81 | '.ap-confirm-dialog-err': {
|
82 | fontSize: `smaller`,
|
83 | textAlign: 'center',
|
84 | color: `${errorColor}`,
|
85 | fontStyle: `italic`
|
86 | }
|
87 | },
|
88 | small: {},
|
89 | medium: {},
|
90 | large: {}
|
91 | }
|
92 | }
|
93 | },
|
94 | render () {
|
95 | const s = this
|
96 | let { props } = s
|
97 |
|
98 | let { all, small, medium, large } = ApConfirmDialogStyle.styleData(props)
|
99 |
|
100 | return (
|
101 | <ApStyle data={ Object.assign(all, props.style) }
|
102 | smallMediaData={ small }
|
103 | mediumMediaData={ medium }
|
104 | largeMediaData={ large }
|
105 | >{ props.children }</ApStyle>
|
106 | )
|
107 | }
|
108 | })
|
109 |
|
110 | export default ApConfirmDialogStyle
|