Skip to content

Commit

Permalink
feat: fix Drawer and add browsers list config
Browse files Browse the repository at this point in the history
  • Loading branch information
sashtje committed Sep 22, 2023
1 parent 51ff0fe commit ad05b17
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
3 changes: 3 additions & 0 deletions .browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Browsers that we support
defaults
not IE 11
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { Button } from '@/shared/ui';
import { ButtonTheme } from '@/shared/ui/Button';
import { Icon } from '@/shared/ui/Icon';
import NotificationIcon from '@/shared/assets/icons/notifications-20-20.svg';
import { AnimationProvider } from '@/shared/lib/components/AnimationProvider';

import cls from './NotificationButton.module.scss';

Expand Down Expand Up @@ -50,11 +49,9 @@ export const NotificationButton = memo((props: NotificationButtonProps) => {
<MobileView>
{trigger}

<AnimationProvider>
<Drawer isOpen={isOpen} onClose={onCloseDrawer}>
<NotificationsList />
</Drawer>
</AnimationProvider>
<Drawer isOpen={isOpen} onClose={onCloseDrawer}>
<NotificationsList />
</Drawer>
</MobileView>
</div>
);
Expand Down
14 changes: 11 additions & 3 deletions src/shared/ui/Drawer/ui/Drawer.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ReactNode, useCallback, useEffect } from 'react';

import { classNames } from '@/shared/lib/classNames';
import { useAnimationLibs } from '@/shared/lib/components/AnimationProvider';
import { AnimationProvider, useAnimationLibs } from '@/shared/lib/components/AnimationProvider';

import { Portal } from '../../Portal';
import { Overlay } from '../../Overlay';
Expand Down Expand Up @@ -94,12 +94,20 @@ const DrawerContent = (props: DrawerProps) => {
);
};

export const Drawer = (props: DrawerProps) => {
const DrawerAsync = (props: DrawerProps) => {
const { isLoaded } = useAnimationLibs();

if (!isLoaded) {
return null;
}

return <DrawerContent {...props} />;
return (
<DrawerContent {...props} />
);
};

export const Drawer = (props: DrawerProps) => (
<AnimationProvider>
<DrawerAsync {...props} />
</AnimationProvider>
);

0 comments on commit ad05b17

Please sign in to comment.