({
icon: Icon,
label,
meta,
href,
external = false,
onClick,
alert,
disabled,
}: YouRowProps)
| 82 | } |
| 83 | |
| 84 | const YouRow = ({ |
| 85 | icon: Icon, |
| 86 | label, |
| 87 | meta, |
| 88 | href, |
| 89 | external = false, |
| 90 | onClick, |
| 91 | alert, |
| 92 | disabled, |
| 93 | }: YouRowProps): ReactElement => { |
| 94 | const content = ( |
| 95 | <> |
| 96 | <span className="relative flex text-text-secondary"> |
| 97 | <Icon size={IconSize.Medium} /> |
| 98 | {alert} |
| 99 | </span> |
| 100 | <span className="min-w-0 flex-1 truncate">{label}</span> |
| 101 | {meta && ( |
| 102 | <span className="shrink-0 text-text-tertiary typo-footnote"> |
| 103 | {meta} |
| 104 | </span> |
| 105 | )} |
| 106 | </> |
| 107 | ); |
| 108 | const className = |
| 109 | 'flex h-11 w-full items-center gap-3 px-4 text-left text-text-primary transition-colors typo-callout hover:bg-surface-hover'; |
| 110 | |
| 111 | if (href && external) { |
| 112 | return ( |
| 113 | <a |
| 114 | href={href} |
| 115 | target="_blank" |
| 116 | rel="noopener noreferrer" |
| 117 | className={className} |
| 118 | > |
| 119 | {content} |
| 120 | </a> |
| 121 | ); |
| 122 | } |
| 123 | |
| 124 | if (href) { |
| 125 | return ( |
| 126 | <Link href={href} passHref> |
| 127 | {/* eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions */} |
| 128 | <a className={className} onClick={onClick}> |
| 129 | {content} |
| 130 | </a> |
| 131 | </Link> |
| 132 | ); |
| 133 | } |
| 134 | |
| 135 | return ( |
| 136 | <button |
| 137 | type="button" |
| 138 | onClick={onClick} |
| 139 | disabled={disabled} |
| 140 | className={classNames(className, 'disabled:opacity-64')} |
| 141 | > |
nothing calls this directly
no outgoing calls
no test coverage detected