55 * found at http://www.apache.org/licenses/LICENSE-2.0.
66 */
77
8- import React , { forwardRef , useContext , useMemo } from 'react' ;
8+ import React , { forwardRef , useMemo } from 'react' ;
99import PropTypes from 'prop-types' ;
10+ import { ThemeProvider } from 'styled-components' ;
1011import InfoIcon from '@zendeskgarden/svg-icons/src/16/info-stroke.svg' ;
1112import ErrorIcon from '@zendeskgarden/svg-icons/src/16/alert-error-stroke.svg' ;
1213import WarningIcon from '@zendeskgarden/svg-icons/src/16/alert-warning-stroke.svg' ;
@@ -19,8 +20,6 @@ import { GlobalAlertButton } from './GlobalAlertButton';
1920import { GlobalAlertClose } from './GlobalAlertClose' ;
2021import { GlobalAlertContent } from './GlobalAlertContent' ;
2122import { GlobalAlertTitle } from './GlobalAlertTitle' ;
22- import { DefaultTheme , ThemeContext , ThemeProvider } from 'styled-components' ;
23- import { DEFAULT_THEME } from '@zendeskgarden/react-theming' ;
2423
2524/**
2625 * 1. Global Alert always renders with light theme colors
@@ -36,15 +35,10 @@ const GlobalAlertComponent = forwardRef<HTMLDivElement, IGlobalAlertProps>(
3635 warning : < WarningIcon /> ,
3736 info : < InfoIcon />
3837 } [ type ] ;
39- const theme = useContext ( ThemeContext ) || DEFAULT_THEME ;
40- /* [1] */
41- const lightTheme : DefaultTheme = useMemo (
42- ( ) => ( { ...theme , colors : { ...theme . colors , base : 'light' } } ) ,
43- [ theme ]
44- ) ;
4538
4639 return (
47- < ThemeProvider theme = { lightTheme } >
40+ /* [1] */
41+ < ThemeProvider theme = { theme => ( { ...theme , colors : { ...theme . colors , base : 'light' } } ) } >
4842 < GlobalAlertContext . Provider value = { useMemo ( ( ) => ( { type } ) , [ type ] ) } >
4943 { /* [2] */ }
5044 { /* eslint-disable-next-line jsx-a11y/prefer-tag-over-role */ }
0 commit comments