PluginProbe
Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News / 4.0.8
Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News v4.0.8
4.0.8 4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 4.0.2 4.0.1 2.3.5 2.3.6 2.4.0 2.4.1 2.4.10 2.4.11 2.4.12 2.4.13 2.4.14 2.4.15 2.4.16 2.4.17 2.4.18 2.4.19 2.4.2 2.4.20 2.4.21 All 88 releases
post-carousel / src / blocks / section-heading / save.js

save.js in Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News 4.0.8, at src/blocks/section-heading/save.js

89 lines 2.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { RichText, useBlockProps } from "@wordpress/block-editor";
2 import HeadingWrapper from "./headingWrapper";
3 import { SectionNineteenImage } from "../../icons/icons";
4 import classNames from "classnames";
5
6 const SectionHeadingSave = ({ attributes }) => {
7 const {
8 uniqueId,
9 sectionHeadingLabel,
10 sectionHeadingLinkUrl,
11 sectionHeadingStyle,
12 showSectionHeading,
13 sectionHeadingHTMLTag: HeadingTag,
14 sectionHeadingStyleBackgroundColor,
15 showSubHeading,
16 sectionSubHeadingAliment,
17 subHeadingLabel,
18 additionalCssClass,
19 sectionHeadingGlobalTypo,
20 sectionSubHeadingGlobalTypography,
21 } = attributes;
22
23 const blockProps = useBlockProps.save();
24 const className = classNames("sp-section-heading-container", sectionHeadingStyle);
25 const renderSectionNineteenImage = sectionHeadingStyle === "section-heading-nineteen" && (
26 <SectionNineteenImage sectionHeadingStyleBackgroundColor={sectionHeadingStyleBackgroundColor} />
27 );
28
29 return (
30 <div {...blockProps}>
31 {showSectionHeading && (
32 <div
33 id={uniqueId}
34 className={classNames("sp-smart-post-wrapper", "sp-section-heading-wrapper", additionalCssClass)}
35 >
36 <HeadingWrapper sectionHeadingLinkUrl={sectionHeadingLinkUrl} classNames={className}>
37 <div className={"section-heading-tag"}>
38 {sectionHeadingStyle === "section-heading-twentyOne" ? (
39 <span>
40 <RichText.Content
41 tagName={HeadingTag}
42 className={classNames(
43 "sp-heading-text",
44 sectionHeadingGlobalTypo?.class ? sectionHeadingGlobalTypo.class : ""
45 )}
46 value={sectionHeadingLabel}
47 />
48 </span>
49 ) : (
50 <RichText.Content
51 tagName={HeadingTag}
52 className={classNames(
53 "sp-heading-text",
54 sectionHeadingGlobalTypo?.class ? sectionHeadingGlobalTypo.class : ""
55 )}
56 value={sectionHeadingLabel}
57 />
58 )}
59 {renderSectionNineteenImage}
60 </div>
61 </HeadingWrapper>
62 {showSubHeading && (
63 <div
64 className={classNames(
65 "sp-section-subheading-container",
66 "sp-d-flex",
67 "sp-justify-" + sectionSubHeadingAliment
68 )}
69 >
70 <RichText.Content
71 className={classNames(
72 "sp-subheading-text",
73 sectionSubHeadingGlobalTypography?.class
74 ? sectionSubHeadingGlobalTypography.class
75 : ""
76 )}
77 tagName="span"
78 value={subHeadingLabel}
79 />
80 </div>
81 )}
82 </div>
83 )}
84 </div>
85 );
86 };
87
88 export default SectionHeadingSave;
89