-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add single product page route/component to the marketplace #70
Merged
Merged
Changes from 17 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
44f7fd6
Split marketplace route using `useMatch`
wpalani 6705da6
Fix `MarketplaceSkeleton` component eslint
wpalani 98f92bb
Improve `ProductPage` component code
wpalani 07ce1c1
Add "newfold-marketplace/v1/products/page" Api endpoint
wpalani d995244
Refactor `MarketplaceSkeleton` component
wpalani 921dad6
Product page loading state component
wpalani 5869566
Product page error state component
wpalani 83895d3
Product page cypress test
wpalani b88fab5
Require `uuid` package
wpalani 5e19d5e
Dynamically render secondaryCTA
wpalani 462deb6
Update marketplace tests to include product page secondary cta
wpalani 309e5cd
Only render valid url values for secondary cta in premium plugins tab
wpalani 9dc1a53
Use `add/product-pages` Bluehost branch for tests
wpalani 151ee56
Fix secondary cta url pattern
wpalani a7fd002
remove failOnNonZeroExit flag
wpalani cef4f38
Fix lint
wpalani 47600c4
Fix another lint error
wpalani 916c8e1
Remove `plugin-branch` in cypress
wpalani File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import Marketplace from './marketplace'; | ||
import ProductPage from './productPage'; | ||
|
||
const NewfoldMarketplace = ( { methods, constants, ...props } ) => { | ||
const match = methods.useMatch( 'marketplace/product/:id' ); | ||
if ( match ) { | ||
return ( | ||
<ProductPage | ||
productPageId={ match.params.id } | ||
methods={ methods } | ||
constants={ constants } | ||
/> | ||
); | ||
} | ||
|
||
return ( | ||
<Marketplace methods={ methods } constants={ constants } { ...props } /> | ||
); | ||
}; | ||
|
||
export default NewfoldMarketplace; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { Title } from '@newfold/ui-component-library'; | ||
import errorVector from '../../includes/assets/img/dog-walking.svg'; | ||
|
||
const ProductPageError = ( { text = {} } ) => { | ||
return ( | ||
<div aria-live="assertive"> | ||
<div | ||
role="alert" | ||
className="nfd-flex nfd-flex-col nfd-items-center nfd-justify-center nfd-gap-6 nfd-p-8 nfd-min-h-[calc(100dvh-220px)]" | ||
> | ||
<img | ||
src={ errorVector } | ||
role="presentation" | ||
alt="Dog walking with a leash" | ||
width="300" | ||
height="278.5" | ||
/> | ||
<div className="nfd-text-center"> | ||
<Title as="h2" size="1"> | ||
{ text?.title ?? 'Oops! Something Went Wrong' } | ||
</Title> | ||
<p className="nfd-mt-2 nfd-text-base"> | ||
{ text?.description ?? | ||
'An error occurred while loading the content. Please try again later.' } | ||
</p> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default ProductPageError; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
import MarketplaceSkeleton from '../marketplaceSkeleton'; | ||
|
||
const ProductPageLoading = () => { | ||
const Hero = () => ( | ||
<div className="nfd-min-h-[35vh] nfd-flex nfd-flex-col nfd-items-center nfd-justify-center nfd-bg-[#f0f3f9] nfd-m-3 nfd-rounded-lg"> | ||
<MarketplaceSkeleton | ||
width="35%" | ||
height="35px" | ||
className="nfd-mb-4" | ||
/> | ||
<div className="nfd-flex nfd-flex-col nfd-items-center nfd-gap-2 nfd-w-full"> | ||
<MarketplaceSkeleton width="31%" height="15px" /> | ||
<MarketplaceSkeleton width="40%" height="15px" /> | ||
<MarketplaceSkeleton width="20%" height="15px" /> | ||
</div> | ||
</div> | ||
); | ||
|
||
const Features = () => ( | ||
<div className="nfd-py-10 nfd-flex nfd-flex-col nfd-items-center"> | ||
<MarketplaceSkeleton | ||
width="28%" | ||
height="25px" | ||
className="nfd-mb-3" | ||
/> | ||
<MarketplaceSkeleton | ||
width="20%" | ||
height="15px" | ||
className="nfd-mb-1.5" | ||
/> | ||
<MarketplaceSkeleton width="12%" height="15px" /> | ||
<div className="nfd-mt-8 nfd-flex nfd-justify-between nfd-w-10/12"> | ||
<Feature /> | ||
<Feature /> | ||
<Feature /> | ||
</div> | ||
</div> | ||
); | ||
|
||
const Feature = () => ( | ||
<div className="nfd-w-1/4 nfd-flex nfd-flex-col nfd-items-center"> | ||
<MarketplaceSkeleton | ||
width="65px" | ||
height="65px" | ||
className="nfd-mb-4 nfd-rounded-full" | ||
/> | ||
<MarketplaceSkeleton | ||
width="100%" | ||
height="24px" | ||
className="nfd-mb-2.5" | ||
/> | ||
<div className="nfd-flex nfd-flex-col nfd-items-center nfd-gap-1.5 nfd-w-full"> | ||
<MarketplaceSkeleton width="90%" height="15px" /> | ||
<MarketplaceSkeleton width="88%" height="15px" /> | ||
<MarketplaceSkeleton width="60%" height="15px" /> | ||
</div> | ||
</div> | ||
); | ||
|
||
const Pricing = () => ( | ||
<> | ||
<div className="nfd-w-full nfd-mt-3 nfd-flex nfd-flex-col nfd-items-center"> | ||
<div className="nfd-w-10/12 nfd-min-h-0.5 nfd-bg-[#f0f3f9]"></div> | ||
</div> | ||
<div className="nfd-py-10 nfd-flex nfd-flex-col nfd-items-center"> | ||
<MarketplaceSkeleton width="22%" height="27px" /> | ||
<div className="nfd-mt-10 nfd-flex nfd-justify-between nfd-w-10/12"> | ||
<PricingItem /> | ||
<PricingItem /> | ||
<PricingItem /> | ||
</div> | ||
</div> | ||
</> | ||
); | ||
|
||
const PricingItem = () => ( | ||
<div className="nfd-w-1/4 nfd-flex nfd-flex-col nfd-gap-7 nfd-bg-[#f0f3f9] nfd-rounded-lg nfd-p-6"> | ||
<MarketplaceSkeleton width="90%" height="28px" /> | ||
<div className="nfd-flex nfd-flex-col nfd-gap-4"> | ||
<MarketplaceSkeleton width="80%" height="14px" /> | ||
<MarketplaceSkeleton width="55%" height="14px" /> | ||
<MarketplaceSkeleton width="100%" height="14px" /> | ||
<MarketplaceSkeleton width="72%" height="14px" /> | ||
<MarketplaceSkeleton width="47%" height="14px" /> | ||
<MarketplaceSkeleton width="80%" height="14px" /> | ||
</div> | ||
<MarketplaceSkeleton width="55%" height="34px" /> | ||
</div> | ||
); | ||
|
||
const FAQ = () => ( | ||
<div className="nfd-flex nfd-flex-col nfd-items-center nfd-gap-8 nfd-py-12 nfd-mx-auto nfd-w-7/12"> | ||
<FAQitem width="96%"> | ||
<div className="nfd-flex nfd-flex-col nfd-gap-2.5 nfd-mt-4"> | ||
<MarketplaceSkeleton width="100%" height="14px" /> | ||
<MarketplaceSkeleton width="91%" height="14px" /> | ||
<MarketplaceSkeleton width="95%" height="14px" /> | ||
<MarketplaceSkeleton width="54%" height="14px" /> | ||
</div> | ||
</FAQitem> | ||
<FAQitem /> | ||
<FAQitem /> | ||
<FAQitem /> | ||
<FAQitem /> | ||
</div> | ||
); | ||
|
||
const FAQitem = ( { width = '100%', children } ) => ( | ||
<div className="nfd-w-full nfd-bg-[#f0f3f9] nfd-rounded-lg nfd-p-4"> | ||
<MarketplaceSkeleton width={ width } height="26px" /> | ||
{ children } | ||
</div> | ||
); | ||
|
||
return ( | ||
<div | ||
aria-busy="true" | ||
aria-live="polite" | ||
aria-label="Fetching product details" | ||
> | ||
<Hero /> | ||
<Features /> | ||
<Pricing /> | ||
<FAQ /> | ||
</div> | ||
); | ||
}; | ||
|
||
export default ProductPageLoading; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
We'll need to remember to remove this line before merging or at least before tagging a release.