Skip to content

Commit

Permalink
Pull changes from wp-calypso
Browse files Browse the repository at this point in the history
  • Loading branch information
sirreal committed Mar 26, 2019
1 parent 7fc90d1 commit ccc5e82
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 21 deletions.
4 changes: 2 additions & 2 deletions extensions/blocks/wordads/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const AD_FORMATS = [
name: __( 'Leaderboard 728x90' ),
tag: 'leaderboard',
width: 728,
editorPadding: 40,
editorPadding: 60,
},
{
height: 50,
Expand All @@ -47,7 +47,7 @@ export const AD_FORMATS = [
name: __( 'Mobile Leaderboard 320x50' ),
tag: 'mobile_leaderboard',
width: 320,
editorPadding: 60,
editorPadding: 100,
},
{
height: 600,
Expand Down
15 changes: 11 additions & 4 deletions extensions/blocks/wordads/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import { __ } from '../../utils/i18n';
import { BlockControls } from '@wordpress/editor';
import { Component, Fragment } from '@wordpress/element';
import { Placeholder } from '@wordpress/components';
import { Placeholder, ToggleControl } from '@wordpress/components';

/**
* Internal dependencies
Expand All @@ -16,9 +16,13 @@ import { icon, title } from './';
import './editor.scss';

class WordAdsEdit extends Component {
handleHideMobileChange = hideMobile => {
this.props.setAttributes( { hideMobile: !! hideMobile } );
};

render() {
const { attributes, setAttributes } = this.props;
const { format } = attributes;
const { format, hideMobile } = attributes;
const selectedFormatObject = AD_FORMATS.filter( ( { tag } ) => tag === format )[ 0 ];

return (
Expand All @@ -37,9 +41,12 @@ class WordAdsEdit extends Component {
height: selectedFormatObject.height + selectedFormatObject.editorPadding,
} }
>
<div className="jetpack-wordads__header">{ __( 'Advertisements' ) }</div>
<Placeholder icon={ icon } label={ title } />
<div className="jetpack-wordads__footer">{ __( 'Report this Ad' ) }</div>
<ToggleControl
checked={ Boolean( hideMobile ) }
label={ __( 'Hide ad on mobile views' ) }
onChange={ this.handleHideMobileChange }
/>
</div>
</div>
</Fragment>
Expand Down
23 changes: 8 additions & 15 deletions extensions/blocks/wordads/editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,6 @@
margin: 0 auto;
}

.jetpack-wordads__header,
.jetpack-wordads__footer {
font-size: 10px;
font-family: sans-serif;
}

.jetpack-wordads__header {
text-align: left;
}

.jetpack-wordads__footer {
text-transform: uppercase;
text-align: right;
}

.jetpack-wordads__ad {
display: flex;
overflow: hidden;
Expand All @@ -30,6 +15,14 @@
.components-placeholder {
flex-grow: 2;
}

.components-toggle-control__label {
line-height: 1.4em;
}

.components-base-control__field {
padding: 7px;
}
}

.jetpack-wordads-leaderboard .components-placeholder {
Expand Down
4 changes: 4 additions & 0 deletions extensions/blocks/wordads/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ export const settings = {
type: 'string',
default: DEFAULT_FORMAT,
},
hideMobile: {
type: 'boolean',
default: false,
},
},

category: 'jetpack',
Expand Down

0 comments on commit ccc5e82

Please sign in to comment.