-
Notifications
You must be signed in to change notification settings - Fork 152
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
Consolidate ResourceCards and implement Storybook POC #3784
Conversation
apps/ecommerce/frontend/src/components/Common/ProductCard/ProductCard/ProductCard.tsx
Outdated
Show resolved
Hide resolved
I notice there is some prettier failures, but I am a bit confused by the log from the build 🤔 looking into it! |
apps/ecommerce/frontend/src/components/Common/ProductCard/ProductCardBody/ProductCardBody.tsx
Show resolved
Hide resolved
apps/ecommerce/frontend/src/components/Common/ProductCard/ProductCardBadge/ProductCardBadge.tsx
Outdated
Show resolved
Hide resolved
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.
Awesome work here! ⭐ Nothing truly blocking, just some comments/questions for you. You can decide whether we fix up the badge in this PR or in a follow up.
apps/ecommerce/frontend/src/components/Common/ProductCard/ProductCard/ProductCard.tsx
Outdated
Show resolved
Hide resolved
apps/ecommerce/frontend/src/components/Common/ProductCard/ProductCard/ProductCard.tsx
Outdated
Show resolved
Hide resolved
apps/ecommerce/frontend/src/components/Common/ProductCard/ProductCard/ProductCard.tsx
Outdated
Show resolved
Hide resolved
...c/components/Common/ProductCard/ProductCard/ProductCardStories/DialogProductCard.stories.tsx
Outdated
Show resolved
Hide resolved
...ecommerce/frontend/src/components/Common/ProductCard/ProductCard/ProductCardStories/mocks.ts
Outdated
Show resolved
Hide resolved
apps/ecommerce/frontend/src/components/Common/ProductCard/ProductCardBadge/ProductCardBadge.tsx
Show resolved
Hide resolved
apps/ecommerce/frontend/src/components/Common/ProductCard/ProductCardBadge/ProductCardBadge.tsx
Outdated
Show resolved
Hide resolved
apps/ecommerce/frontend/src/components/Common/ProductCard/ProductCardBody/ProductCardBody.tsx
Show resolved
Hide resolved
apps/ecommerce/frontend/src/hooks/field/useResourceMenuItems.tsx
Outdated
Show resolved
Hide resolved
apps/ecommerce/frontend/src/components/Common/ProductCard/ProductCardBody/ProductCardBody.tsx
Outdated
Show resolved
Hide resolved
4a0018d
to
be807a5
Compare
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.
Nice! Two main themes in the review
- Algo improvement opportunity
- Design level of base components and Product Card components
apps/ecommerce/frontend/src/components/App/Dialog/ResourceList/ResourceList.tsx
Outdated
Show resolved
Hide resolved
apps/ecommerce/frontend/src/components/App/Field/MultipleResources/MultipleResources.tsx
Show resolved
Hide resolved
apps/ecommerce/frontend/src/components/Common/ProductCard/ProductCardBadge/ProductCardBadge.tsx
Show resolved
Hide resolved
apps/ecommerce/frontend/src/components/Common/ProductCard/ProductCardBadge/ProductCardBadge.tsx
Show resolved
Hide resolved
apps/ecommerce/frontend/src/components/Common/ProductCard/ProductCardBody/ProductCardBody.tsx
Show resolved
Hide resolved
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.
Approving because I don't think the last bit of design optimizations is a great use of your time and there's a good chance even if we optimized HOC badge component, it would be changed and refactored
* Add storybook to ecom frontend * WIP create new common ResourceCard * Add Storybook config * Remove storybook boilerplate code * Add ProductCard components with stories and tests * Add new stories, components, and fixed parent components * Merge master * Add tests and update props * Fix failing tests * Re-add missing component * Cleanup code * Delete ResourceCards * Fix test * Fix another test * Remove extraneous variables * Small cleanup * Remove comment * Fix card rendering in fields * Add a few more stories and adjust tests * Fix badge state * PR review adjustmetns * Adjust mocks directories * Add more PR review feedback * Add prettier fixes * Fix linting errors --------- Co-authored-by: Lisa White <lisa.white@contentful.com>
Purpose
ResourceCards
into a more reusableProductCard
component (s/o to Lisa for a lot of this original refactor!).Approach
With the refactor, many components were broken out into smaller components, as you will find in the
ProductCard
directory under theCommon
directory. Additionally, the new components were placed within the respective parent components to actively render in the application.For the storybook implementation, a
ProductCardStories
directory is placed in this same ^^ directory, where you will find two different story files to render 'Field' typeProductCards
and 'Dialog' typeProductCards
. To see these stories, make surenpm i
andnpm run storybook
. I added several iterations, but this is very much a layout I would appreciate any and all feedback on. There is also argument to add stories for the smaller subcomponents (ProductCardHeader
etc) but limited the scope to justProductCard
for now to see how we like it.Known issues
Testing steps
Pull down this branch and make sure everything looks as expected within the app. 🤞 There may be a few details I missed for the field vs dialog location of the card, so please let me know if you notice anything!