0.41.0
5 years ago
component-deprecated-id.js
5 years ago
component-deprecated-noopenernoreferer-id.js
5 years ago
component-deprecated-span-to-div.js
5 years ago
component-deprecated-subcaption-noNoopnnernoreferer-id.js
5 years ago
component-deprecated.js
5 years ago
componentV1.js
5 years ago
deprecated.js
5 years ago
component-deprecated.js
90 lines
| 1 | const { Component } = wp.element; |
| 2 | |
| 3 | export class VKBButtonDeprecated extends Component { |
| 4 | |
| 5 | render() { |
| 6 | |
| 7 | const buttonColorCustom = this.props.lbColorCustom; |
| 8 | const buttonColor = this.props.lbColor; |
| 9 | const buttonType = this.props.lbType; |
| 10 | const buttonAlign = this.props.lbAlign; |
| 11 | const buttonSize = this.props.lbSize; |
| 12 | const buttonUrl = this.props.lbUrl; |
| 13 | const buttonTarget = this.props.lbTarget; |
| 14 | const fontAwesomeIconBefore = this.props.lbFontAwesomeIconBefore; |
| 15 | const fontAwesomeIconAfter = this.props.lbFontAwesomeIconAfter; |
| 16 | const richText = this.props.lbRichtext; |
| 17 | const subCaption = this.props.lbsubCaption; |
| 18 | const containerClass = ''; |
| 19 | let aClass = ''; |
| 20 | let aStyle = {}; |
| 21 | let iconBefore = ''; |
| 22 | let iconAfter = ''; |
| 23 | |
| 24 | aClass = `btn vk_button_link`; |
| 25 | |
| 26 | if (buttonColorCustom) { |
| 27 | |
| 28 | aClass = `${aClass} btn-primary btn-${buttonSize}`; |
| 29 | |
| 30 | // 塗り |
| 31 | if (buttonType === '0') { |
| 32 | aStyle = { |
| 33 | backgroundColor: buttonColorCustom, |
| 34 | border: `1px solid ${buttonColorCustom}` |
| 35 | }; |
| 36 | // 塗りなし |
| 37 | } else if (buttonType === '1') { |
| 38 | aStyle = { |
| 39 | backgroundColor: 'transparent', |
| 40 | border: '1px solid ' + buttonColorCustom, |
| 41 | color: buttonColorCustom |
| 42 | }; |
| 43 | } |
| 44 | |
| 45 | // カスタムカラーじゃない場合 |
| 46 | } else if (!buttonColorCustom) { |
| 47 | |
| 48 | // 塗り |
| 49 | if (buttonType === '0') { |
| 50 | aClass = `${aClass} btn-${buttonSize} btn-${buttonColor}`; |
| 51 | aStyle = null; |
| 52 | // 塗りなし |
| 53 | } else if (buttonType === '1') { |
| 54 | aClass = `${aClass} btn-${buttonSize} btn-outline-${buttonColor}`; |
| 55 | aStyle = null; |
| 56 | } |
| 57 | |
| 58 | } |
| 59 | |
| 60 | if (buttonAlign === 'block') { |
| 61 | aClass = `${aClass} btn-block`; |
| 62 | } |
| 63 | |
| 64 | |
| 65 | |
| 66 | if (fontAwesomeIconBefore) { |
| 67 | iconBefore = <i className={ `${fontAwesomeIconBefore} vk_button_link_before` }></i>; |
| 68 | } |
| 69 | if (fontAwesomeIconAfter) { |
| 70 | iconAfter = <i className={ `${fontAwesomeIconAfter} vk_button_link_after` }></i>; |
| 71 | } |
| 72 | |
| 73 | return ( |
| 74 | <a |
| 75 | href={ buttonUrl } |
| 76 | className={ aClass } |
| 77 | role={ 'button' } |
| 78 | aria-pressed={ true } |
| 79 | style={ aStyle } |
| 80 | target={ buttonTarget ? '_blank' : null } |
| 81 | > |
| 82 | { iconBefore } |
| 83 | { richText } |
| 84 | { iconAfter } |
| 85 | |
| 86 | </a> |
| 87 | ); |
| 88 | } |
| 89 | } |
| 90 |