diff --git a/modules/settings/assets/js/components/bottom-bar/index.js b/modules/settings/assets/js/components/bottom-bar/index.js index 078a9e0..2f88f25 100644 --- a/modules/settings/assets/js/components/bottom-bar/index.js +++ b/modules/settings/assets/js/components/bottom-bar/index.js @@ -1,9 +1,19 @@ import Box from '@elementor/ui/Box'; import Button from '@elementor/ui/Button'; +import { styled } from '@elementor/ui/styles'; import { useSettings, useStorage, useToastNotification } from '@ea11y/hooks'; import { mixpanelService } from '@ea11y/services'; import { __ } from '@wordpress/i18n'; +const StyledContainer = styled(Box)` + width: 100%; + display: flex; + justify-content: flex-end; + + padding: ${({ theme }) => theme.spacing(2)}; + border-top: 1px solid ${({ theme }) => theme.palette.divider}; +`; + const BottomBar = () => { const { selectedMenu, @@ -51,13 +61,7 @@ const BottomBar = () => { }; return ( - + - + ); }; diff --git a/modules/settings/assets/js/layouts/menu-settings.js b/modules/settings/assets/js/layouts/menu-settings.js index 06f8091..f92724b 100644 --- a/modules/settings/assets/js/layouts/menu-settings.js +++ b/modules/settings/assets/js/layouts/menu-settings.js @@ -1,5 +1,6 @@ import { CardActions } from '@elementor/ui'; import Alert from '@elementor/ui/Alert'; +import Box from '@elementor/ui/Box'; import Card from '@elementor/ui/Card'; import CardContent from '@elementor/ui/CardContent'; import CardHeader from '@elementor/ui/CardHeader'; @@ -17,12 +18,32 @@ import { useEffect, useState } from '@wordpress/element'; import { __ } from '@wordpress/i18n'; import { MENU_SETTINGS } from '../constants/menu-settings'; -// Customization to override the WP admin global CSS. -const StyledSwitch = styled(Switch)(() => ({ - input: { - height: '56px', - }, -})); +const StyledSwitch = styled(Switch)` + input { + height: 56px; + } +`; + +const StyledCardContent = styled(CardContent)` + height: 50vh; + overflow: auto; + margin-bottom: 61.5px; + padding: 0 ${({ theme }) => theme.spacing(2)}; +`; + +const StyledCardActions = styled(CardActions)` + position: absolute; + width: 100%; + bottom: 0; + + padding: 0; + background: ${({ theme }) => theme.palette.background.paper}; + + & .MuiBox-root { + padding: ${({ theme }) => theme.spacing(1.5)} + ${({ theme }) => theme.spacing(2)}; + } +`; const MenuSettings = () => { const { @@ -40,13 +61,13 @@ const MenuSettings = () => { setDisableOptions(true); } else { setDisableOptions(false); + save({ a11y_hide_minimum_active_options_alert: false }).then(() => { setHideMinimumOptionAlert(false); }); } }, [widgetMenuSettings]); - // Toggle the value of a setting const toggleSetting = (category, option) => { setWidgetMenuSettings((prevSettings) => { const newSettings = { @@ -57,15 +78,16 @@ const MenuSettings = () => { }; setHasChanges(true); + if (window?.ea11yWidget?.toolsSettings && window?.ea11yWidget?.widget) { window.ea11yWidget.toolsSettings = newSettings; window?.ea11yWidget?.widget.updateState(); } + return newSettings; }); }; - // Check if at least two options are enabled const areAtLeastTwoOptionsEnabled = (settings) => { let enabledCount = 0; @@ -87,28 +109,34 @@ const MenuSettings = () => { setHideMinimumOptionAlert(true); }); }; + + const sectionsCount = Object.entries(MENU_SETTINGS).length; + return ( + {__( + 'Choose which accessibility features and capabilities you want to include.', + 'pojo-accessibility', + )} + + } /> + {disableOptions && !hideMinimumOptionAlert && ( {__('At least two option must remain active', 'pojo-accessibility')} )} - + + - {Object.entries(MENU_SETTINGS).map(([parentKey, parentItem]) => { + {Object.entries(MENU_SETTINGS).map(([parentKey, parentItem], i) => { return ( -
+ @@ -116,6 +144,7 @@ const MenuSettings = () => { + {parentItem.options && Object.entries(parentItem.options).map( ([childKey, childValue]) => { @@ -148,22 +177,17 @@ const MenuSettings = () => { ); }, )} - -
+ + {i + 1 < sectionsCount && } + ); })}
-
- + + + - +
); }; diff --git a/modules/settings/assets/js/layouts/statement-link.js b/modules/settings/assets/js/layouts/statement-link.js index 3ff4195..21b2752 100644 --- a/modules/settings/assets/js/layouts/statement-link.js +++ b/modules/settings/assets/js/layouts/statement-link.js @@ -13,6 +13,7 @@ import MenuItem from '@elementor/ui/MenuItem'; import Select from '@elementor/ui/Select'; import Switch from '@elementor/ui/Switch'; import Typography from '@elementor/ui/Typography'; +import { styled } from '@elementor/ui/styles'; import { CopyLink, WidgetLoader, @@ -24,6 +25,14 @@ import { useEntityRecords } from '@wordpress/core-data'; import { useEffect, useState } from '@wordpress/element'; import { __ } from '@wordpress/i18n'; +const StyledPreviewContainer = styled(Box)` + padding: 0; + margin-top: ${({ theme }) => theme.spacing(2)}; + + border-radius: 4px; + border: 1px solid ${({ theme }) => theme.palette.divider}; +`; + const StatementLink = () => { const [disabled, setDisabled] = useState(true); const [isValidPage, setIsValidPage] = useState(false); @@ -97,10 +106,13 @@ const StatementLink = () => { await save({ ea11y_accessibility_statement_data: accessibilityStatementData, }); - await success('Settings saved'); + + await success('Changes saved'); + setDisabled(true); } catch (e) { error('Failed to save settings!'); + console.error(e); } }; @@ -208,14 +220,12 @@ const StatementLink = () => { {__('Preview link in widget', 'pojo-accessibility')} - - + diff --git a/modules/settings/assets/js/layouts/widget-preview.js b/modules/settings/assets/js/layouts/widget-preview.js index 5f35967..ca4f21f 100644 --- a/modules/settings/assets/js/layouts/widget-preview.js +++ b/modules/settings/assets/js/layouts/widget-preview.js @@ -1,30 +1,47 @@ import Card from '@elementor/ui/Card'; import CardContent from '@elementor/ui/CardContent'; import CardHeader from '@elementor/ui/CardHeader'; +import Typography from '@elementor/ui/Typography'; +import { styled } from '@elementor/ui/styles'; import { WidgetLoader } from '@ea11y/components'; import { __ } from '@wordpress/i18n'; +const StyledPreview = styled(CardContent)` + margin-right: auto; + margin-left: auto; + margin-top: ${({ theme }) => theme.spacing(4)}; + padding: 0 24px; + + overflow: auto; + + & #ea11y-root { + position: absolute; + top: 0; + left: 0; + right: 0; + + transform: scale(70%); + } +`; + const WidgetPreview = () => { return ( <> + {__( + 'This is what the widget will look like to your site viewers.', + 'pojo-accessibility', + )} + + } + sx={{ paddingBottom: 0 }} /> - + + diff --git a/modules/settings/assets/js/pages/menu.js b/modules/settings/assets/js/pages/menu.js index 1f24332..7767575 100644 --- a/modules/settings/assets/js/pages/menu.js +++ b/modules/settings/assets/js/pages/menu.js @@ -1,11 +1,18 @@ import Box from '@elementor/ui/Box'; import Container from '@elementor/ui/Container'; import Typography from '@elementor/ui/Typography'; +import { styled } from '@elementor/ui/styles'; import { MenuSettings, WidgetPreview } from '@ea11y/layouts'; import { mixpanelService } from '@ea11y/services'; import { useEffect } from '@wordpress/element'; import { __ } from '@wordpress/i18n'; +const StyledContainer = styled(Container)` + overflow: auto; + max-height: 100%; + padding: ${({ theme }) => theme.spacing(5)}; +`; + const Menu = () => { useEffect(() => { mixpanelService.sendEvent('page_view', { @@ -14,15 +21,16 @@ const Menu = () => { }, []); return ( - + {__('Capabilities', 'pojo-accessibility')} + - + ); };