Add Learn more component and use it for blueprint and CLI#2317
Conversation
📊 Performance Test ResultsComparing 55977fa vs trunk site-editor
site-startup
Results are median values from multiple test runs. Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change |
|
Thank you for working on the component, @nightnei. I have tested it, and it looks as described. I think we should wait for Marina's response regarding the button color and arrow icon. Ideally, we should update all "Learn More" buttons across the app to use the newly built component. |
|
Looks good. The only small thing I see is that now in the default window size there is not enough room for the boxes, so the scrollbar appears. We could consider reducing spacing somewhere, e.g., in the footer container, from |
+1 to this one. I think it makes sense to update this everywhere if we are introducing a new component. |
8d40066 to
5bbe864
Compare
sejas
left a comment
There was a problem hiding this comment.
@nightnei, great work! I like the new LearnMoreLink component. That will help standardize its look and feel and usage.
I suggest to keep the link inside the translation to keep the order of text and then learn more link, so RTL languages will display it in the right order too.
| <Button variant="link" onClick={ () => getIpcApi().openURL( AI_GUIDELINES_URL ) } /> | ||
| ), | ||
| } ) } | ||
| { __( 'Powered by experimental AI.' ) } <LearnMoreLink docsLinksKey="a8cAiGuidelines" /> |
There was a problem hiding this comment.
@nightnei , let's keep the createInterpolateElement call. That way it will look better for RTL languages. Something like:
| { __( 'Powered by experimental AI.' ) } <LearnMoreLink docsLinksKey="a8cAiGuidelines" /> | |
| { createInterpolateElement( __( 'Powered by experimental AI. <learn_more_link />' ), { | |
| learn_more_link: <LearnMoreLink docsLinksKey="a8cAiGuidelines" />, | |
| } ) } |
There was a problem hiding this comment.
Great thought, I will update it 👍
| } | ||
|
|
||
| interface SiteFormProps { | ||
| interface CreateSiteFormProps { |
There was a problem hiding this comment.
@sejas, JFYI, you suggested to rename it previously in one of my PRs, but I merged it before noticing your suggestion. I had a personal note of your suggestion, to remember and address in some future PR where such change will suite, so addressing it here :)
| variant="link" | ||
| > | ||
| { __( 'Learn more' ) } | ||
| <ArrowIcon /> |
There was a problem hiding this comment.
Let's remove ArrowIcon for consistency for now, and later we can add it everywhere holistically if we decide it's the way to go.
wojtekn
left a comment
There was a problem hiding this comment.
Looks good to merge. We can update screenshots to cover the latest changes, though.
| const guideLines = getGuidelinesLink(); | ||
| expect( guideLines ).toBeVisible(); | ||
| expect( guideLines ).toHaveTextContent( 'Powered by experimental AI. Learn more' ); | ||
| expect( guideLines ).toHaveTextContent( 'Powered by experimental AI. Learn more↗' ); |
sejas
left a comment
There was a problem hiding this comment.
Thanks for keeping the LearnMoreLink inside the translation. I left a comment for the What’s New modal “Learn more” link; I think we can use the new component there too.
| { learnMoreLabel || ( | ||
| <> | ||
| { __( 'Learn more' ) } | ||
| <ArrowIcon /> |
There was a problem hiding this comment.
Should we use the <LearnMoreLink here? Should we remove the arrow too?
There was a problem hiding this comment.
Should we remove the arrow too?
Removed
Should we use the <LearnMoreLink here?
I was thinking about it and even started to implement, but then reverted changes since:
- We should use custom URL instead of
DocsLinkKey - The text (
learnMoreLabel) can be also custom
I looked at the code and realized that teh custom url and label make the LearnMoreLink quite dificult and they override everythign inside the component, so I decided to keep this place as exception, to keep code simple. I don't have strong preference, but I whould keep it as is till we receive final decision from Marina about the design.
Related issues
Proposed Changes
With this PR, we are adding "Learn more" component, so that it will be used across Studio for consistency.
We are starting with Blueprints and CLI texts.
Testing Instructions