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

CBIIT / crdc-datahub-ui / 16006182009

01 Jul 2025 05:32PM UTC coverage: 62.703% (-8.6%) from 71.278%
16006182009

Pull #756

github

web-flow
Merge pull request #755 from CBIIT/revert-omb-date

revert: OMB expiration update
Pull Request #756: Sync 3.4.0 with 3.3.0

3560 of 6102 branches covered (58.34%)

Branch coverage included in aggregate %.

4920 of 7422 relevant lines covered (66.29%)

227.7 hits per line

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

88.89
/src/components/AddRemoveButton.tsx
1
import { Button, ButtonProps, Stack, StackProps, styled, TooltipProps } from "@mui/material";
2
import { FC } from "react";
3
import StyledTooltip from "./StyledFormComponents/StyledTooltip";
4

5
const ActionButton = styled(Button, {
8✔
6
  shouldForwardProp: (prop) => prop !== "textColor" && prop !== "iconColor",
910✔
7
})<Props>`
8
  font-weight: 700;
9
  font-size: 15px;
10
  font-family: "Nunito", "Rubik", sans-serif;
11
  line-height: 16px;
12
  color: ${(props) => props.textColor ?? "#000000"};
82✔
13
  padding: 0;
14
  justify-content: end;
15
  min-width: 143px;
16
  border: none !important;
17
  background: transparent;
18
  text-transform: none;
19
  &.Mui-disabled {
20
    cursor: not-allowed;
21
    pointer-events: auto;
22
  }
23
  & .MuiButton-startIcon {
24
    color: ${(props) => props.iconColor ?? "#44A759"};
82✔
25
    margin-right: 4px;
26
    & svg {
27
      font-size: 23px;
28
    }
29
  }
30
  &:hover {
31
    background: none;
32
  }
33
`;
34

35
const CustomTooltip = (props: TooltipProps) => (
8✔
36
  <StyledTooltip
82✔
37
    {...props}
38
    slotProps={{
39
      popper: {
40
        modifiers: [
41
          {
42
            name: "offset",
43
            options: {
44
              offset: [0, -2],
45
            },
46
          },
47
        ],
48
      },
49
    }}
50
  />
51
);
52

53
type Props = ButtonProps & {
54
  label?: string;
55
  placement?: StackProps["justifyContent"];
56
  iconColor?: string;
57
  textColor?: string;
58
  tooltipProps?: Omit<TooltipProps, "children">;
59
};
60

61
const AddRemoveButton: FC<Props> = ({
8✔
62
  label,
63
  placement = "end",
×
64
  disabled,
65
  onClick,
66
  tooltipProps,
67
  ...rest
68
}) => {
69
  const onClickWrapper = (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {
82✔
70
    if (disabled) {
2✔
71
      return;
×
72
    }
73
    if (typeof onClick === "function") {
2!
74
      onClick(event);
2✔
75
    }
76
  };
77

78
  return (
82✔
79
    <Stack direction="row" justifyContent={placement} alignItems="center">
80
      <CustomTooltip title="" {...tooltipProps}>
81
        <span>
82
          <ActionButton
83
            variant="outlined"
84
            type="button"
85
            size="small"
86
            onClick={onClickWrapper}
87
            disableRipple
88
            disabled={disabled}
89
            {...rest}
90
          >
91
            {label}
92
          </ActionButton>
93
        </span>
94
      </CustomTooltip>
95
    </Stack>
96
  );
97
};
98

99
export default AddRemoveButton;
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