Skip to content

Commit

Permalink
mobile sidebar
Browse files Browse the repository at this point in the history
  • Loading branch information
Agrim Jain authored and Agrim Jain committed May 14, 2024
1 parent 45f4c70 commit e7ddbb0
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 10 deletions.
10 changes: 10 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
},
"dependencies": {
"@deriv/deriv-api": "^1.0.11",
"@deriv/quill-icons": "^1.22.7",
"@deriv/ui": "^0.1.0",
"@docusaurus/core": "^2.4.0",
"@docusaurus/plugin-client-redirects": "^2.4.0",
Expand Down
15 changes: 10 additions & 5 deletions src/theme/Navbar/MobileSidebar/PrimaryMenu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ import { splitNavbarItems, useNavbarMobileSidebar } from '@docusaurus/theme-comm
import NavbarItem from '@theme/NavbarItem';
import './primary-menu.scss';
import { Button } from '@deriv/ui';
import {
LabelPairedGlobeCaptionRegularIcon,
StandaloneChevronLeftRegularIcon,
} from '@deriv/quill-icons';

export function useNavbarItems() {
// TODO temporary casting until ThemeConfig type is improved
Expand Down Expand Up @@ -50,18 +54,19 @@ export default function CustomMobileSidebar() {
))}
</div>
<div className='navbar__item navbar__link' onClick={toggleLanguageSidebar}>
<img src='/static/language-switcher.svg' alt='Language Switcher' />
<LabelPairedGlobeCaptionRegularIcon /> EN
</div>

{/* Conditionally render the language sidebar */}
<div className={`language_sidebar ${languageSidebarVisible ? 'visible' : ''}`}>
<Button onClick={toggleLanguageSidebar} className='language_sidebar__buttons'>
<img src='static/img/chevron-left'></img>
<StandaloneChevronLeftRegularIcon iconSize='md' />
</Button>
<div className='language_sidebar__items'>
<div>En</div>
<div>Fr</div>
<div>Th</div>
<div>English</div>
<div>Español</div>
<div>Français</div>
<div>Português</div>
</div>
</div>
</React.Fragment>
Expand Down
23 changes: 18 additions & 5 deletions src/theme/Navbar/MobileSidebar/PrimaryMenu/primary-menu.scss
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
@media (max-width: 996px) {
.navbar-sidebar__item {
.navbar__item {
display: block;
padding: var(--ifm-menu-link-padding-vertical) var(--ifm-menu-link-padding-horizontal);
display: flex;
padding: 16px 16px;
font-size: 0.875rem;
align-items: flex-start;
gap: 8px;
align-self: stretch;
font-weight: var(--ifm-font-weight-normal);
line-height: 1.25rem;
height: 40px;
Expand Down Expand Up @@ -39,14 +42,24 @@

&__buttons {
display: flex;
justify-content: space-between;
width: 32px;
height: 32px;
padding: 0px 16px;
justify-content: center;
align-items: center;
border-bottom: 1px solid var(--ifm-navbar-border-color);
}

&__items {
margin: 18px;
margin-top: 16px;
display: flex;
height: 48px;
min-height: 48px;
max-height: 48px;
padding: 0px 16px;
padding-left: 32px;
padding-right: 32px;
gap: 32px;
align-self: stretch;
height: calc(100% - var(--ifm-navbar-height));
transform: translateZ(0);
transition: transform var(--ifm-transition-fast) ease-in-out;
Expand Down

0 comments on commit e7ddbb0

Please sign in to comment.