vkurko / calendar

Full-sized drag & drop JavaScript event calendar with resource & timeline views
https://vkurko.github.io/calendar/
MIT License
964 stars 82 forks source link

Using svelte component for event displaying #244

Open wwmike opened 4 months ago

wwmike commented 4 months ago

Hello!

I am trying to display events with profile pictures, and I was wondering if there's a way to use a svelte component.

Right now I solved it by setting a function for eventContent option, which returns a manually constructed html, but this duplicates all the code I already have in a <ProfilePicture {name} {pictureUrl} /> component.

Is there a better way of doing it I am not aware of? ( If I'm right, svelte slots are not utilized in the component )

EDIT: A bit better way I came up was having ProfilePicture.render({name:'$name',pictureUrl:'$pictureUrl'}) on the backend and pass it to the frontend, where I replace $name and $pictureUrl for the appropriate events, but having a default picture for empty pictureUrl is still an externalized logic.

Thank you, Mihaly

vkurko commented 4 months ago

Hello,

Unfortunately, the calendar does not currently support any slots. I agree that such a feature would be very useful for a Svelte project. Therefore, in future versions I will try to solve this issue.

wwmike commented 4 months ago

Sounds great, thank you!