Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
7b61989
ButtonOrLink: extend props with HTMLElements
clairep94 Sep 1, 2025
ef9b265
useModalClose: update to use T
clairep94 Sep 1, 2025
342d2ab
usePrevious: update to use T
clairep94 Sep 1, 2025
067fea8
useAsModal: delete -- unused
clairep94 Sep 1, 2025
5f511f6
RootePage: update to tsx, no-verify
clairep94 Sep 1, 2025
f51af61
RootPage: update to named export and add props interface
clairep94 Sep 1, 2025
a77d064
PreviewNav: migrate to tsx, no-verify
clairep94 Sep 1, 2025
4b03c97
PreviewNav: update to named export, add custom.d.ts for svg definitio…
clairep94 Sep 1, 2025
160a962
Dropdown: Migrate DropdownWrapper to DropdownMenu and delete file due…
clairep94 Sep 1, 2025
f017cad
DropdownMenu: update to tsx, no-verify
clairep94 Sep 1, 2025
62cafae
DropdownMenu: add props interfaces, update to named export --no-verify
clairep94 Sep 1, 2025
64bac25
MenuItem: update to tsx --no-verify
clairep94 Sep 1, 2025
e80fa38
MenuItem: add props interface and update to named export --no-verify
clairep94 Sep 1, 2025
26c65c3
TableDropdown: update to tsx, no-verify
clairep94 Sep 1, 2025
abc09e9
TableDropdown: add interface and update to named export, no-verify
clairep94 Sep 1, 2025
43cb138
useModalClose: add normaliser for when passedRef is a forwarded ref
clairep94 Sep 1, 2025
f9042a0
Menubar/contexts: update to tsx --no-verify
clairep94 Sep 1, 2025
5a74f2a
Menubar: update component & test to tsx, no verify
clairep94 Sep 1, 2025
ca99e21
Menubar: add interface, fix type errors, update context types and upd…
clairep94 Sep 1, 2025
69ac8e3
MenubarItem: migrate to tsx, no-verify
clairep94 Sep 1, 2025
1fc953f
MenubarItem: add interface, update to named export, update submenu co…
clairep94 Sep 1, 2025
3af8347
DropdownMenu: update logic for DropdownWrapper for simplicity
clairep94 Sep 1, 2025
ee60603
Menubar/contexts: update to make all handlers optional
clairep94 Sep 2, 2025
75bdd16
Merge branch 'develop' into pr05/Migrate_client_components_final_rebuild
clairep94 Sep 3, 2025
52be7e3
Merge branch 'develop' into pr05/Migrate_client_components_final_rebuild
raclim Sep 4, 2025
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
2 changes: 1 addition & 1 deletion client/common/ButtonOrLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Link } from 'react-router-dom';
/**
* Accepts all the props of an HTML <a> or <button> tag.
*/
export interface ButtonOrLinkProps {
export interface ButtonOrLinkProps extends React.HTMLAttributes<HTMLElement> {
/**
* Can be internal or external ('http'- or 'https'-).
*/
Expand Down
29 changes: 23 additions & 6 deletions client/common/useModalClose.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useEffect, useRef, MutableRefObject } from 'react';
import { useEffect, useRef, MutableRefObject, ForwardedRef } from 'react';
import { useKeyDownHandlers } from './useKeyDownHandlers';

/**
Expand All @@ -18,12 +18,29 @@ import { useKeyDownHandlers } from './useKeyDownHandlers';
* @param passedRef - Optional ref to the modal element. If not provided, one is created internally.
* @returns A ref to be attached to the modal DOM element
*/
export function useModalClose(
export function useModalClose<T extends HTMLElement = HTMLElement>(
onClose: () => void,
passedRef?: MutableRefObject<HTMLElement | null>
): MutableRefObject<HTMLElement | null> {
const createdRef = useRef<HTMLElement | null>(null);
const modalRef = passedRef ?? createdRef;
passedRef?: MutableRefObject<T | null> | ForwardedRef<T>
): MutableRefObject<T | null> {
const createdRef = useRef<T | null>(null);

// Normalize any ref to a MutableRefObject internally
const modalRef: MutableRefObject<T | null> = (() => {
if (!passedRef) return createdRef;
if (typeof passedRef === 'function') {
// For function refs, write to createdRef and call the function
return {
get current() {
return createdRef.current;
},
set current(value: T | null) {
createdRef.current = value;
passedRef(value);
}
};
}
return passedRef;
})();

useEffect(() => {
modalRef.current?.focus();
Expand Down
4 changes: 2 additions & 2 deletions client/common/usePrevious.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { useEffect, useRef } from 'react';
* @param value - The current value to track.
* @returns The previous value before the current render, or undefined if none.
*/
export function usePrevious(value: unknown): unknown | undefined {
const ref = useRef<unknown>();
export function usePrevious<T>(value: T): T | undefined {
const ref = useRef<T>();

useEffect(() => {
ref.current = value;
Expand Down
110 changes: 0 additions & 110 deletions client/components/Dropdown.jsx

This file was deleted.

108 changes: 0 additions & 108 deletions client/components/Dropdown/DropdownMenu.jsx

This file was deleted.

Loading
Loading