one-click-accessibility/modules/settings/assets/js/layouts/sidebar.js
VasylD 9c9536cbeb
[APP-2130] add elementor one (#433)
* [APP-0000] add elementor one

* [APP-0000] add elementor one

* [APP-2207] add dashboard widget

* [APP-2207] add dashboard widget

* [APP-2207] add dashboard widget

* [APP-2207] add dashboard widget

* [APP-0000] Add slug to the connect config

* [APP-0000] Update connect config

* [APP-0000] Update connect config

* [APP-0000] Update connect config

* [APP-0000] Update connect config

* [APP-0000] Update connect config

* Hide sidebar footer if Elementor One is connected

* fix: import errors on opening the scanner

* [APP-0000] Update connect config

* Update modules/settings/module.php

Co-authored-by: Rami Yushuvaev <92088692+rami-elementor@users.noreply.github.com>

* [APP-2270] Top bar implementation (#458)

* [APP-2270] Top bar implementation

* Update top bar title

* Update packages

* fix: env for top bar

* update: ally menu location

* Fix pointer

* Update

* Update

* Update

* Update

* Update

* Fix design saving

* Add missing pro icon to sidebar menu

* Sidebar icons sizes

* Fix link to "Manage subscription"

* fix: header name

* Update logo icon in the sidebar

* Remove logos from modal/dialog headers

* Update button colors

* Make the "Get started" modal dismissible

* Update crown icon

* Update

* Role attribute

* Update logo icon

* Update list item padding

* [APP-0000] Update connect config

* [ACD-7909] Enable Pro features on One

* Update menu order

* [ACD-7909] Enable Pro features on One

* [ACD-7909] Enable Pro features on One

* Hide pointers from Elementor One users

* [ACD-7909] Enable Pro features on One

* fix: don't show notices in some cases (#466)

* [ACD-7794] Fix subitem color and spacing, info and pro icon size (#464)

* fix: subitem color and spacing, info and pro icon size

* chore: update elementor-one-assets package to 0.4.16

* fix: PLG margin and button style issue (#463)

---------

Co-authored-by: Nirbhay Singh <nirbhayr@elementor.com>
Co-authored-by: vasyldinets <vasyld@elementor.red>
Co-authored-by: Nirbhay Singh <121793120+nirbhayel@users.noreply.github.com>

---------

Co-authored-by: Rami Yushuvaev <ramiy@elementor.com>
Co-authored-by: Nirbhay Singh <nirbhayr@elementor.com>
Co-authored-by: Rami Yushuvaev <92088692+rami-elementor@users.noreply.github.com>
Co-authored-by: Nirbhay Singh <121793120+nirbhayel@users.noreply.github.com>
2026-01-12 12:26:38 +01:00

102 lines
2.4 KiB
JavaScript

import ChevronLeftIcon from '@elementor/icons/ChevronLeftIcon';
import Divider from '@elementor/ui/Divider';
import Drawer from '@elementor/ui/Drawer';
import IconButton from '@elementor/ui/IconButton';
import { styled } from '@elementor/ui/styles';
import { SidebarHeading, SidebarMenu } from '@ea11y/components';
import { useSettings } from '@ea11y/hooks';
import { QuotaBar } from '@ea11y/layouts';
import { __ } from '@wordpress/i18n';
import { usePluginSettingsContext } from '../contexts/plugin-settings';
const Sidebar = () => {
const { openSidebar, setOpenSidebar } = useSettings();
const { isElementorOne } = usePluginSettingsContext();
return (
<StyledDrawer
variant="permanent"
open={openSidebar}
role="navigation"
aria-label={__('Sidebar', 'pojo-accessibility')}
>
<StyledToggleButton
onClick={() => setOpenSidebar(!openSidebar)}
size="small"
aria-label={__('Toggle sidebar', 'pojo-accessibility')}
>
<ChevronLeftIcon
aria-hidden={true}
fontSize="tiny"
sx={{ rotate: !openSidebar ? '180deg' : '0' }}
/>
</StyledToggleButton>
<SidebarHeaderWrapper>
<SidebarHeading />
<Divider />
</SidebarHeaderWrapper>
<SidebarMenuWrapper>
<SidebarMenu />
</SidebarMenuWrapper>
{!isElementorOne && (
<SidebarFooterWrapper>
<Divider />
<QuotaBar />
</SidebarFooterWrapper>
)}
</StyledDrawer>
);
};
export default Sidebar;
const StyledToggleButton = styled(IconButton)`
position: absolute;
inset-inline-end: -15px;
inset-block-start: 58px;
z-index: 999999;
border: 1px solid ${({ theme }) => theme.palette.divider};
background: ${({ theme }) => theme.palette.background.paper};
:hover,
:focus-visible {
background: #f3f3f4;
}
`;
const StyledDrawer = styled(Drawer, {
shouldForwardProp: (prop) => prop !== 'open',
})`
width: auto;
& .MuiDrawer-paper {
position: relative;
width: ${({ open }) => (open ? '240px' : '72px')};
height: 100%;
justify-content: space-between;
padding-block-start: 0;
overflow: visible;
transition: all 0.3s;
}
`;
const SidebarHeaderWrapper = styled('div')`
flex-shrink: 0;
padding: ${({ theme }) => theme.spacing(2, 2, 0)};
display: flex;
flex-direction: column;
gap: ${({ theme }) => theme.spacing(2)};
`;
const SidebarMenuWrapper = styled('div')`
flex: 1;
padding: ${({ theme }) => theme.spacing(2)};
overflow-y: auto;
`;
const SidebarFooterWrapper = styled('div')`
flex-shrink: 0;
`;