/* global fetch */ const { Component } = wp.element; const { Spinner } = wp.components; const { __ } = wp.i18n; class Themes extends Component { state = { themes: [], } componentDidMount() { fetch( 'https://advancedblocks.com/wp-json/codestag/v1/themes' ) .then( ( response ) => response.json() ) .then( ( responseJSON ) => { this.setState( { themes: responseJSON, } ); } ); } render() { const themes = this.state.themes; return ( ( themes.length ) ? ( { __( 'Our beautifully fine-tuned themes at your service' ) } { __( 'Browse through the collections to see which one suits your idea the most, get started!' ) } { themes.map( ( theme, index ) => ( { theme.title } { theme.is_new && { __( 'New' ) } } { theme.title } { theme.subtitle } View { theme.title } ) ) } ) : ( ) ); } } export default Themes;
{ __( 'Browse through the collections to see which one suits your idea the most, get started!' ) }
{ theme.subtitle }