-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
54d6786
commit 1cc2665
Showing
3 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
application/frontend/src/components/StatusSelector/StatusSelector.styled.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { Box } from "@mui/material" | ||
import { styled } from "@mui/system" | ||
|
||
export const StatusCircle = styled(Box)({ | ||
width: 14, | ||
height: 14, | ||
borderRadius: "50%", | ||
display: "inline-block", | ||
marginRight: 8, | ||
}) | ||
|
||
export const StyledFormControl = styled("div")({ | ||
width: "80px", | ||
}) |
39 changes: 39 additions & 0 deletions
39
application/frontend/src/components/StatusSelector/StatusSelector.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import React from "react" | ||
|
||
import { MenuItem, Select } from "@mui/material" | ||
|
||
import { StatusCircle, StyledFormControl } from "./StatusSelector.styled" | ||
|
||
interface StatusSelectorProps { | ||
value: string | ||
onChange: (value: string) => void | ||
} | ||
|
||
export const StatusSelector: React.FC<StatusSelectorProps> = ({ value, onChange }) => { | ||
const statusOptions = [ | ||
{ value: "Error", color: "red" }, | ||
{ value: "Warning", color: "orange" }, | ||
{ value: "Success", color: "green" }, | ||
{ value: "None", color: "gray" }, | ||
] | ||
|
||
return ( | ||
<StyledFormControl> | ||
<Select | ||
value={value} | ||
onChange={(e) => onChange(e.target.value as string)} | ||
displayEmpty | ||
variant="outlined" | ||
inputProps={{ "aria-label": "Status Selector" }} | ||
> | ||
{statusOptions.map((option) => ( | ||
<MenuItem key={option.value} value={option.value}> | ||
<StatusCircle sx={{ backgroundColor: option.color }} /> | ||
</MenuItem> | ||
))} | ||
</Select> | ||
</StyledFormControl> | ||
) | ||
} | ||
|
||
export default StatusSelector |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { StatusSelector } from "./StatusSelector" |