# ghostkit/3.3.3/gutenberg/blocks/icon/save.js

Block Animations, Motion &amp; Scroll Effects – Ghost Kit, version 3.3.3. 61 lines.

- Page: https://pluginprobe.com/plugins/ghostkit/3.3.3/code/gutenberg/blocks/icon/save.js
- Raw: https://pluginprobe.com/plugins/ghostkit/3.3.3/raw/gutenberg/blocks/icon/save.js
- Modified: 2024-02-18T18:40:24+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/ghostkit/3.3.3/code/gutenberg/blocks/icon/save.js#L10-L20`.

```javascript
import classnames from 'classnames/dedupe';

import IconPicker from '../../components/icon-picker';
import metadata from './block.json';

const { name } = metadata;

import { useBlockProps } from '@wordpress/block-editor';
import { applyFilters } from '@wordpress/hooks';

/**
 * Block Save Class.
 *
 * @param props
 */
export default function BlockSave(props) {
	const { attributes } = props;
	const { flipV, flipH } = attributes;

	let className = classnames('ghostkit-icon', {
		'ghostkit-icon-flip-vertical': flipV,
		'ghostkit-icon-flip-horizontal': flipH,
	});

	className = applyFilters('ghostkit.blocks.className', className, {
		...{ name },
		...props,
	});

	const blockProps = useBlockProps.save({ className });

	return (
		<div {...blockProps}>
			<Icon attributes={props.attributes} />
		</div>
	);
}

function Icon({ attributes }) {
	const { icon, url, target, ariaLabel, rel } = attributes;

	const tag = url ? 'a' : 'div';
	const attrs = {};

	if (tag === 'a') {
		attrs.href = url;
		attrs.target = target || null;
		attrs.rel = rel || null;
		attrs.ariaLabel = ariaLabel || null;
	}

	return (
		<IconPicker.Render
			{...attrs}
			name={icon}
			tag={tag}
			className="ghostkit-icon-inner"
		/>
	);
}

```
