PluginProbe
Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News / 4.0.3
Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News v4.0.3
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 / components / buttonSet / buttonSet.js

buttonSet.js in Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News 4.0.3, at src/components/buttonSet/buttonSet.js

38 lines 1.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import "./editor.scss";
2
3 const ButtonSet = ({ label = "", attributes, attributesKey, setAttributes, columns = 4, items, onChange = false }) => {
4 const handleClick = (value) => {
5 if (value === attributes) {
6 return;
7 }
8 if (onChange) {
9 onChange(value);
10 } else {
11 setAttributes({ [attributesKey]: value });
12 }
13 };
14 return (
15 <div className="sp-smart-post-button-set sp-smart-post-component-mb">
16 {label && (
17 <div className="sp-smart-post-component-top sp-smart-post-component-title">
18 <span>{label}</span>
19 </div>
20 )}
21 <div className={`sp-smart-post-button-set-list sp-col-${columns}`}>
22 {items?.map((item, index) => (
23 <span
24 key={index}
25 className={`sp-smart-post-button-set-item${attributes === item.value ? " active" : ""}`}
26 value={item.value}
27 onClick={() => handleClick(item.value)}
28 >
29 <span className="sp-item-set-btn">{item.label}</span>
30 {item.tooltip && <p>{item.tooltip}</p>}
31 </span>
32 ))}
33 </div>
34 </div>
35 );
36 };
37 export default ButtonSet;
38