vtex / faststore

Digital commerce toolkit for frontend developers
https://faststore.dev
MIT License
189 stars 60 forks source link

feat: Enable `ProductDescription` override in `ProductDetails` section #2319

Closed lucasfp13 closed 4 months ago

lucasfp13 commented 5 months ago

What's the purpose of this pull request?

This PR intends to enable override for ProductDescription component and props in ProductDetails section.

How it works?

You can override ProductDescription using __experimentalProductDescription.

How to test it?

In the @faststore/core package:

In packages/core/src/customizations/src/components/overrides/ProductDetails.tsx

change the following code:

const override: SectionOverride = {
  section: SECTION,
  components: {
    __experimentalProductDescription: {
      props: { descriptionData: [{ title: 'Title', content: 'Some content' }] },
    },
  },
}

In the starter.store:

Starters Deploy Preview

https://github.com/vtex-sites/starter.store/pull/446

Using the changes of the PR above, you can test by running the store locally (yarn dev) then go to http://localhost:3000/api/preview?contentType=pdp&documentId=4675d165-170d-11ef-8452-12a5e84da56d&versionId=eb329256-7113-4f74-9087-6e0838e77aaa, that's the version using the draft changes I made.

Screenshot 2024-05-22 at 16 40 16 Screenshot 2024-05-22 at 16 41 12
vercel[bot] commented 5 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
faststore-site ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 16, 2024 5:00pm
hellofanny commented 5 months ago

@lucasfp13 can you pls check the error why codesandbox build is failing? It would be great if we could test in the starter too.

codesandbox-ci[bot] commented 5 months ago

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

victors1682 commented 4 months ago

hey, @lucasfp13 does descriptionData support a TSX component, in the Title and Content array?

const override: SectionOverride = {
  section: SECTION,
  components: {
    __experimentalProductDescription: {
      props: { descriptionData: [{ title: 'Title', content: 'Some content' }] },
    },
  },
}
batzlerg commented 4 months ago

hey, @lucasfp13 does descriptionData support a TSX component, in the Title and Content array?

const override: SectionOverride = {
  section: SECTION,
  components: {
    __experimentalProductDescription: {
      props: { descriptionData: [{ title: 'Title', content: 'Some content' }] },
    },
  },
}

@victors1682 as of right now, the answer appears to be no.

https://github.com/vtex/faststore/blob/09cdd6fbdeacc796d24738e232d660153dade68d/packages/core/src/components/ui/ProductDescription/ProductDescription.tsx#L10-L13

https://github.com/vtex/faststore/blob/09cdd6fbdeacc796d24738e232d660153dade68d/packages/core/src/components/ui/ProductDescription/ProductDescription.tsx#L70