Skip to content

Commit 00aabf2

Browse files
Fix:SonarQube duplicate lines issue
1 parent 4d627cc commit 00aabf2

1 file changed

Lines changed: 16 additions & 11 deletions

File tree

src/components/Reports/JobAnalytics/JobAnalyticsFilters.jsx

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,28 @@ const GRANULARITY_OPTS = [
1010
{ value: "annually", label: "Annually" },
1111
];
1212

13-
function FilterField({ label, children, isDark }) {
14-
const labelStyle = {
13+
function getLabelStyle(isDark) {
14+
return {
1515
color: isDark ? "#e0e0e0" : "#111111",
1616
display: "flex",
1717
flexDirection: "column",
1818
fontSize: "0.9rem",
1919
};
20+
}
21+
22+
function getInputStyle(isDark) {
23+
return {
24+
backgroundColor: isDark ? "#1b2a41" : "#ffffff",
25+
color: isDark ? "#e0e0e0" : "#111111",
26+
border: `1px solid ${isDark ? "#555" : "#ccc"}`,
27+
borderRadius: "4px",
28+
padding: "0.25rem",
29+
};
30+
}
2031

32+
function FilterField({ label, children, isDark }) {
2133
return (
22-
<label style={labelStyle}>
34+
<label style={getLabelStyle(isDark)}>
2335
<span>{label}</span>
2436
{children}
2537
</label>
@@ -119,14 +131,7 @@ function JobAnalyticsFilters({ filters, setFilters }) {
119131
};
120132

121133
const nonTotalsDisabled = filters.dateMode !== "Custom";
122-
123-
const inputStyle = {
124-
backgroundColor: isDark ? "#1b2a41" : "#ffffff",
125-
color: isDark ? "#e0e0e0" : "#111111",
126-
border: `1px solid ${isDark ? "#555" : "#ccc"}`,
127-
borderRadius: "4px",
128-
padding: "0.25rem",
129-
};
134+
const inputStyle = getInputStyle(isDark);
130135

131136
return (
132137
<div style={{ display: "flex", flexWrap: "wrap", gap: "1rem" }}>

0 commit comments

Comments
 (0)