• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

IQSS / dataverse-frontend / 10219381635

02 Aug 2024 05:08PM CUT coverage: 98.403%. Remained the same
10219381635

push

github

GermanSaracca
feat: back to disable button

86 of 90 branches covered (95.56%)

Branch coverage included in aggregate %.

222 of 223 relevant lines covered (99.55%)

198.27 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

94.12
/packages/design-system/src/lib/components/button/Button.tsx
1
import { HTMLAttributes, MouseEvent, ReactNode } from 'react'
798✔
2
import styles from './Button.module.scss'
3
import { Button as ButtonBS } from 'react-bootstrap'
4
import { IconName } from '../icon/IconName'
5
import { Icon } from '../icon/Icon'
6

7
type ButtonSize = 'sm' | 'lg'
8
type ButtonVariant = 'primary' | 'secondary' | 'link'
9
type ButtonType = 'button' | 'reset' | 'submit'
10

11
interface ButtonProps extends HTMLAttributes<HTMLButtonElement> {
12
  size?: ButtonSize
13
  variant?: ButtonVariant
14
  disabled?: boolean
15
  onClick?: (event: MouseEvent<HTMLButtonElement>) => void
16
  icon?: IconName | ReactNode
17
  withSpacing?: boolean
114✔
18
  type?: ButtonType
168✔
19
  children?: ReactNode
198✔
20
}
21

22
export function Button({
23
  size,
24
  variant = 'primary',
25
  disabled = false,
228✔
26
  onClick,
228!
27
  icon,
28
  withSpacing,
228✔
29
  type,
30
  children,
31
  ...props
32
}: ButtonProps) {
228✔
33
  return (
34
    <ButtonBS
35
      size={size}
258✔
36
      className={withSpacing ? styles.spacing : ''}
37
      variant={variant}
38
      onClick={disabled ? undefined : onClick}
39
      disabled={disabled}
114✔
40
      aria-disabled={disabled}
41
      type={type}
42
      {...props}>
43
      {typeof icon === 'string' ? <Icon name={icon} /> : icon}
44
      {children}
45
    </ButtonBS>
46
  )
47
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc