diff --git a/frontend/src/Context/BackgroundEffectsDialog/BackgroundEffectsDialogContext.tsx b/frontend/src/Context/BackgroundEffectsDialog/BackgroundEffectsDialogContext.tsx new file mode 100644 index 000000000..cdbcb9796 --- /dev/null +++ b/frontend/src/Context/BackgroundEffectsDialog/BackgroundEffectsDialogContext.tsx @@ -0,0 +1,62 @@ +import React, { createContext, useState, useContext, ReactNode, useMemo } from 'react'; + +interface BackgroundEffectsDialogContextType { + isOpen: boolean; + open: () => void; + close: () => void; +} + +const BackgroundEffectsDialogContext = createContext< + BackgroundEffectsDialogContextType | undefined +>(undefined); + +interface BackgroundEffectsDialogProviderProps { + children: ReactNode; +} + +/** + * BackgroundEffectsDialogProvider + * + * Provides context for managing the BackgroundEffectsDialog state across components. + * This allows any child component to open or close the background effects dialog. + * @param {BackgroundEffectsDialogProviderProps} props - The props for the component. + * @property {ReactNode} children - The child components. + * @returns {React.ReactElement} - The BackgroundEffectsDialogProvider component + */ +export const BackgroundEffectsDialogProvider: React.FC = ({ + children, +}) => { + const [isOpen, setIsOpen] = useState(false); + + const value = useMemo( + () => ({ + isOpen, + open: () => setIsOpen(true), + close: () => setIsOpen(false), + }), + [isOpen] + ); + + return ( + + {children} + + ); +}; + +/** + * useBackgroundEffectsDialog + * + * Custom hook to access the BackgroundEffectsDialog context. + * @returns {BackgroundEffectsDialogContextType} The context value with isOpen, open, and close functions. + * @throws {Error} If used outside of BackgroundEffectsDialogProvider. + */ +export const useBackgroundEffectsDialog = (): BackgroundEffectsDialogContextType => { + const context = useContext(BackgroundEffectsDialogContext); + if (!context) { + throw new Error( + 'useBackgroundEffectsDialog must be used within a BackgroundEffectsDialogProvider' + ); + } + return context; +}; diff --git a/frontend/src/Context/BackgroundEffectsDialog/index.ts b/frontend/src/Context/BackgroundEffectsDialog/index.ts new file mode 100644 index 000000000..a4d6089ed --- /dev/null +++ b/frontend/src/Context/BackgroundEffectsDialog/index.ts @@ -0,0 +1,4 @@ +export { + BackgroundEffectsDialogProvider, + useBackgroundEffectsDialog, +} from './BackgroundEffectsDialogContext'; diff --git a/frontend/src/Context/Theme/helpers/getMuiCustomTheme.ts b/frontend/src/Context/Theme/helpers/getMuiCustomTheme.ts index d853a5cd0..d37225c8e 100644 --- a/frontend/src/Context/Theme/helpers/getMuiCustomTheme.ts +++ b/frontend/src/Context/Theme/helpers/getMuiCustomTheme.ts @@ -159,6 +159,13 @@ const getMuiCustomTheme = ({ tokens }: { tokens: ThemeTokens }) => { root: { backgroundColor: colors.onSecondary, color: colors.textSecondary, + }, + }, + }, + MuiMenuItem: { + styleOverrides: { + root: { + color: colors.textSecondary, fontSize: tokens.typography.typeScale.desktop['body-base'].fontSize.value, lineHeight: tokens.typography.typeScale.desktop['body-base'].lineHeight.value, }, diff --git a/frontend/src/components/JoinExistingRoom/JoinExistingRoom.tsx b/frontend/src/components/JoinExistingRoom/JoinExistingRoom.tsx index ec89eeca8..fdab97009 100644 --- a/frontend/src/components/JoinExistingRoom/JoinExistingRoom.tsx +++ b/frontend/src/components/JoinExistingRoom/JoinExistingRoom.tsx @@ -14,13 +14,7 @@ const JoinExistingRoom = (): ReactElement => { const [hasError, setHasError] = useState(false); return ( - + ( + +); + /** * LanguageSelector Component * A dropdown component that allows users to select their preferred language. @@ -48,6 +53,7 @@ const LanguageSelector = ({ showFlag = true }: LanguageSelectorProps): ReactElem