| 1 |
import { breakpoints } from './preview'; |
| 2 |
import { Button, Grid } from '@elementor/app-ui'; |
| 3 |
|
| 4 |
import './preview-responsive-controls.scss'; |
| 5 |
|
| 6 |
export default function PreviewResponsiveControls( props ) { |
| 7 |
return ( |
| 8 |
<Grid container alignItems="center" justify="center" className="e-kit-library__preview-responsive-controls"> |
| 9 |
{ breakpoints.map( ( { label, value } ) => { |
| 10 |
let className = 'e-kit-library__preview-responsive-controls-item'; |
| 11 |
|
| 12 |
if ( props.active === value ) { |
| 13 |
className += ' e-kit-library__preview-responsive-controls-item--active'; |
| 14 |
} |
| 15 |
|
| 16 |
return ( |
| 17 |
<Button |
| 18 |
key={ value } |
| 19 |
text={ label } |
| 20 |
hideText={ true } |
| 21 |
className={ className } |
| 22 |
icon={ `eicon-device-${ value }` } |
| 23 |
onClick={ () => props.onChange( value ) } |
| 24 |
/> |
| 25 |
); |
| 26 |
} ) } |
| 27 |
</Grid> |
| 28 |
); |
| 29 |
} |
| 30 |
|
| 31 |
PreviewResponsiveControls.propTypes = { |
| 32 |
active: PropTypes.string, |
| 33 |
onChange: PropTypes.func.isRequired, |
| 34 |
}; |
| 35 |
|
| 36 |
PreviewResponsiveControls.defaultProps = { |
| 37 |
active: 'desktop', |
| 38 |
}; |
| 39 |
|