Skip to content

Commit 2eef7d3

Browse files
authored
RSDEV-120 Migrate DMPTool dialog to accented theme (#79)
This means the DMPTool dialog for importing DMPs into the Gallery has consistent styling with the new Gallery, utilising an accented theme to mimic the DMPTool branding. Moreover, it supports the high contrast mode that comes with the theme. The dialog also now uses MUI's DataGrid, allowing the user to choose additional columns of data. This change applies to both the existing and new gallery. This change also includes keyboard controls for selecting a row of the table in the Argos dialog as that was not included in its recent change.
1 parent c65e40c commit 2eef7d3

File tree

7 files changed

+252
-139
lines changed

7 files changed

+252
-139
lines changed

src/main/webapp/ui/flow-typed/mui.js

+2
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ declare module "@mui/x-data-grid" {
6262
sortable?: boolean,
6363
headerClassName?: string,
6464
disableExport?: boolean,
65+
display?: "text" | "flex",
6566
|};
6667

6768
declare export function DataGrid<
@@ -117,6 +118,7 @@ declare module "@mui/x-data-grid" {
117118
// https://github.com/mui/mui-x/blob/v7.12.0/packages/x-data-grid/src/constants/localeTextConstants.ts
118119
noRowsLabel?: string,
119120
|},
121+
onCellKeyDown?: (Row, KeyboardEvent) => void,
120122
|}): Node;
121123

122124
declare export function GridToolbarContainer({|

src/main/webapp/ui/src/eln-dmp-integration/Argos/DMPDialog.js

+6
Original file line numberDiff line numberDiff line change
@@ -639,6 +639,12 @@ function DMPDialogContent({ setOpen }: { setOpen: (boolean) => void }): Node {
639639
}
640640
}}
641641
getRowHeight={() => "auto"}
642+
onCellKeyDown={({ id }, e) => {
643+
if (e.key === " " || e.key === "Enter") {
644+
setSelectedPlan(DMPs.find((d) => d.id === id));
645+
e.stopPropagation();
646+
}
647+
}}
642648
/>
643649
</Grid>
644650
</Grid>

0 commit comments

Comments
 (0)