/** * External dependencies */ import { __, sprintf } from '@wordpress/i18n'; import { Button } from '@wordpress/components'; import classnames from 'classnames'; import { Component } from '@wordpress/element'; import interpolateComponents from '@automattic/interpolate-components'; import { WebPreview } from '@woocommerce/components'; import { recordEvent } from '@woocommerce/tracks'; import { Icon, close } from '@wordpress/icons'; import Phone from 'gridicons/dist/phone'; import Tablet from 'gridicons/dist/tablet'; import Computer from 'gridicons/dist/computer'; /** * Internal dependencies */ const devices = [ { key: 'mobile', icon: Phone, }, { key: 'tablet', icon: Tablet, }, { key: 'desktop', icon: Computer, }, ]; 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 ) => { const DeviceTag = device.icon; return ( ); } ) }
); } } export default ThemePreview;