Skip to content

Commit

Permalink
Fix props to dialog component in controller
Browse files Browse the repository at this point in the history
  • Loading branch information
fgatti675 committed Dec 18, 2024
1 parent 81a6eef commit 9b85eb5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions packages/firecms_core/src/contexts/DialogsProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const DialogsProvider: React.FC<PropsWithChildren<{}>> = ({ children }) =
const [dialogEntries, setDialogEntries] = useState<DialogControllerEntryProps[]>([]);
const dialogEntriesRef = useRef<DialogControllerEntryProps[]>(dialogEntries);

const updateDialogEntries = (newPanels: DialogControllerEntryProps[]) => {
const updateDialogEntries = (newPanels: DialogControllerEntryProps<any>[]) => {
dialogEntriesRef.current = newPanels;
setDialogEntries(newPanels);
};
Expand All @@ -23,7 +23,7 @@ export const DialogsProvider: React.FC<PropsWithChildren<{}>> = ({ children }) =

}, [dialogEntries]);

const open = useCallback((dialogEntry: DialogControllerEntryProps) => {
const open = useCallback(<T extends object = object>(dialogEntry: DialogControllerEntryProps<T>) => {

const updatedPanels = [...dialogEntriesRef.current, dialogEntry];
updateDialogEntries(updatedPanels);
Expand Down
2 changes: 1 addition & 1 deletion packages/firecms_core/src/core/DefaultDrawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ export function DrawerLogo({ logo }: {
{logo
? <img src={logo}
alt="Logo"
className={cls("max-w-full max-h-full transition-all",
className={cls("max-w-full max-h-full transition-all object-contain",
drawerOpen ? "w-[96px] h-[96px]" : "w-[32px] h-[32px]")}/>
: <FireCMSLogo/>}

Expand Down
4 changes: 2 additions & 2 deletions packages/firecms_core/src/types/dialogs_controller.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ export interface DialogsController {
* Open a dialog
* @param props
*/
open: (props: DialogControllerEntryProps) => { closeDialog: () => void };
open: <T extends object = object>(props: DialogControllerEntryProps<T>) => { closeDialog: () => void };
}

/**
* Props used to open a side dialog
* @group Hooks and utilities
*/
export interface DialogControllerEntryProps<T extends object = {}> {
export interface DialogControllerEntryProps<T extends object = object> {

key: string;
/**
Expand Down

0 comments on commit 9b85eb5

Please sign in to comment.