.sass-cache
6 years ago
deprecated
6 years ago
block.js
6 years ago
component.js
6 years ago
style.css
6 years ago
style.css.map
6 years ago
style.scss
6 years ago
component.js
90 lines
| 1 | import React from 'react'; |
| 2 | |
| 3 | export class Component extends React.Component { |
| 4 | |
| 5 | render() { |
| 6 | |
| 7 | let buttonColorCustom = this.props.lbColorCustom; |
| 8 | let buttonColor = this.props.lbColor; |
| 9 | let buttonType = this.props.lbType; |
| 10 | let buttonAlign = this.props.lbAlign; |
| 11 | let buttonSize = this.props.lbSize; |
| 12 | let buttonUrl = this.props.lbUrl; |
| 13 | let buttonTarget = this.props.lbTarget; |
| 14 | let fontAwesomeIconBefore = this.props.lbFontAwesomeIconBefore; |
| 15 | let fontAwesomeIconAfter = this.props.lbFontAwesomeIconAfter; |
| 16 | let richText = this.props.lbRichtext; |
| 17 | let subCaption = this.props.lbsubCaption; |
| 18 | let 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 | } else if (!buttonColorCustom) { |
| 46 | // 塗り |
| 47 | if (buttonType === '0') { |
| 48 | aClass = `${aClass} btn-${buttonSize} btn-${buttonColor}`; |
| 49 | aStyle = null; |
| 50 | // 塗りなし |
| 51 | } else if (buttonType === '1') { |
| 52 | aClass = `${aClass} btn-${buttonSize} btn-outline-${buttonColor}`; |
| 53 | aStyle = null; |
| 54 | } |
| 55 | |
| 56 | } |
| 57 | |
| 58 | if ( buttonAlign === 'block' ){ |
| 59 | aClass = `${aClass} btn-block`; |
| 60 | } |
| 61 | |
| 62 | if (fontAwesomeIconBefore) { |
| 63 | iconBefore = <i className={`${fontAwesomeIconBefore} vk_button_link_before`}></i> ; |
| 64 | } |
| 65 | if (fontAwesomeIconAfter) { |
| 66 | iconAfter = <i className={`${fontAwesomeIconAfter} vk_button_link_after`}></i>; |
| 67 | } |
| 68 | |
| 69 | return ( |
| 70 | <a |
| 71 | href={buttonUrl} |
| 72 | id={'vk_button_link'} |
| 73 | style={aStyle} |
| 74 | className={aClass} |
| 75 | role={'button'} |
| 76 | aria-pressed={true} |
| 77 | target={buttonTarget? '_blank':null} |
| 78 | rel={'noopener noreferrer'} |
| 79 | > |
| 80 | {iconBefore} |
| 81 | {richText} |
| 82 | {iconAfter} |
| 83 | {/*サブキャプションが� |
| 84 | �力された時のみ表示*/} |
| 85 | {subCaption && <p className={'vk_button_link_subCaption'}>{subCaption}</p>} |
| 86 | </a> |
| 87 | ); |
| 88 | } |
| 89 | } |
| 90 |