jasonleibowitz / react-add-to-calendar-hoc

Simple Unopinionated React Add to Calendar Button. Bring your own components.
http://leibowitz.me/react-add-to-calendar-hoc/docs/
MIT License
70 stars 40 forks source link

Expose util functions to world #47

Open Hellycat opened 3 years ago

Hellycat commented 3 years ago

Feature request

Expose functions from utils

Is your feature request related to a problem? Please describe.

I would like to use the functionality your library provides with own components. In this case it would be nice to get ability to import nexts methods: buildShareUrl and handleCalendarButtonClick from index.jsx

Describe the solution you'd like

I would like to get 2 functions exported: export const handleCalendarClick(...), export const buildShareUrl(...) andexport const SHARE_SITES= {...`

In this case I can use it with my own components:

const href = buildShareUrl(
    {
      title,
      description,
      duration,
      locationm
      startDatetime,
      endDatetime,
    },
    "Google"
  )
  return (
    <button onClick={e => handleCalendarClick(e, href, "download")}>
      <a href={href}>{"Google calendar"}</a>
    </button>
  )