-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
feat: enable PDFDownloadLink
to Receive Anchor Props
#2071
feat: enable PDFDownloadLink
to Receive Anchor Props
#2071
Conversation
Changes: - Pass ALL anchor tag props to the rendered anchor element -- EXCLUDING the reserved `href` attribute. - Improve the `onClick` type of `PDFDownloadLink`. - Minor cleanup in related files.
PDFDownloadLink
to Receive Anchor PropsPDFDownloadLink
to Receive Anchor Props
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK
* feat: Enable `PDFDownloadLink` to Receive Anchor Props Changes: - Pass ALL anchor tag props to the rendered anchor element -- EXCLUDING the reserved `href` attribute. - Improve the `onClick` type of `PDFDownloadLink`. - Minor cleanup in related files. * feat: preserve doc var * fix: preserve blank line --------- Co-authored-by: Diego Muracciole <[email protected]>
Motivation
There are a few reasons why someone might want to leverage all of the attributes available on the related anchor (
a
) element forPDFDownloadLink
. This PR makes this possible without ruining backwards compatibility (download
is now legal;fileName
is still preserved; andfileName
will yield todownload
if the attribute is explicitly added). The TS props were also updated for clarity.It might be useful to have this on the v2 and v3 versions? Since it seems like some people in the
react@18
world are having a hard time? But I leave that to you guys.I considered adding
React.forwardRef
too, but I didn't want to dive through additional TS headaches. Might be worth considering later?Changes
href
attribute.onClick
type ofPDFDownloadLink
.