-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #85 from shayan-deriv/shayan/feq-2277/add-notifica…
…tion-dropdown-to-header fix: resolved style mismatch in header component + added notification
- Loading branch information
Showing
14 changed files
with
2,649 additions
and
2,614 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,5 +3,6 @@ | |
|
||
@include mobile { | ||
padding-left: 0; | ||
height: 4rem; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
.app-header__logo { | ||
padding-left: 1.2rem; | ||
padding-right: 2rem; | ||
border-right: 1px solid #f2f3f4; | ||
height: 32px; | ||
display: flex; | ||
align-items: center; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { DerivLogo, useDevice } from '@deriv-com/ui'; | ||
import { URLConstants } from '@deriv-com/utils'; | ||
import './AppLogo.scss'; | ||
|
||
export const AppLogo = () => { | ||
const { isDesktop } = useDevice(); | ||
|
||
if (!isDesktop) return null; | ||
return ( | ||
<DerivLogo | ||
className='app-header__logo' | ||
href={URLConstants.derivComProduction} | ||
target='_blank' | ||
variant='wallets' | ||
/> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.app-header__menu { | ||
gap: 0.8rem; | ||
padding: 1.25rem 1.25rem 1.25rem 1.65rem; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { useTranslations } from '@deriv-com/translations'; | ||
import { MenuItem, Text, useDevice } from '@deriv-com/ui'; | ||
import { MenuItems as items } from '../HeaderConfig'; | ||
import './MenuItems.scss'; | ||
|
||
export const MenuItems = () => { | ||
const { localize } = useTranslations(); | ||
const { isDesktop } = useDevice(); | ||
|
||
return ( | ||
<> | ||
{isDesktop ? ( | ||
items.map(({ as, href, icon, label }) => ( | ||
<MenuItem as={as} className='app-header__menu' href={href} key={label} leftComponent={icon}> | ||
<Text>{localize(label)}</Text> | ||
</MenuItem> | ||
)) | ||
) : ( | ||
<MenuItem | ||
as={items[1].as} | ||
className='flex gap-2 p-5' | ||
href={items[1].href} | ||
key={items[1].label} | ||
leftComponent={items[1].icon} | ||
> | ||
<Text>{localize(items[1].label)}</Text> | ||
</MenuItem> | ||
)} | ||
</> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { useState } from 'react'; | ||
import { LegacyMenuHamburger2pxIcon } from '@deriv/quill-icons'; | ||
import { Drawer, useDevice } from '@deriv-com/ui'; | ||
|
||
export const MobileMenu = () => { | ||
const [isDrawerOpen, setIsDrawerOpen] = useState(false); | ||
const { isDesktop } = useDevice(); | ||
|
||
if (isDesktop) return null; | ||
return ( | ||
<> | ||
<div className='flex items-center justify-center py-2 px-4 h-full' onClick={() => setIsDrawerOpen(true)}> | ||
<LegacyMenuHamburger2pxIcon iconSize='xs' /> | ||
</div> | ||
<Drawer | ||
isOpen={isDrawerOpen} | ||
onCloseDrawer={() => { | ||
setIsDrawerOpen(false); | ||
}} | ||
width='300px' | ||
> | ||
aaa | ||
</Drawer> | ||
</> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { useState } from 'react'; | ||
import { LegacyNotificationIcon } from '@deriv/quill-icons'; | ||
import { useTranslations } from '@deriv-com/translations'; | ||
import { Notifications as UINotifications, TooltipMenuIcon, useDevice } from '@deriv-com/ui'; | ||
|
||
export const Notifications = () => { | ||
const [isOpen, setIsOpen] = useState(false); | ||
const { localize } = useTranslations(); | ||
const { isDesktop } = useDevice(); | ||
return ( | ||
<> | ||
<TooltipMenuIcon | ||
as='button' | ||
className={isDesktop ? 'mr-4 pl-2 border-l-[1px] h-[32px]' : ''} | ||
disableHover | ||
onClick={() => setIsOpen(!isOpen)} | ||
tooltipContainerClassName='z-20' | ||
tooltipContent={localize('View notifications')} | ||
tooltipPosition='bottom' | ||
> | ||
<LegacyNotificationIcon fill='red' iconSize='sm' /> | ||
</TooltipMenuIcon> | ||
<UINotifications | ||
className={isDesktop ? 'notifications__wrapper absolute top-20 right-80 z-10' : ''} | ||
clearNotificationsCallback={() => {}} | ||
componentConfig={{ | ||
clearButtonText: localize('Clear all'), | ||
modalTitle: localize('Notifications'), | ||
noNotificationsMessage: localize('No notifications MESSAGE'), | ||
noNotificationsTitle: localize('No notifications'), | ||
}} | ||
isOpen={isOpen} | ||
notifications={[]} | ||
setIsOpen={setIsOpen} | ||
/> | ||
</> | ||
); | ||
}; |
3 changes: 3 additions & 0 deletions
3
src/components/AppHeader/PlatformSwitcher/PlatformSwitcher.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.app-header__platform-switcher { | ||
padding: 0 1.6rem; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { useTranslations } from '@deriv-com/translations'; | ||
import { PlatformSwitcher as UIPlatformSwitcher, PlatformSwitcherItem, useDevice } from '@deriv-com/ui'; | ||
import { platformsConfig } from '../HeaderConfig'; | ||
import './PlatformSwitcher.scss'; | ||
|
||
export const PlatformSwitcher = () => { | ||
const { localize } = useTranslations(); | ||
const { isDesktop } = useDevice(); | ||
|
||
if (!isDesktop) return null; | ||
return ( | ||
<UIPlatformSwitcher | ||
bottomLinkLabel={localize('Looking for CFDs? Go to Trader’s Hub')} | ||
buttonProps={{ | ||
className: 'app-header__platform-switcher', | ||
icon: platformsConfig[0].buttonIcon, | ||
}} | ||
> | ||
{platformsConfig.map(({ active, description, href, icon }) => ( | ||
<PlatformSwitcherItem | ||
active={active} | ||
description={localize(description)} | ||
href={href} | ||
icon={icon} | ||
key={description} | ||
/> | ||
))} | ||
</UIPlatformSwitcher> | ||
); | ||
}; |