MCPcopy Create free account
hub / github.com/triggerdotdev/trigger.dev / LinkButton

Function LinkButton

apps/webapp/app/components/primitives/Buttons.tsx:290–356  ·  view source on GitHub ↗
({
  to,
  onClick,
  onMouseDown,
  onMouseEnter,
  onMouseLeave,
  download,
  disabled = false,
  ...props
}: LinkPropsType)

Source from the content-addressed store, hash-verified

288 "to" | "target" | "onClick" | "onMouseDown" | "onMouseEnter" | "onMouseLeave" | "download"
289> & { disabled?: boolean } & React.ComponentProps<typeof ButtonContent>;
290export const LinkButton = ({
291 to,
292 onClick,
293 onMouseDown,
294 onMouseEnter,
295 onMouseLeave,
296 download,
297 disabled = false,
298 ...props
299}: LinkPropsType) => {
300 const innerRef = useRef<HTMLAnchorElement>(null);
301 if (props.shortcut) {
302 useShortcutKeys({
303 shortcut: props.shortcut,
304 action: () => {
305 if (innerRef.current) {
306 innerRef.current.click();
307 }
308 },
309 });
310 }
311
312 if (disabled) {
313 return (
314 <div
315 className={cn(
316 "group pointer-events-none cursor-default opacity-40 outline-none",
317 props.fullWidth ? "w-full" : ""
318 )}
319 >
320 <ButtonContent {...props} />
321 </div>
322 );
323 }
324
325 if (to.toString().startsWith("http") || to.toString().startsWith("/resources")) {
326 return (
327 <ExtLink
328 href={to.toString()}
329 ref={innerRef}
330 className={cn("group outline-none", props.fullWidth ? "w-full" : "")}
331 onClick={onClick}
332 onMouseDown={onMouseDown}
333 onMouseEnter={onMouseEnter}
334 onMouseLeave={onMouseLeave}
335 download={download}
336 >
337 <ButtonContent {...props} />
338 </ExtLink>
339 );
340 } else {
341 return (
342 <Link
343 to={to}
344 ref={innerRef}
345 className={cn("group outline-none", props.fullWidth ? "w-full" : "")}
346 onClick={onClick}
347 onMouseDown={onMouseDown}

Callers

nothing calls this directly

Calls 3

useShortcutKeysFunction · 0.90
cnFunction · 0.90
toStringMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…