diff --git a/css/src/metabox.css b/css/src/metabox.css index af7c3ce3f78..a59447ab6da 100644 --- a/css/src/metabox.css +++ b/css/src/metabox.css @@ -42,8 +42,8 @@ display: none; max-width: 600px; width: 100%; - min-height: 100%; height: auto; + min-height: 100%; vertical-align: top; border: 1px solid rgba( 0,0,0,0.2 ); } @@ -74,10 +74,38 @@ padding-top: 16px; } +/* Target only the block-editor. */ +.edit-post-meta-boxes-area__container { + .wpseo-metabox { + .postbox-header { + border-bottom: 1px solid #ddd; + } + + .inside { + background-color: #f1f5f9; + } + + .wpseo-metabox-content { + max-width: none; + padding-top: 32px; + padding-right: 8px; + padding-bottom: 8px; + padding-left: 8px; + } + + .wpseo-metabox-menu, .wpseo-meta-section { + margin: 0 auto; + } + + .wpseo-meta-section.active { + display: block; + } + } +} + .wpseo-metabox-menu { max-width: 600px; padding: 0; - background-color: #fff; } .wpseo-metabox-menu ul { diff --git a/packages/search-metadata-previews/package.json b/packages/search-metadata-previews/package.json index da761a996f8..fd9b7f2ee60 100644 --- a/packages/search-metadata-previews/package.json +++ b/packages/search-metadata-previews/package.json @@ -17,6 +17,7 @@ "scripts": { "build": "yarn clean && yarn build:js", "build:js": "babel src --out-dir build", + "watch": "yarn build:js --watch", "clean": "rm -rf build", "test": "jest", "lint": "eslint . --max-warnings=7" diff --git a/packages/search-metadata-previews/src/snippet-preview/FixedWidthContainer.js b/packages/search-metadata-previews/src/snippet-preview/FixedWidthContainer.js index e75343ca15e..20417f27e2c 100644 --- a/packages/search-metadata-previews/src/snippet-preview/FixedWidthContainer.js +++ b/packages/search-metadata-previews/src/snippet-preview/FixedWidthContainer.js @@ -5,6 +5,8 @@ import PropTypes from "prop-types"; import debounce from "lodash/debounce"; import { __ } from "@wordpress/i18n"; +const isMobileUserAgentRegExp = /mobi/i; + const FixedWidth = styled.div` overflow: auto; width: ${ ( props ) => props.widthValue }px; @@ -19,7 +21,7 @@ const Inner = styled.div` const ScrollHintContainer = styled.div` text-align: center; - margin: 1em 0 5px; + margin: 1rem 0 0.5rem; `; const ScrollHint = styled.div` @@ -30,7 +32,7 @@ const ScrollHint = styled.div` display: inline-block; margin-right: 10px; font-size: 20px; - line-height: inherit; + line-height: 20px; vertical-align: text-top; content: "\\21c4"; box-sizing: border-box; @@ -58,6 +60,7 @@ export default class FixedWidthContainer extends Component { this.state = { showScrollHint: false, + isMobileUserAgent: false, }; this.setContainerRef = this.setContainerRef.bind( this ); @@ -89,10 +92,9 @@ export default class FixedWidthContainer extends Component { * @returns {void} */ determineSize() { - const width = this._container.offsetWidth; - this.setState( { - showScrollHint: width < this.props.width, + showScrollHint: this._container?.offsetWidth !== this._container?.scrollWidth, + isMobileUserAgent: isMobileUserAgentRegExp.test( window?.navigator?.userAgent ), } ); } @@ -111,12 +113,13 @@ export default class FixedWidthContainer extends Component { render() { const { width, padding, children, className, id } = this.props; + const classNameOrId = className || id; const innerWidth = width - 2 * padding; - return + return
- { __( "Scroll to see the preview content.", "wordpress-seo" ) } + { this.state.isMobileUserAgent + ? __( "Drag to view the full preview.", "wordpress-seo" ) + : __( "Scroll to see the preview content.", "wordpress-seo" ) + } } - ; +
; } } diff --git a/packages/search-metadata-previews/src/snippet-preview/SnippetPreview.js b/packages/search-metadata-previews/src/snippet-preview/SnippetPreview.js index 24368cb26c4..18a2ea54e71 100644 --- a/packages/search-metadata-previews/src/snippet-preview/SnippetPreview.js +++ b/packages/search-metadata-previews/src/snippet-preview/SnippetPreview.js @@ -266,8 +266,8 @@ const MobilePartContainer = styled.div` `; const SiteName = styled.div` - line-height: 18x; - font-size: 14px; + line-height: 18x; + font-size: 14px; color: black; max-width: ${ props => props.screenMode === MODE_DESKTOP ? "100%" : MOBILE_SITENAME_LIMIT }; overflow: hidden; @@ -891,9 +891,10 @@ export default class SnippetPreview extends PureComponent { */ /* eslint-disable jsx-a11y/mouse-events-have-key-events */ return ( -
+
-
+
- - Url preview: -
+ + Url preview: +
- -
-
- Test site name +
- example.org - - - › test-slug +
+ Test site name +
+ + example.org + + + › test-slug + + + + + +
+
+
+ + SEO title preview: + +
+
- - - + Test title - +
- - SEO title preview: -
+ + Meta description preview: +
- - Test title - + Test description, %%replacement_variable%%
-
- - Meta description preview: - -
- Test description, %%replacement_variable%% -
-
@@ -809,9 +815,11 @@ exports[`SnippetEditor Mobile mode 1`] = ` Desktop result -
+