Skip to content
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

Decouple lottie-web dependency from our repo #6366

Closed
1 of 3 tasks
Tracked by #6201
amal-k-joy opened this issue Nov 6, 2024 · 0 comments
Closed
1 of 3 tasks
Tracked by #6201

Decouple lottie-web dependency from our repo #6366

amal-k-joy opened this issue Nov 6, 2024 · 0 comments

Comments

@amal-k-joy
Copy link
Contributor

amal-k-joy commented Nov 6, 2024

Currently we have exposed a media prop that expects either a render callback(media.render) that returns a component( ) or filepaths(media.filepaths) with animation data.

The new approach is to deprecate the media prop and introduce an new render prop called renderMedia which is a callback that can return any react component. So if user needs lottie animationed component, they can import the package from their end and can return the animated component as it is.

We have the component <SteppedAnimatedMedia> that has implemented lottie-web. User can either import and use that wrapper component or define their own custom component.

Usage at adopter

  <InlineTip  renderMedia={(params) => <SteppedAnimatedMedia
          filePaths={[InlineTipAnimation]}
          playStep={1}
        />} />

<InlineTip  renderMedia={(params) => <img alt="" src={InlineTipImage} />} />

<InlineTip    action={selectedAction}  />  

Sample implementation in component

{ renderMedia && <>{renderMedia({className:${blockClass}__media})}</> }

Here <SteppedAnimatedMedia> will still be part of our repo , but will not be imported in any of our components , there by should be excluded from bundling.

  • Deprecate media prop with lots of warnings
  • Replace SteppedAnimatedMedia with renderMedia prop

Followup later

@github-project-automation github-project-automation bot moved this to Needs triage 🧐 in Carbon for IBM Products Nov 6, 2024
@amal-k-joy amal-k-joy self-assigned this Nov 6, 2024
@amal-k-joy amal-k-joy changed the title Decouple lottie-web and allow user to handle and render animation or image Decouple lottie-web dependency from our repo Nov 6, 2024
@elycheea elycheea moved this from Needs triage 🧐 to Needs refinement 🤓 in Carbon for IBM Products Nov 6, 2024
@elycheea elycheea moved this from Needs refinement 🤓 to Backlog 🌋 in Carbon for IBM Products Nov 14, 2024
@amal-k-joy amal-k-joy moved this from Backlog 🌋 to In progress in Carbon for IBM Products Nov 18, 2024
@amal-k-joy amal-k-joy added the type: enhancement 💡 New feature or request label Nov 20, 2024
@amal-k-joy amal-k-joy moved this from In progress to Needs review 👋 in Carbon for IBM Products Nov 20, 2024
@elycheea elycheea closed this as completed Dec 4, 2024
@github-project-automation github-project-automation bot moved this from Needs review 👋 to Done 🚀 in Carbon for IBM Products Dec 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done 🚀
Development

No branches or pull requests

2 participants