one-click-accessibility/modules/settings/assets/js/components/custom-icon/index.js
Nirbhay Singh fcaba863b4
[APP-1417] Add support for custom icon (#270)
* add: media upload button

* add: support for custom icon

* fix: code alignment, phpcs

* fix: code alignment and linting

* add: mixpanel events

* fix: styling of custom svg

* fix: missing variable

* fix: missing variable

* fix: load gutenberg block without css

* fix: icon spacing in preview

* fix: indentation

* fix: indents
2025-05-12 22:48:08 +05:30

35 lines
775 B
JavaScript

import { styled } from '@elementor/ui/styles';
import { useSettings } from '@ea11y/hooks';
const CustomIcon = ({ size }) => {
const { iconDesign } = useSettings();
const strokeColor = `lch(from ${iconDesign?.color || '#fff'} calc((50 - l) * 100) 0 0)`;
return (
<StyledDiv
className="custom-icon"
style={{
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
}}
dangerouslySetInnerHTML={{ __html: iconDesign?.custom?.svg }}
size={size}
strokeColor={strokeColor}
/>
);
};
export default CustomIcon;
const StyledDiv = styled('div')`
svg {
font-size: ${({ size }) => size}px;
width: ${({ size }) => size}px;
fill: ${({ strokeColor }) => strokeColor};
path {
fill: ${({ strokeColor }) => strokeColor};
}
}
`;