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

CBIIT / crdc-datahub-ui / 11074479132

27 Sep 2024 04:44PM UTC coverage: 44.982% (+26.5%) from 18.435%
11074479132

Pull #479

github

web-flow
Merge a0867d25a into 3d8b55818
Pull Request #479: 3.0.0 Release

1727 of 4418 branches covered (39.09%)

Branch coverage included in aggregate %.

2612 of 5228 relevant lines covered (49.96%)

128.96 hits per line

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

40.91
/src/components/Questionnaire/SectionGroup.tsx
1
import React, { FC } from "react";
2
import { Box, Grid, Stack, Typography, styled } from "@mui/material";
3

4
const StyledGrid = styled(Grid)({
2✔
5
  marginTop: "46px",
6
  "&:first-of-type": {
7
    marginTop: 0,
8
  },
9
  "& > .MuiGrid-container": {
10
    marginTop: "24px",
11
  },
12
  "& > .MuiGrid-item + .MuiGrid-container": {
13
    marginTop: 0,
14
  },
15
});
16

17
const StyledHeader = styled(Grid)({
2✔
18
  marginBottom: "18px",
19
});
20

21
export const StyledTitle = styled(Typography)({
2✔
22
  fontFamily: "'Nunito', 'Rubik', sans-serif",
23
  lineHeight: "19.6px",
24
  fontWeight: 500,
25
  color: "#5A7C81",
26
  fontSize: "17px",
27
});
28

29
export const StyledDescription = styled(Typography)({
2✔
30
  fontWeight: 400,
31
  color: "#2A836D",
32
  marginTop: "24px",
33
  fontSize: "16px",
34
  "& a": {
35
    color: "inherit",
36
    fontWeight: "700",
37
    textDecoration: "underline",
38
  },
39
});
40

41
const StyledEndAdornment = styled(Box)({
2✔
42
  marginLeft: "auto",
43
});
44

45
const StyledBeginAdornment = styled(Box)({
2✔
46
  marginRight: "12px",
47
  marginTop: "auto",
48
  marginBottom: "auto",
49
  paddingTop: "25px",
50
});
51

52
const StyledAsterisk = styled("span")({
2✔
53
  color: "#C93F08",
54
  marginLeft: "2px",
55
});
56

57
const StyledError = styled("div")({
2✔
58
  color: "#C93F08",
59
  textTransform: "none",
60
  fontFamily: "Nunito",
61
  fontWeight: "400",
62
  fontSize: "0.75rem",
63
  lineHeight: "1.66",
64
  textAlign: "left",
65
  marginTop: "3px",
66
  marginRight: "14px",
67
  marginBottom: "0",
68
  minHeight: "20px",
69
});
70

71
type Props = {
72
  children: React.ReactNode;
73
  title?: string;
74
  description?: React.ReactNode;
75
  endButton?: React.ReactNode;
76
  beginButton?: React.ReactNode;
77
  required?: boolean;
78
  error?: string;
79
};
80

81
/**
82
 * Generic Form Input Section Group
83
 *
84
 * @param {Props} props
85
 * @returns {React.ReactNode}
86
 */
87
const SectionGroup: FC<Props> = ({
2✔
88
  children,
89
  title,
90
  description,
91
  endButton,
92
  beginButton,
93
  required,
94
  error,
95
}) => (
96
  <StyledGrid container rowSpacing={0} columnSpacing={1.5}>
×
97
    <StyledHeader xs={12} item>
98
      <Stack direction="column" alignItems="flex-start">
99
        {title && (
×
100
          <StyledTitle variant="h5">
101
            {title}
102
            {required ? <StyledAsterisk className="asterisk">*</StyledAsterisk> : ""}
×
103
            {error ? <StyledError className="asterisk">{error}</StyledError> : ""}
×
104
          </StyledTitle>
105
        )}
106
        <Stack direction="row" alignItems="flex-start" justifyContent="space-between" width="100%">
107
          {description && <StyledDescription variant="body1">{description}</StyledDescription>}
×
108
          {beginButton && <StyledBeginAdornment>{beginButton}</StyledBeginAdornment>}
×
109
        </Stack>
110
      </Stack>
111
    </StyledHeader>
112
    {children}
113
    {endButton && <StyledEndAdornment>{endButton}</StyledEndAdornment>}
×
114
  </StyledGrid>
115
);
116

117
export default SectionGroup;
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

© 2026 Coveralls, Inc