index.js
59 lines
| 1 | import './editor.scss'; |
| 2 | |
| 3 | const { Component } = wp.element; |
| 4 | const { __ } = wp.i18n; |
| 5 | |
| 6 | const { |
| 7 | Tooltip, |
| 8 | Button, |
| 9 | } = wp.components; |
| 10 | |
| 11 | export default class ResponsiveTabs extends Component { |
| 12 | render() { |
| 13 | const { |
| 14 | onClick, |
| 15 | selectedDevice, |
| 16 | } = this.props; |
| 17 | |
| 18 | return ( |
| 19 | <div className="gb-responsive-tabs"> |
| 20 | <Tooltip text={ __( 'Show options for all devices', 'generateblocks' ) }> |
| 21 | <Button |
| 22 | isLarge |
| 23 | isPressed={ 'desktop' === selectedDevice ? true : false } |
| 24 | onClick={ () => { |
| 25 | onClick( 'desktop' ); |
| 26 | } } |
| 27 | > |
| 28 | { __( 'Desktop', 'generateblocks' ) } |
| 29 | </Button> |
| 30 | </Tooltip> |
| 31 | |
| 32 | <Tooltip text={ __( 'Show options for tablet devices' ) }> |
| 33 | <Button |
| 34 | isLarge |
| 35 | isPressed={ 'tablet' === selectedDevice ? true : false } |
| 36 | onClick={ () => { |
| 37 | onClick( 'tablet' ); |
| 38 | } } |
| 39 | > |
| 40 | { __( 'Tablet', 'generateblocks' ) } |
| 41 | </Button> |
| 42 | </Tooltip> |
| 43 | |
| 44 | <Tooltip text={ __( 'Show options for mobile devices' ) }> |
| 45 | <Button |
| 46 | isLarge |
| 47 | isPressed={ 'mobile' === selectedDevice ? true : false } |
| 48 | onClick={ () => { |
| 49 | onClick( 'mobile' ); |
| 50 | } } |
| 51 | > |
| 52 | { __( 'Mobile', 'generateblocks' ) } |
| 53 | </Button> |
| 54 | </Tooltip> |
| 55 | </div> |
| 56 | ); |
| 57 | } |
| 58 | } |
| 59 |