/** * External dependencies */ import { __, sprintf } from '@wordpress/i18n'; import { Button } from '@wordpress/components'; import classnames from 'classnames'; import { Component } from '@wordpress/element'; import interpolateComponents from 'interpolate-components'; import { WebPreview } from '@woocommerce/components'; import { recordEvent } from '@woocommerce/tracks'; /** * Internal dependencies */ const devices = [ { key: 'mobile', icon: 'phone_android', }, { key: 'tablet', icon: 'tablet_android', }, { key: 'desktop', icon: 'desktop_windows', }, ]; class ThemePreview extends Component { constructor() { super( ...arguments ); this.state = { device: 'desktop', }; this.handleDeviceClick = this.handleDeviceClick.bind( this ); } handleDeviceClick( device ) { const { theme } = this.props; recordEvent( 'storeprofiler_store_theme_demo_device', { device, theme: theme.slug, } ); this.setState( { device } ); } render() { const { isBusy, onChoose, onClose, theme } = this.props; const { demo_url: demoUrl, slug, title } = theme; const { device: currentDevice } = this.state; return (
{ interpolateComponents( { /* translators: Describing who a previewed theme is developed by. E.g., Storefront developed by WooCommerce */ mixedString: sprintf( __( '{{strong}}%s{{/strong}} developed by WooCommerce', 'woocommerce-admin' ), title ), components: { strong: , }, } ) }
{ devices.map( ( device ) => ( ) ) }
); } } export default ThemePreview;