-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement SeoAnalysis and ReadabilityAnalysis components #492
Implement SeoAnalysis and ReadabilityAnalysis components #492
Conversation
The inputfield should grow vertically when the input is too long for one line
Yes. And it's no problem that that means that it will change in the metabox as well.
Yes
Please ask content or support what are the best posts to use for the links. Please ask Annelieke to create shortlinks for any newly introduced links. |
A concern I have is what'll happen to the current metabox upon merging. Many style changes will be made to make everything look good on the sidebar, but in the process, the original metabox will have the same changes. And what looks good in a sidebar, doesn't necessarily look good in the metabox. I've discussed this with Igor, and concluded that, in the event we make the original metabox unworkable, we should just add the old code and keep that part intact, and make sure this new sidebar is it's own contained code. |
app/KeywordExample.js
Outdated
*/ | ||
render() { | ||
return ( | ||
<Container> | ||
<HelpText text={ [ | ||
"Enter the search term you'd like this post to be found with and see how it would rank. ", | ||
<HelpTextLink key="1" href="https://yoa.st/" target="_blank" rel="noopener"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
target="_blank" rel="noopener"
should be removed as they're overriding the makeOutboundLink()
defaults. Notice noreferrer
is not rendered. Remove these two attributes and makeOutboundLink()
will work as expected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My mistake, missed that. Apologies.
`; | ||
|
||
const KeywordField = styled.input` | ||
border: 3px solid initial; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why initial
? Doesn't seem to work, at least in the shorthand syntax. Chrome and Firefox discard the whole border
property (please check in your browser's inspector). The single property border-color: initial;
seems to work at least in Chrome and Firefox but I guess it's not what we want, because it looks different across browsers.
For other input fields borders we're using $color_input_border
or $color_grey
or directly #ddd
to be consistent with WordPress. Note: the contrast ratio is not sufficient but this should be addressed separately.
margin-top: 0; | ||
|
||
a { | ||
color: ${ colors.$color_snippet_focus }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This point still needs an answer. @hedgefield seems to me we should let links inherit the default WordPress colors for links (default: #0073aa
), as we're already doing for all the links in the meta box. Why we should use a different color?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh that's the default link color, I thought it was the Yoast Blue (the hex code is very similar), which isn't in our colors scss, so I changed it to that. But yes if that's the link color we use everywhere, we should use that.
`; | ||
|
||
const ChangeLanguageLink = makeOutboundLink( styled.a` | ||
color: ${ colors.$color_snippet_focus }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same consideration for links colors, see above
CR 🚧 A few considerations to address. |
<a key="1" href="https://yoa.st/" target="_blank" rel="noopener">Learn more about the Content Analysis Tool.</a>, | ||
] } | ||
/> | ||
<div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could be a <React.Fragment>
, div is not necessary
never mind this is the example app, doesn't matter that much then
CR 👍 |
Acceptance 🚧
|
I've created a sibling pr to deal with the languageNotice. I've decided to create a seperate issue for the styling issues. Mostly because this pr is way too big, but also partially because the styling of the content analysis hasn't been touched that much in this pr, so addressing this here would add even more responsibilities to this pr. The seperate issue: #671 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CR done 🏗
@@ -1,6 +1,7 @@ | |||
import React from "react"; | |||
|
|||
import ContentAnalysis from "../composites/Plugin/ContentAnalysis/components/ContentAnalysis"; | |||
import LanguageNoticeWrapper from "./LanguageNoticeWrapper.js"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe @atimmer mentioned something about not importing files in this manner. Not sure if that's relevant to this or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Anton did say something about importing in this style. But i believe he referred to to importing yoast-components from wordpress-seo.
When importing components from yoast-components in wpseo, exporting the component in the index.js
file of yoast-components, allows you to import it in wordpress-seo directly from yoast-components
.
I didn't do that properly in this pull, so the remark was still valid.
I'll still check with Anton if a similar way of importing is possible within yoast-components itself.
Update: Anton confirmed the new way of importing only applies to when using yoast-components outside the project.
@@ -5,32 +5,92 @@ import styled from "styled-components"; | |||
// Internal dependencies. | |||
import KeywordInput from "../composites/Plugin/Shared/components/KeywordInput"; | |||
import SynonymsSection from "../composites/Plugin/Synonyms/components/SynonymsSection"; | |||
import HelpText from "../composites/Plugin/Shared/components/HelpText.js"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See previous comment regarding this style of important components.
*/ | ||
render() { | ||
return ( | ||
<Container> | ||
<HelpText text={ [ | ||
"Enter the search term you'd like this post to be found with and see how it would rank. ", | ||
<HelpTextLink key="1" href="https://yoa.st/"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this link purely an example?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This example can only be reached in the standalone. Which you can visit by running the dev-server in yoast-components (yarn start
) and going to localhost:3333 in your browser.
import React from "react"; | ||
import styled from "styled-components"; | ||
|
||
import LanguageNotice, { languageNoticePropType } from "../composites/Plugin/Shared/components/LanguageNotice.js"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See previous comment regarding the importing of files.
* @param {String} props.id The id of the KeywordInput. | ||
* @param {IconsButton} props.label The label of the KeywordInput. | ||
* @param {boolean} props.keyword The initial keyword passed to the state. | ||
* @param {Object} props The props for this input field component. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd vouch for being consistent with the usage of names... So instead of speaking of 'this input field component' I'd say 'The props for the KeywordInput'.
app/LanguageNoticeWrapper.js
Outdated
* @param {Object} props The props for this language notice wrapper. | ||
* @param {string} props.changeLanguageLink The URL where the language can be changed. | ||
* @param {bool} props.canChangeLanguage Whether or not the language can be changed. | ||
* @param {string} props.language The current set language. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
current
should be currently
.
* @param {Object} props The props for this language notice wrapper. | ||
* @param {string} props.changeLanguageLink The URL where the language can be changed. | ||
* @param {bool} props.canChangeLanguage Whether or not the language can be changed. | ||
* @param {string} props.language The current set language. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
current
should be currently
.
export default class LanguageNotice extends PureComponent { | ||
/** | ||
* Renders the language notice. Provides a link to a setting page in case of | ||
* administrator, a notice to contact an administrator otherwise. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd recommend rewriting this to something like the following:
'Renders the language notice. Provides a link to a setting page if the currently set language can be changed. Provides a message to contact an administrator otherwise.'
|
||
// Determine the correct text. | ||
let text = canChangeLanguage ? canChangeLanguageText : canNotChangeLanguageText; | ||
// Replace the %s with a strong marked language. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing whitespace above comment.
let text = canChangeLanguage ? canChangeLanguageText : canNotChangeLanguageText; | ||
// Replace the %s with a strong marked language. | ||
text = sprintf( text, `{{strong}}${ language }{{/strong}}` ); | ||
// Replace the strong marking with an actual ReactComponent. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing whitespace above comment.
CR 👍 |
Acceptance 👍 |
Summary
This PR can be summarized in the following changelog entry:
Relevant technical choices:
This PR became a little more involved than the issue would indicate.
@wordpress/i18n
package to replacereact-intl
.react-intl
with the@wordpress/i18n
variant in the makeOutboundLink util.-- Changed the size of the collapsible header arrows.
-- Made the header the "correct" blue:
blue_medium
, aka #1e8cbe.-- The traffic light icons are resized to be slightly smaller
-- The blue headings should be slightly smaller: Same size as the text in the p element (13px) and the 'Focus keyword:' heading.
Related links
Sidebar design: https://github.com/Yoast/roadmap/issues/5#issuecomment-385635913
Keyword input for classic. See error message: Yoast/wordpress-seo#9179 (comment)
Test instructions
This PR can be tested by following these steps:
git checkout stories/475-implement-seo-analysis-component
.yarn install
.yarn start
.yarn install
,yarn link yoast-components
,grunt build
yarn start
.Fixes #475