Skip to content

Commit 2dd131b

Browse files
committed
style: styling branch selector with mui
1 parent c6e5f26 commit 2dd131b

File tree

2 files changed

+42
-42
lines changed

2 files changed

+42
-42
lines changed
Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,12 @@
11
.branch-selector {
22
display: flex;
3+
flex-direction: row;
4+
gap: 1rem;
35
align-items: center;
4-
font-weight: 600;
5-
font-size: 0.825rem;
6-
max-width: 315px;
7-
width: 100%;
8-
user-select: none;
9-
margin-right: 12px;
10-
position: relative;
6+
font-weight: bold;
7+
font-size: 1rem;
118

129
.select-box {
13-
text-align: center;
14-
margin-left: 8px;
15-
width: 100%;
16-
padding: 4px;
17-
border: solid 1px rgba(255, 255, 255, 0.22);
18-
border-radius: 3px;
19-
color: white;
20-
background: rgba(255, 255, 255, 0.09);
21-
font-weight: 300;
22-
font-size: 0.825rem;
23-
24-
option {
25-
background: #212121;
26-
}
10+
background-color: white;
2711
}
2812
}

packages/view/src/components/BranchSelector/BranchSelector.tsx

Lines changed: 37 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,52 @@
1-
import { type ChangeEventHandler } from "react";
2-
import "./BranchSelector.scss";
1+
import InputLabel from "@mui/material/InputLabel";
2+
import MenuItem from "@mui/material/MenuItem";
3+
import FormControl from "@mui/material/FormControl";
4+
import type { SelectChangeEvent } from "@mui/material/Select";
5+
import Select from "@mui/material/Select";
36

47
import { useGlobalData } from "hooks";
58
import { sendFetchAnalyzedDataCommand } from "services";
9+
import "./BranchSelector.scss";
610

711
const BranchSelector = () => {
812
const { branchList, selectedBranch, setSelectedBranch, setLoading } = useGlobalData();
913

10-
const handleChangeSelect: ChangeEventHandler<HTMLSelectElement> = (e) => {
11-
setSelectedBranch(e.target.value);
14+
const handleChangeSelect = (event: SelectChangeEvent) => {
15+
setSelectedBranch(event.target.value);
1216
setLoading(true);
13-
sendFetchAnalyzedDataCommand(e.target.value);
17+
sendFetchAnalyzedDataCommand(event.target.value);
1418
};
1519

1620
return (
17-
<section className="branch-selector">
18-
<span>Branches:</span>
19-
<select
20-
className="select-box"
21-
onChange={handleChangeSelect}
22-
value={selectedBranch}
21+
<div className="branch-selector">
22+
<p>Branches: </p>
23+
<FormControl
24+
sx={{ m: 1, minWidth: 120 }}
25+
size="small"
2326
>
24-
{branchList?.map((option) => (
25-
<option
26-
key={option}
27-
value={option}
28-
>
29-
{option}
30-
</option>
31-
))}
32-
</select>
33-
</section>
27+
<InputLabel id="branch-select-small-label">Branches</InputLabel>
28+
<Select
29+
labelId="branch-select-small-label"
30+
id="branch-select-small"
31+
value={selectedBranch}
32+
label="Branches"
33+
onChange={handleChangeSelect}
34+
className="select-box"
35+
>
36+
<MenuItem value="">
37+
<em>None</em>
38+
</MenuItem>
39+
{branchList?.map((option) => (
40+
<MenuItem
41+
key={option}
42+
value={option}
43+
>
44+
{option}
45+
</MenuItem>
46+
))}
47+
</Select>
48+
</FormControl>
49+
</div>
3450
);
3551
};
3652

0 commit comments

Comments
 (0)