Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restyle metric field per UX #525

Merged
merged 3 commits into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/components/StyledFormComponents/StyledLabel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ const StyledLabel = styled(FormLabel)(() => ({
minHeight: "20px",
color: "#083A50",
marginBottom: "4px",
"&.Mui-focused": {
color: "#083A50",
},
}));

export default StyledLabel;
3 changes: 3 additions & 0 deletions src/components/StyledFormComponents/StyledSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ const StyledSelect = styled(Select, {
boxShadow:
"2px 2px 4px 0px rgba(38, 184, 147, 0.10), -1px -1px 6px 0px rgba(38, 184, 147, 0.20)",
},
"&.Mui-focused .MuiOutlinedInput-input:focus": {
borderRadius: "8px",
},
// Border error
"&.Mui-error fieldset": {
borderColor: "#D54309 !important",
Expand Down
47 changes: 23 additions & 24 deletions src/content/operationDashboard/DashboardView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
FrameOptions,
} from "amazon-quicksight-embedding-sdk";
import StyledSelect from "../../components/StyledFormComponents/StyledSelect";
amattu2 marked this conversation as resolved.
Show resolved Hide resolved
import StyledLabel from "../../components/StyledFormComponents/StyledLabel";
import SuspenseLoader from "../../components/SuspenseLoader";
import bannerSvg from "../../assets/banner/submission_banner.png";
import { useAuthContext } from "../../components/Contexts/AuthContext";
Expand All @@ -20,45 +21,42 @@ export type DashboardViewProps = {
loading: boolean;
};

const StyledViewHeader = styled(Box)({
const StyledPageContainer = styled(Box)({
background: `url(${bannerSvg})`,
amattu2 marked this conversation as resolved.
Show resolved Hide resolved
backgroundSize: "cover",
backgroundPosition: "center",
backgroundSize: "100% 296px",
backgroundPosition: "top",
backgroundRepeat: "no-repeat",
paddingBottom: "24px",
});

const StyledViewHeader = styled(Box)({
width: "100%",
height: "296px",
display: "flex",
justifyContent: "center",
alignItems: "center",
marginBottom: "-178px",
marginTop: "0px",
padding: "24px 0",
});

const StyledFormControl = styled(FormControl)({
display: "flex",
flexDirection: "row",
alignItems: "center",
gap: "15px",
width: "300px",
marginBottom: "auto",
marginTop: "37px",
width: "351px",
});

const StyledInlineLabel = styled("label")({
padding: 0,
fontWeight: "700",
const CustomLabel = styled(StyledLabel)({
textAlign: "center",
});

const StyledFrameContainer = styled(Box)({
const StyledFrameContainer = styled(Box)(({ theme }) => ({
borderRadius: "6px",
border: "1px solid #E0E0E0",
background: "#fff",
position: "relative",
margin: "0 auto",
marginBottom: "57px",
maxWidth: "calc(100% - 64px)",
boxShadow:
"0px 2px 1px -1px rgba(0,0,0,0.2),0px 1px 1px 0px rgba(0,0,0,0.14),0px 1px 3px 0px rgba(0,0,0,0.12)",
});
boxShadow: theme.shadows[1],
"& .quicksight-iframe": {
borderRadius: "6px",
},
}));

const StyledPlaceholder = styled(Typography)({
margin: "100px auto",
Expand Down Expand Up @@ -125,6 +123,7 @@ const DashboardView: FC<DashboardViewProps> = ({
height: "1200px",
width: "100%",
withIframePlaceholder: true,
className: "quicksight-iframe",
};

const contentConfig: DashboardContentOptions = {
Expand All @@ -146,11 +145,11 @@ const DashboardView: FC<DashboardViewProps> = ({
}, [url]);

return (
<Box data-testid="operation-dashboard-container">
<StyledPageContainer data-testid="operation-dashboard-container">
{loading && <SuspenseLoader />}
<StyledViewHeader>
<StyledFormControl>
<StyledInlineLabel htmlFor="dashboard-type">Metrics</StyledInlineLabel>
<CustomLabel htmlFor="dashboard-type">Metrics:</CustomLabel>
<StyledSelect
value={currentType}
onChange={handleDashboardChange}
Expand All @@ -167,7 +166,7 @@ const DashboardView: FC<DashboardViewProps> = ({
)}
<div ref={dashboardElementRef} />
</StyledFrameContainer>
</Box>
</StyledPageContainer>
);
};

Expand Down