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

API Data in Paragon Component Example #6

Open
wants to merge 1 commit into
base: hello-world
Choose a base branch
from

Conversation

brian-smith-tcril
Copy link
Owner

@brian-smith-tcril brian-smith-tcril commented Mar 21, 2023

Summary

This PR combines the work done in #4 and #5 to display course information from the API in a Paragon Carousel component.

The most notable change on the API side is the addition of transformResponse to the query

transformResponse: (response) => response.results.map(entry => ({
title: entry.name,
description: entry.short_description,
imageUrl: entry.media.image.large,
imageAltText: 'API does not return alt text for images',
})),

The most notable change on the Paragon Component side is passing carouselData in as a prop on ExampleCarousel.

Testing

To play around with this functionality, you can make courses in Studio (http://localhost:18010/, default username edx@example.com, default password edx)

In the "Schedule & Details" section
image

You can update the "Course Short Description"
image

as well as the "Course Card Image"
image

Then when you run the MFE locally, you should see your course in the Carousel!
image

@brian-smith-tcril brian-smith-tcril changed the base branch from template-fork to hello-world March 22, 2023 22:51
@brian-smith-tcril
Copy link
Owner Author

There are plenty of other API endpoints and Paragon Components to play around with!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant