MCPcopy
hub / github.com/nygardk/react-share / handleClick

Function handleClick

src/ShareButton.tsx:216–248  ·  view source on GitHub ↗
(event: React.MouseEvent<HTMLButtonElement>)

Source from the content-addressed store, hash-verified

214 : undefined;
215
216 const handleClick = async (event: React.MouseEvent<HTMLButtonElement>) => {
217 if (disabled) {
218 return;
219 }
220
221 const link = networkLink(url, opts);
222
223 event.preventDefault();
224
225 if (beforeOnClick) {
226 const returnVal = beforeOnClick();
227
228 if (isPromise(returnVal)) {
229 await returnVal;
230 }
231 }
232
233 if (openShareDialogOnClick) {
234 const windowConfig = {
235 height: windowHeight,
236 width: windowWidth,
237 ...(windowPosition === 'windowCenter'
238 ? getBoxPositionOnWindowCenter(windowWidth, windowHeight)
239 : getBoxPositionOnScreenCenter(windowWidth, windowHeight)),
240 };
241
242 windowOpen(link, windowConfig, onShareWindowClose);
243 }
244
245 if (onClick) {
246 onClick(event, link);
247 }
248 };
249
250 const newClassName = cx(
251 'react-share__ShareButton',

Callers

nothing calls this directly

Calls 4

isPromiseFunction · 0.85
windowOpenFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…