UNPKG

3.56 kBJSXView Raw
1/**
2 * Style for ApConfirmDialog.
3 * @constructor ApConfirmDialogStyle
4 */
5
6'use strict'
7
8import React, {PropTypes as types} from 'react'
9import {ApStyle} from 'apeman-react-style'
10
11/** @lends ApConfirmDialogStyle */
12let ApConfirmDialogStyle = React.createClass({
13 propTypes: {
14 scoped: types.bool,
15 style: types.object,
16 buttonHeight: types.number,
17 highlightColor: types.string
18 },
19 getDefaultProps () {
20 return {
21 scoped: false,
22 style: {},
23 buttonHeight: 32,
24 highlightColor: ApStyle.DEFAULT_HIGHLIGHT_COLOR,
25 errorColor: ApStyle.ERROR_COLOR
26 }
27 },
28 render () {
29 const s = this,
30 {props} = s;
31
32 let buttonHeight = props.buttonHeight,
33 highlightColor = props.highlightColor,
34 errorColor = props.errorColor,
35 checkboxHeight = 32;
36
37 let data = {
38 '.ap-confirm-dialog .ap-dialog-body': {
39 paddingBottom: `${buttonHeight + 8}px`,
40 textAlign: `center`
41 },
42 '.ap-confirm-dialog .ap-dialog-close-button-icon': {},
43 '.ap-confirm-dialog-control': {
44 display: `block`,
45 textAlign: `center`,
46 position: `relative`,
47 left: 0,
48 right: 0,
49 bottom: 0,
50 backgroundColor: `rgba(255,255,255,0.9)`,
51 padding: `16px 0`
52 },
53 '.ap-confirm-dialog-button': {
54 display: `inline-block`,
55 width: `80%`,
56 textAlign: `center`,
57 border: `1px solid #EEE`,
58 margin: `0 auto`,
59 background: `${highlightColor}`,
60 color: `white`,
61 boxSizing: `border-box`,
62 maxWidth: `320px`
63 },
64 '.ap-confirm-dialog-button-disabled, .ap-confirm-dialog-button-disabled:hover, .ap-confirm-dialog-button-disabled:active': {
65 cursor: `default`,
66 boxShadow: `none`,
67 color: `#888`,
68 borderColor: `#888`,
69 backgroundColor: `#F0F0F0`
70 },
71 '.ap-confirm-dialog-checkbox': {
72 margin: `8px auto`,
73 lineHeight: `${checkboxHeight}px`,
74 textAlign: `left`
75 },
76 '.ap-confirm-dialog-checkbox i:before': {
77 lineHeight: `${checkboxHeight}px`
78 },
79 '.ap-confirm-dialog-message': {
80 fontSize: `smaller`,
81 padding: `16px 0`
82 },
83 '.ap-confirm-dialog-err': {
84 fontSize: `smaller`,
85 textAlign: `center`,
86 color: `${errorColor}`,
87 fontStyle: `italic`
88 }
89 },
90 smallMediaData = {},
91 mediumMediaData = {},
92 largeMediaData = {}
93 return (
94 <ApStyle scoped={ props.scoped }
95 data={ Object.assign(data, props.style) }
96 smallMediaData={ smallMediaData }
97 mediumMediaData={ mediumMediaData }
98 largeMediaData={ largeMediaData }
99 >{ props.children }</ApStyle>
100 )
101 }
102})
103
104module.exports = ApConfirmDialogStyle;