Skip to content
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

Documentation notice after import #267

Merged
merged 2 commits into from
Sep 19, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions assets/src/Components/DocNotice.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { Icon } from '@wordpress/components';

const DocNotice = ( { data } ) => {
const { text, url } = data;

if ( ! text ) {
return null;
}

return (
<div className="doc-notice">
{ url ? (
<a
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can use the <ExternalLink component from Gutenberg instead of <a as it adds the icon before the link as Design team has asked:

https://developer.wordpress.org/block-editor/reference-guides/components/external-link/

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, makes sense.

href={ url }
target="_blank"
rel="external noreferrer noopener"
>
<Icon icon="external" /> { text }
</a>
) : (
<p>{ text }</p>
) }
</div>
);
};

export default DocNotice;
12 changes: 12 additions & 0 deletions assets/src/Components/ImportModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import classnames from 'classnames';
import ImportModalError from './ImportModalError';
import ImportModalMock from './ImportModalMock';
import CustomTooltip from './CustomTooltip';
import DocNotice from './DocNotice';

import {
createInterpolateElement,
Expand Down Expand Up @@ -826,6 +827,17 @@ const ImportModal = ( {
) : (
<>
<div className="modal-body">
{ 'done' === currentStep &&
! error &&
siteData.doc_url && (
<DocNotice
data={ {
text: __( 'Learn more about this starter site', 'templates-patterns-collection' ),
url: siteData.doc_url,
} }
/>
)
}
{ ! importing && 'done' !== currentStep && ! error ? (
<>
<ModalHead />
Expand Down
13 changes: 13 additions & 0 deletions assets/src/scss/_docnotice.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.doc-notice {
background: #e5f1f7;
color: #0071ae;
width: 100%;
border-radius: 5px;
padding: 10px;
margin-top: 0;
margin-bottom: 30px;
a {
color: #0071ae;
text-decoration: none;
}
}
2 changes: 1 addition & 1 deletion assets/src/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
@import "scss/library";
@import "scss/demo-site-templates";
@import "scss/notification";
@import "scss/docnotice";
@import "scss/custom-tooltip";
@import "scss/license";
@import "scss/feedback";

@import "scss/media-queries";

Loading