shellscape / jsx-email

Build emails with a delightful DX
https://jsx.email
MIT License
897 stars 28 forks source link

PreviewProps is not a function #132

Closed tom3rr closed 6 months ago

tom3rr commented 6 months ago

Expected Behavior

Using a sample, it should open in the email preview with the defined props in PreviewProps.

Actual Behavior

Preview page is blank, console.log throwing "PreviewProps is not a function" error.

Additional Information

Using any example from the email samples out-of-the-box is not working as most of them have PreviewProps defined. If this is a docs issue, please let me know how to provide template props for previews.

shellscape commented 6 months ago

Not sure what you're describing. That url works fine?

tom3rr commented 6 months ago

I am sorry for not being clear enough. The url is for referencing the samples that are not working locally.

If I copy the code from that sample page, for example the Airbnb-review, and use it as it is in my local dev environment, it is not working.

AirbnbReviewEmail.PreviewProps = { authorName: 'Joker', authorImage:${baseUrl}batman-twilight.jpg, reviewText:"Batsy's stay at my Airbnb Batcave was a riot! Batman surprised with a hidden sense of humor, engaging in epic banter and a prank war. His detective skills impressed, and the Batcave remained spotless. Game night and snacks were a hit, and even during downtime, he couldn't resist a Bat-signal. Hosting Batsy was chaos perfected – if you want a guest with brooding intensity and unexpected laughter, Batman's your Bat. Hahahahahahahahahaha! " } as AirbnbReviewEmailProps;

It seems that the above snippet, the PreviewProps definition is not working locally as it is not recognized. Am I doing something wrong?

shellscape commented 6 months ago

Am I doing something wrong?

Probably not :)

Could you put together a reproduction using https://stackblitz.com/edit/jsx-email-repro when you have the chance? I'm not able to reproduce locally, but that doesn't mean your issue doesn't exist. A reproduction will help me see the same code in the same environment as you so that I can debug.

tom3rr commented 6 months ago

Sure thing, here it is: https://stackblitz.com/edit/jsx-email-repro-vzgqmc

shellscape commented 6 months ago

Perfect thanks