mintlify / components

UI components for documentation made with React and TailwindCSS.
MIT License
79 stars 12 forks source link

Support images in the Card icon prop type #50

Closed ghost closed 1 year ago

ghost commented 1 year ago

Images are already rendered correctly but the types need to be updated.

For reference: Images will only render correctly on Mintlify if the file paths are absolute. Relative file paths are not resolved correctly in production. We are working on that MDX parsing problem in the mint repo.

handotdev commented 1 year ago

@tobias-mintlify is this a duplicate of #57

ghost commented 1 year ago

Reopening, this is a separate issue to allow an image as an icon. This issue is super small and is only about updating the type definition of the component.

57 is about allowing a big image at the top of the card.

sboy99 commented 1 year ago

@tobias-mintlify correct me if I'm wrong. In this updation the icon will accept a href of an image. And the card component will conditionally check is it a image(string) or a svg, right, and based of the condition it will render img and svg respectively.

ghost commented 1 year ago

Yes exactly. String input gets passed to the image src property. SVGs will still be passed as components.

sboy99 commented 1 year ago

Then excited to contribute. Assign me, I will give it a try 😸

sboy99 commented 1 year ago

Screenshot from 2023-02-09 11-19-22

Is it looking good? or it need some modification. If so mention please.

sboy99 commented 1 year ago

Screenshot from 2023-02-09 11-23-55

How can I update this so that icon prop accepts a string as well ??

ghost commented 1 year ago

That's looking good. If you update the type definition of the component Storybook should automatically start accepting strings too. You can try something like icon?: string | ReactNode.

sboy99 commented 1 year ago

That's looking good. If you update the type definition of the component Storybook should automatically start accepting strings too. You can try something like icon?: string | ReactNode.

This is happening although I specified string | ReactNode Screenshot from 2023-02-09 14-03-41

Possible reason is ReactNode has string property as literal type Screenshot from 2023-02-09 14-04-19

sboy99 commented 1 year ago

Its working if we pass a JSON string Screenshot from 2023-02-09 14-25-13