Skip to content

Commit 1c9968a

Browse files
My Jetpack: Onboarding i3 | Add help section (#43638)
* My Jetpack: Onboarding i3 | Update help section * Remove double parenthesis * Thank you copilot
1 parent 8df8823 commit 1c9968a

File tree

15 files changed

+381
-16
lines changed

15 files changed

+381
-16
lines changed

pnpm-lock.yaml

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import { ExternalLink } from '@wordpress/components';
2+
import clsx from 'clsx';
3+
import styles from './styles.module.scss';
4+
5+
export type HelpCardProps = {
6+
title: string;
7+
icon: React.ReactNode;
8+
headingTag?: `h${ 1 | 2 | 3 | 4 | 5 | 6 }`;
9+
description?: React.ReactNode;
10+
link?: string;
11+
className?: string;
12+
};
13+
14+
/**
15+
* The component for displaying a help card.
16+
*
17+
* @param {HelpCardProps} props - The component props.
18+
* @return The rendered help card component.
19+
*/
20+
export function HelpCard( {
21+
icon,
22+
title,
23+
headingTag: Heading = 'h3',
24+
description,
25+
link,
26+
className,
27+
}: HelpCardProps ) {
28+
return (
29+
<section className={ clsx( styles.wrapper, className ) }>
30+
{ icon ? <div className={ styles.icon }>{ icon }</div> : null }
31+
<Heading className={ styles.heading }>
32+
{ link ? <ExternalLink href={ link }>{ title }</ExternalLink> : title }
33+
</Heading>
34+
{ description ? <p className={ styles.description }>{ description }</p> : null }
35+
</section>
36+
);
37+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
.wrapper {
2+
width: 100%;
3+
min-width: 20rem;
4+
display: flex;
5+
padding: 1.5rem;
6+
flex-direction: column;
7+
align-items: flex-start;
8+
border-radius: 8px;
9+
border: 1px solid var(--jp-gray-5);
10+
background: var(--jp-white);
11+
}
12+
13+
.icon {
14+
15+
svg {
16+
color: var(--jp-gray-90)
17+
}
18+
}
19+
20+
.heading {
21+
font-size: 1.25rem;
22+
line-height: 24px;
23+
font-weight: 500;
24+
margin-top: 1.5rem;
25+
margin-bottom: 0.5rem;
26+
27+
:global(.components-external-link__contents) {
28+
color: var(--jp-black);
29+
text-decoration: none;
30+
31+
&:hover {
32+
text-decoration: underline;
33+
}
34+
}
35+
36+
:global(.components-external-link__icon) {
37+
color: var(--jp-black);
38+
text-decoration: none;
39+
font-weight: 400;
40+
font-size: 0.875rem;
41+
margin-inline-start: 0.5rem;
42+
}
43+
}
44+
45+
.description {
46+
font-size: 0.8125rem;
47+
line-height: 20px;
48+
color: var(--jp-gray-80);
49+
font-weight: 400;
50+
margin-block: 0;
51+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/**
2+
* Code icon component
3+
*
4+
* @return The rendered component.
5+
*/
6+
export function CodeIcon() {
7+
return (
8+
<svg xmlns="http://www.w3.org/2000/svg" width="25" height="24" viewBox="0 0 25 24" fill="none">
9+
<path
10+
d="M21.1333 10.7004L16.8333 6.40039L15.7333 7.50039L20.0333 11.8004C20.1333 11.9004 20.1333 12.1004 20.0333 12.2004L15.7333 16.5004L16.8333 17.6004L21.1333 13.3004C21.8333 12.5004 21.8333 11.4004 21.1333 10.7004ZM4.5333 11.8004L8.8333 7.50039L7.8333 6.50039L3.5333 10.8004C2.8333 11.5004 2.8333 12.6004 3.5333 13.3004L7.8333 17.6004L8.9333 16.5004L4.6333 12.2004C4.4333 12.1004 4.4333 11.9004 4.5333 11.8004Z"
11+
fill="currentColor"
12+
/>
13+
</svg>
14+
);
15+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/**
2+
* Comment icon component
3+
*
4+
* @return The rendered component.
5+
*/
6+
export function CommentIcon() {
7+
return (
8+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
9+
<path
10+
d="M18 4H6C4.9 4 4 4.9 4 6V18.9C4 19.5 4.5 20 5.1 20C5.4 20 5.6 19.9 5.9 19.7L8.5 17H18C19.1 17 20 16.1 20 15V6C20 4.9 19.1 4 18 4ZM18.5 15C18.5 15.3 18.3 15.5 18 15.5H7.9L5.5 17.9V6C5.5 5.7 5.7 5.5 6 5.5H18C18.3 5.5 18.5 5.7 18.5 6V15Z"
11+
fill="currentColor"
12+
/>
13+
</svg>
14+
);
15+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/**
2+
* Tool icon component
3+
*
4+
* @return The rendered component.
5+
*/
6+
export function ToolIcon() {
7+
return (
8+
<svg xmlns="http://www.w3.org/2000/svg" width="25" height="24" viewBox="0 0 25 24" fill="none">
9+
<path
10+
d="M14.7694 7.12815L17.0294 4.86815C16.3421 4.62306 15.6009 4.57062 14.886 4.71651C14.1711 4.8624 13.5097 5.20107 12.9734 5.69584C12.4371 6.19061 12.0464 6.82264 11.8435 7.52352C11.6406 8.2244 11.6333 8.96742 11.8224 9.67215L6.49437 15.0002C6.30334 15.1846 6.15098 15.4053 6.04616 15.6493C5.94134 15.8934 5.88617 16.1558 5.88386 16.4214C5.88156 16.6869 5.93216 16.9503 6.03272 17.1961C6.13328 17.4419 6.28179 17.6652 6.46958 17.8529C6.65736 18.0407 6.88066 18.1892 7.12646 18.2898C7.37225 18.3904 7.63561 18.441 7.90117 18.4387C8.16673 18.4363 8.42917 18.3812 8.67317 18.2764C8.91718 18.1715 9.13787 18.0192 9.32237 17.8282L14.6514 12.5002C15.3562 12.6893 16.0994 12.682 16.8004 12.4791C17.5014 12.2762 18.1335 11.8854 18.6283 11.3489C19.1231 10.8125 19.4618 10.151 19.6076 9.43588C19.7533 8.7208 19.7007 7.97946 19.4554 7.29215L17.1944 9.55215L15.2824 9.04015L14.7694 7.12815ZM7.55537 16.7682C7.50761 16.722 7.46952 16.6669 7.44331 16.6059C7.41711 16.5449 7.40332 16.4792 7.40274 16.4129C7.40216 16.3465 7.41481 16.2806 7.43995 16.2192C7.46509 16.1577 7.50222 16.1019 7.54917 16.055C7.59611 16.008 7.65194 15.9709 7.71339 15.9457C7.77484 15.9206 7.84068 15.908 7.90707 15.9085C7.97346 15.9091 8.03907 15.9229 8.10007 15.9491C8.16107 15.9753 8.21624 16.0134 8.26237 16.0612C8.35344 16.1555 8.40384 16.2818 8.4027 16.4129C8.40156 16.544 8.34898 16.6694 8.25627 16.7621C8.16357 16.8548 8.03816 16.9073 7.90707 16.9085C7.77597 16.9096 7.64967 16.8592 7.55537 16.7682Z"
11+
fill="currentColor"
12+
/>
13+
</svg>
14+
);
15+
}

projects/packages/my-jetpack/_inc/components/my-jetpack-tab-panel/help-content.tsx

Lines changed: 0 additions & 14 deletions
This file was deleted.
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import { getRedirectUrl } from '@automattic/jetpack-components';
2+
import { __ } from '@wordpress/i18n';
3+
import { HelpCard } from '../../help-card';
4+
import { CodeIcon } from '../../icons/code';
5+
import { CommentIcon } from '../../icons/comment';
6+
import { ToolIcon } from '../../icons/tool';
7+
import styles from './styles.module.scss';
8+
9+
/**
10+
* Renders the help cards for the Help section of My Jetpack.
11+
*
12+
* @return The rendered help cards component.
13+
*/
14+
export function HelpCards() {
15+
return (
16+
<div className={ styles.cards }>
17+
<HelpCard
18+
title={ __( 'Ask us a question', 'jetpack-my-jetpack' ) }
19+
link={ getRedirectUrl( 'jetpack-contact-support' ) }
20+
icon={ <CommentIcon /> }
21+
description={ __(
22+
'Have a question? Our AI Assistant can help, or connect you to our support team.',
23+
'jetpack-my-jetpack'
24+
) }
25+
/>
26+
<HelpCard
27+
title={ __( 'Troubleshooting', 'jetpack-my-jetpack' ) }
28+
link={ getRedirectUrl( 'jetpack-support' ) }
29+
icon={ <ToolIcon /> }
30+
description={ __(
31+
'Having trouble with Jetpack? Check out recommended steps to fix common problems.',
32+
'jetpack-my-jetpack'
33+
) }
34+
/>
35+
<HelpCard
36+
title={ __( 'Jetpack for developers', 'jetpack-my-jetpack' ) }
37+
link={ getRedirectUrl( 'jetpack-for-developers' ) }
38+
icon={ <CodeIcon /> }
39+
description={ __(
40+
'Want to test Jetpack features locally or add Featured Content and Social Links to your theme? Start here.',
41+
'jetpack-my-jetpack'
42+
) }
43+
/>
44+
</div>
45+
);
46+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import { getRedirectUrl } from '@automattic/jetpack-components';
2+
import { Button } from '@wordpress/components';
3+
import { __ } from '@wordpress/i18n';
4+
import { HelpCards } from './cards';
5+
import { HelpFooter } from './footer';
6+
import styles from './styles.module.scss';
7+
8+
/**
9+
* The Help content component.
10+
*
11+
* @return The rendered component.
12+
*/
13+
export function HelpContent() {
14+
return (
15+
<div className={ styles.content }>
16+
<h2>{ __( 'Need assistance?', 'jetpack-my-jetpack' ) }</h2>
17+
<p className={ styles.description }>
18+
{ __(
19+
'Browse our expert guides to get help with setup, features, and troubleshooting.',
20+
'jetpack-my-jetpack'
21+
) }
22+
</p>
23+
<Button
24+
variant="primary"
25+
href={ getRedirectUrl( 'jetpack-support' ) }
26+
target="_blank"
27+
rel="noopener noreferrer"
28+
className={ styles.cta }
29+
>
30+
<span>
31+
{ __( 'Explore our Help Center', 'jetpack-my-jetpack' ) }
32+
<span role="presentation" aria-hidden="true">
33+
&nbsp;
34+
{ '↗' }
35+
</span>
36+
</span>
37+
</Button>
38+
<HelpCards />
39+
<HelpFooter />
40+
</div>
41+
);
42+
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import { getAdminUrl } from '@automattic/jetpack-script-data';
2+
import { ExternalLink } from '@wordpress/components';
3+
import { __ } from '@wordpress/i18n';
4+
import styles from './styles.module.scss';
5+
6+
/**
7+
* Renders the footer for the Help section of My Jetpack.
8+
*
9+
* @return The rendered footer component.
10+
*/
11+
export function HelpFooter() {
12+
return (
13+
<div className={ styles.footer }>
14+
<section>
15+
<h3>{ __( 'Real humans. Real support.', 'jetpack-my-jetpack' ) }</h3>
16+
<p className={ styles.description }>
17+
{ __(
18+
'We are the people behind WordPress.com, WooCommerce, Jetpack, Simplenote, and more. We believe in making the web a better place.',
19+
'jetpack-my-jetpack'
20+
) }
21+
</p>
22+
<ExternalLink
23+
className={ styles[ 'footer-learn-more' ] }
24+
href="https://automattic.com/about/"
25+
>
26+
{ __( 'Learn more about us', 'jetpack-my-jetpack' ) }
27+
</ExternalLink>
28+
29+
<nav
30+
className={ styles[ 'footer-nav' ] }
31+
aria-label={ __( 'Useful links', 'jetpack-my-jetpack' ) }
32+
>
33+
<h4>{ __( 'Useful links', 'jetpack-my-jetpack' ) }</h4>
34+
<ul>
35+
<li>
36+
<a href={ getAdminUrl( 'admin.php?page=jetpack_modules' ) }>
37+
{ __( 'All Jetpack modules', 'jetpack-my-jetpack' ) }
38+
</a>
39+
</li>
40+
<li>
41+
<a href={ getAdminUrl( 'admin.php?page=jetpack-debugger' ) }>
42+
{ __( 'Debug information', 'jetpack-my-jetpack' ) }
43+
</a>
44+
</li>
45+
</ul>
46+
</nav>
47+
</section>
48+
</div>
49+
);
50+
}

0 commit comments

Comments
 (0)