UNPKG

2.1 kBJSXView Raw
1/**
2 * Style for ApYesnoDialog.
3 * @constructor ApYesnoDialogStyle
4 */
5
6'use strict'
7
8import React, {PropTypes as types} from 'react'
9import {ApStyle} from 'apeman-react-style'
10
11/** @lends ApYesnoDialogStyle */
12let ApYesnoDialogStyle = 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: 40,
24 highlightColor: '#38E'
25 }
26 },
27 render () {
28 const s = this
29 let { props } = s
30
31 let buttonHeight = props.buttonHeight
32 let highlightColor = props.highlightColor
33
34 let data = {
35 '.ap-yesno-dialog .ap-dialog-body': {
36 paddingBottom: `${buttonHeight + 8}px`
37 },
38 '.ap-yesno-dialog .ap-dialog-close-button-icon': {
39 display: 'none'
40 },
41 '.ap-yesno-dialog-control': {
42 display: 'flex',
43 position: 'absolute',
44 left: 0,
45 right: 0,
46 bottom: 0,
47 backgroundColor: 'rgba(255,255,255,0.9)'
48 },
49 '.ap-yesno-dialog-button': {
50 display: 'block',
51 flex: 1,
52 width: '50%',
53 textAlign: 'center',
54 border: '1px solid #EEE',
55 margin: '0 -1px',
56 color: `${highlightColor}`
57 },
58 '.ap-yesno-dialog-button-text': {
59 display: 'inline-block',
60 width: '100%',
61 boxSizing: 'border-box',
62 lineHeight: `${buttonHeight}px`
63 },
64 '.ap-yesno-dialog-button:hover': {
65 cursor: 'pointer',
66 opacity: 0.9
67 },
68 '.ap-yesno-dialog-button:active': {
69 opacity: 0.6
70 }
71 }
72 let smallMediaData = {}
73 let mediumMediaData = {}
74 let largeMediaData = {}
75 return (
76 <ApStyle scoped={ props.scoped }
77 data={ Object.assign(data, props.style) }
78 smallMediaData={ smallMediaData }
79 mediumMediaData={ mediumMediaData }
80 largeMediaData={ largeMediaData }
81 >{ props.children }</ApStyle>
82 )
83 }
84})
85
86module.exports = ApYesnoDialogStyle