diff --git a/projects/plugins/protect/assets/images/in-progress.png b/projects/plugins/protect/assets/images/in-progress.png deleted file mode 100644 index 7d712a97e66ae..0000000000000 Binary files a/projects/plugins/protect/assets/images/in-progress.png and /dev/null differ diff --git a/projects/plugins/protect/changelog/add-protect-in-progress-animation b/projects/plugins/protect/changelog/add-protect-in-progress-animation new file mode 100644 index 0000000000000..d97fc20bcffe3 --- /dev/null +++ b/projects/plugins/protect/changelog/add-protect-in-progress-animation @@ -0,0 +1,4 @@ +Significance: patch +Type: changed + +Animated the "scan in progress" placeholder image diff --git a/projects/plugins/protect/src/js/components/admin-section-hero/index.tsx b/projects/plugins/protect/src/js/components/admin-section-hero/index.tsx index 1f9f812c83e02..5ed83bebc8638 100644 --- a/projects/plugins/protect/src/js/components/admin-section-hero/index.tsx +++ b/projects/plugins/protect/src/js/components/admin-section-hero/index.tsx @@ -11,6 +11,7 @@ interface AdminSectionHeroProps { main: React.ReactNode; secondary?: React.ReactNode; preserveSecondaryOnMobile?: boolean; + spacing?: number; } interface AdminSectionHeroComponent extends React.FC< AdminSectionHeroProps > { @@ -22,12 +23,13 @@ const AdminSectionHero: AdminSectionHeroComponent = ( { main, secondary, preserveSecondaryOnMobile = true, + spacing = 7, } ) => { return ( ), - secondary: , + secondary: , }; diff --git a/projects/plugins/protect/src/js/components/error-admin-section-hero/index.tsx b/projects/plugins/protect/src/js/components/error-admin-section-hero/index.tsx index f199fa92d9f29..5214531dcf362 100644 --- a/projects/plugins/protect/src/js/components/error-admin-section-hero/index.tsx +++ b/projects/plugins/protect/src/js/components/error-admin-section-hero/index.tsx @@ -1,7 +1,6 @@ import { Text } from '@automattic/jetpack-components'; import { __ } from '@wordpress/i18n'; import { Icon, warning } from '@wordpress/icons'; -import inProgressImage from '../../../../assets/images/in-progress.png'; import AdminSectionHero from '../admin-section-hero'; import ScanNavigation from '../scan-navigation'; import styles from './styles.module.scss'; @@ -38,11 +37,6 @@ const ErrorAdminSectionHero: React.FC< ErrorAdminSectionHeroProps > = ( { } - secondary={ -
- -
- } preserveSecondaryOnMobile={ false } /> ); diff --git a/projects/plugins/protect/src/js/components/error-admin-section-hero/styles.module.scss b/projects/plugins/protect/src/js/components/error-admin-section-hero/styles.module.scss index 3ab653757619a..6f0750abd02f8 100644 --- a/projects/plugins/protect/src/js/components/error-admin-section-hero/styles.module.scss +++ b/projects/plugins/protect/src/js/components/error-admin-section-hero/styles.module.scss @@ -11,17 +11,6 @@ margin-right: var( --spacing-base ); // 8px } -.illustration { - display: flex; - align-items: center; - height: 100%; - img { - // let's fit images - object-fit: cover; - width: 100%; - } -} - .scan-navigation { margin-top: calc( var( --spacing-base ) * 3 ); // 24px } \ No newline at end of file diff --git a/projects/plugins/protect/src/js/components/in-progress-animation/index.tsx b/projects/plugins/protect/src/js/components/in-progress-animation/index.tsx new file mode 100644 index 0000000000000..43666567cff12 --- /dev/null +++ b/projects/plugins/protect/src/js/components/in-progress-animation/index.tsx @@ -0,0 +1,144 @@ +import styles from './styles.module.scss'; + +const InProgressAnimation: React.FC = () => { + return ( + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ); +}; + +export default InProgressAnimation; diff --git a/projects/plugins/protect/src/js/components/in-progress-animation/stories/index.stories.tsx b/projects/plugins/protect/src/js/components/in-progress-animation/stories/index.stories.tsx new file mode 100644 index 0000000000000..a7bcb81161c39 --- /dev/null +++ b/projects/plugins/protect/src/js/components/in-progress-animation/stories/index.stories.tsx @@ -0,0 +1,10 @@ +import InProgressAnimation from '..'; + +export default { + title: 'Plugins/Protect/In Progress Animation', + component: InProgressAnimation, +}; + +const Template = args => ; +export const Default = Template.bind( {} ); +Default.args = {}; diff --git a/projects/plugins/protect/src/js/components/in-progress-animation/styles.module.scss b/projects/plugins/protect/src/js/components/in-progress-animation/styles.module.scss new file mode 100644 index 0000000000000..7abfe5e6bf986 --- /dev/null +++ b/projects/plugins/protect/src/js/components/in-progress-animation/styles.module.scss @@ -0,0 +1,50 @@ +.inProgressAnimation { + position: relative; + max-width: 100%; + width: 330px; + height: auto; +} + +.inProgressAnimation__el { + position: relative; + animation: inprogress 4s ease-in-out 0.8s infinite normal forwards; + transform: translateY( 24px ); + opacity: 0; +} + +.inProgressAnimation__el:nth-of-type(2) { + animation-delay: 0.6s; +} + +.inProgressAnimation__el:nth-of-type(3) { + animation-delay: 0.7s; +} + +@keyframes inprogress { + 0% { + opacity: 0; + transform: translateY( 24px ); + } + 20% { + opacity: 1; + transform: translateY( 0 ); + } + 50% { + opacity: 1; + transform: translateY( 0 ); + } + 60% { + opacity: 0; + transform: translateY( -48px ); + } + 100% { + opacity: 0; + transform: translateY( -48px ); + } +} + +@media (prefers-reduced-motion: reduce) { + .inProgressAnimation__el { + animation: none; + } +} diff --git a/projects/plugins/protect/src/js/routes/scan/history/index.jsx b/projects/plugins/protect/src/js/routes/scan/history/index.jsx index f65cb0633f251..723f9de9ab230 100644 --- a/projects/plugins/protect/src/js/routes/scan/history/index.jsx +++ b/projects/plugins/protect/src/js/routes/scan/history/index.jsx @@ -243,7 +243,7 @@ const ScanHistoryRoute = () => { { ( ! error || numAllThreats ) && ( - + diff --git a/projects/plugins/protect/src/js/routes/scan/scanning-admin-section-hero.tsx b/projects/plugins/protect/src/js/routes/scan/scanning-admin-section-hero.tsx index 49e99696cc4e0..c214c52ff8892 100644 --- a/projects/plugins/protect/src/js/routes/scan/scanning-admin-section-hero.tsx +++ b/projects/plugins/protect/src/js/routes/scan/scanning-admin-section-hero.tsx @@ -1,7 +1,7 @@ import { Text } from '@automattic/jetpack-components'; import { __, sprintf } from '@wordpress/i18n'; -import inProgressImage from '../../../../assets/images/in-progress.png'; import AdminSectionHero from '../../components/admin-section-hero'; +import InProgressAnimation from '../../components/in-progress-animation'; import ProgressBar from '../../components/progress-bar'; import ScanNavigation from '../../components/scan-navigation'; import useScanStatusQuery from '../../data/scan/use-scan-status-query'; @@ -51,12 +51,9 @@ const ScanningAdminSectionHero: React.FC = () => { } - secondary={ -
- -
- } + secondary={ } preserveSecondaryOnMobile={ false } + spacing={ 4 } /> ); }; diff --git a/projects/plugins/protect/src/js/routes/scan/styles.module.scss b/projects/plugins/protect/src/js/routes/scan/styles.module.scss index 0b5e90e21e7ae..8651420159fa1 100644 --- a/projects/plugins/protect/src/js/routes/scan/styles.module.scss +++ b/projects/plugins/protect/src/js/routes/scan/styles.module.scss @@ -2,17 +2,6 @@ font-weight: bold; } -.illustration { - display: flex; - align-items: center; - height: 100%; - img { - // let's fit images - object-fit: cover; - width: 100%; - } -} - .product-section, .info-section { margin-top: calc( var( --spacing-base ) * 7 ); // 56px margin-bottom: calc( var( --spacing-base ) * 7 ); // 56px