Skip to content

Commit

Permalink
style(control): minor changes on new control form & infractions
Browse files Browse the repository at this point in the history
- fix arrow in close drawer button
- capitalize selected day in calendar
  • Loading branch information
sandrica89 committed Dec 2, 2024
1 parent 36ccfb1 commit 521de42
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 12 deletions.
7 changes: 7 additions & 0 deletions common/utils/string.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export const capitalizeFirstLetter = str => {
return (
String(str)
.charAt(0)
.toUpperCase() + String(str).slice(1)
);
};
7 changes: 5 additions & 2 deletions web/control/components/Alerts/InfractionDay.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { fr } from "@codegouvfr/react-dsfr";
import Stack from "@mui/material/Stack";
import { useInfractions } from "../../../controller/utils/contextInfractions";
import { useControl } from "../../../controller/utils/contextControl";
import { capitalizeFirstLetter } from "common/utils/string";

const gregorian_fr = {
name: "gregorian_fr",
Expand Down Expand Up @@ -138,11 +139,13 @@ export const InfractionDay = ({ alerts, sanction }) => {
nativeButtonProps={{
...(isReportingInfractions && {
onClick: () => onRemoveDate(ts),
"aria-label": `Retirer ${textualPrettyFormatDay(ts, true)}`
"aria-label": `Retirer ${capitalizeFirstLetter(
textualPrettyFormatDay(ts, true)
)}`
})
}}
>
{textualPrettyFormatDay(ts, true)}
{capitalizeFirstLetter(textualPrettyFormatDay(ts, true))}
</Tag>
</li>
))}
Expand Down
17 changes: 7 additions & 10 deletions web/controller/components/noQRCode/ControllerControlNew.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from "react";
import { Link } from "react-router-dom";
import classNames from "classnames";
import { Button } from "@codegouvfr/react-dsfr/Button";
import Container from "@mui/material/Container";
import Box from "@mui/material/Box";
import Typography from "@mui/material/Typography";
Expand All @@ -26,17 +25,15 @@ export function ControllerControlNew({
<ControlDrawer isOpen={isOpen} onClose={onClose}>
<Container>
<Box marginBottom={2}>
<Link
to="#"
className={classNames(
"fr-link",
"fr-fi-arrow-left-line",
"fr-link--icon-left"
)}
<Button
onClick={onClose}
priority="tertiary no outline"
iconId="fr-icon-arrow-left-s-line"
iconPosition="left"
style={{ textDecoration: "underline" }}
>
Fermer
</Link>
</Button>
</Box>
<Typography variant="h4" component="h1" sx={{ marginY: 2 }}>
Nouveau contrôle “{type.label}
Expand Down

0 comments on commit 521de42

Please sign in to comment.