one-click-accessibility/modules/settings/assets/js/components/edit-link/index.js
Nirbhay Singh 0dac7e1699
[APP-1198] [APP-1199] Quota bar and notices (#219)
* add: quota bar

* add: openLink helper function

* add: styled elements and visits link placeholder

* update: remove hover state from the box

* add: quota notices

* update: quota access and usage calculations

* add: logic to calculate plan usage

* update: move logic to calculate plan usage to hook

* add: todo note

* add: todos

* add: mixpanel events

* fix: hide quota bar when sidebar is minimized

* fix: settings panel was not expanding when sidebar is minimized

* update: text and structure of the bar

* update: quota calculation logic

* update: remove TODOs

* update: text and values

* fix: height of the container for icon settings

* update: golinks

* update: golinks
2025-03-17 10:23:26 +02:00

55 lines
1.3 KiB
JavaScript

import { EditIcon } from '@elementor/icons';
import IconButton from '@elementor/ui/IconButton';
import Tooltip from '@elementor/ui/Tooltip';
import { useSettings } from '@ea11y/hooks';
import { __ } from '@wordpress/i18n';
import { addQueryArgs } from '@wordpress/url';
import { openLink } from '../../utils';
const EditLink = () => {
const { accessibilityStatementData } = useSettings();
const handleEdit = () => {
const adminUrl = window?.ea11ySettingsData?.adminUrl;
const url = addQueryArgs(`${adminUrl}post.php`, {
post: accessibilityStatementData?.pageId,
action: 'edit',
});
openLink(url);
};
return (
<Tooltip
placement="top"
title={__('Edit page', 'pojo-accessibility')}
arrow
PopperProps={{
modifiers: [
{
name: 'offset',
options: {
offset: [0, -16], // Adjusts the vertical (top) margin
},
},
{
name: 'zIndex',
enabled: true,
phase: 'beforeWrite',
fn: ({ state }) => {
state.styles.popper.zIndex = '99999'; // Apply zIndex to the Popper element
},
},
],
}}
>
<IconButton
onClick={handleEdit}
sx={{ marginLeft: 1 }}
aria-label="Edit accessibility statement page"
>
<EditIcon />
</IconButton>
</Tooltip>
);
};
export default EditLink;