PluginProbe
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot / 4.9.5
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot v4.9.5
4.9.5 4.9.4 4.9.3 4.9.2 4.9.1 4.9.0 4.8.2 4.8.1 4.8.0 4.7.0 4.6.2 4.6.1 4.6.0 4.5.6 4.5.5 4.5.4 4.5.3 4.5.2 4.5.1 4.5.0 4.4.1 4.4.0 3.3.4 3.4.0 3.4.1 All 203 releases
betterdocs / react-src / gutenberg / blocks / article-summary / src / inspector.js

inspector.js in BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot 4.9.5, at react-src/gutenberg/blocks/article-summary/src/inspector.js

237 lines 11.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { __ } from '@wordpress/i18n';
2 import { InspectorControls } from '@wordpress/block-editor';
3 import { BaseControl, ButtonGroup, Button, PanelBody, TabPanel, TextControl, ToggleControl, RangeControl } from '@wordpress/components';
4
5 import {
6 typoPrefix_title,
7 typoPrefix_content,
8 typoPrefix_loading
9 } from "./typographyPrefixConstants";
10
11 import {
12 ARTICLE_SUMMARY_TITLE_MARGIN,
13 ARTICLE_SUMMARY_TITLE_PADDING,
14 ARTICLE_SUMMARY_CONTENT_MARGIN,
15 ARTICLE_SUMMARY_CONTENT_PADDING,
16 ARTICLE_SUMMARY_BOX_MARGIN,
17 ARTICLE_SUMMARY_BOX_PADDING,
18 ARTICLE_SUMMARY_TEXT_ALIGN
19 } from './constants';
20
21 import ResponsiveDimensionsControl from "../../../util/dimensions-control-v2";
22 import ColorControl from "../../../util/color-control";
23 import TypographyDropdown from "../../../util/typography-control-v2";
24 import objAttributes from './attributes';
25
26 const Inspector = ({attributes, setAttributes}) => {
27 const {
28 customTitle,
29 showTitle,
30 titleColor,
31 titleBGColor,
32 contentColor,
33 loadingColor,
34 iconColor,
35 backgroundColor,
36 borderColor,
37 borderWidth,
38 borderRadius,
39 iconSize,
40 resOption
41 } = attributes;
42
43 const resRequiredProps = {
44 setAttributes,
45 resOption,
46 attributes,
47 objAttributes,
48 };
49
50 return(
51 <InspectorControls key="controls">
52 <div className="eb-panel-control">
53 <TabPanel
54 className="eb-parent-tab-panel"
55 activeClass="active-tab"
56 tabs={[
57 {
58 name:"general",
59 title:__("General", "betterdocs"),
60 className: "eb-tab general"
61 },
62 {
63 name: "styles",
64 title: __("Styles", "betterdocs"),
65 className: "eb-tab styles",
66 }
67 ]}
68 >
69 {
70 (tab) => {
71 return(
72 <div className={"eb-tab-controls " + tab.name}>
73 {tab.name == 'general' &&
74 <PanelBody title={__("Content Settings", "betterdocs")} initialOpen={true}>
75 <TextControl
76 label={__("Custom Title", "betterdocs")}
77 value={customTitle}
78 onChange={(value) => setAttributes({ customTitle: value })}
79 placeholder={__("Doc Summary", "betterdocs")}
80 help={__("Leave empty to use default title", "betterdocs")}
81 />
82 <ToggleControl
83 label={__("Show Title", "betterdocs")}
84 checked={showTitle}
85 onChange={(value) => setAttributes({ showTitle: value })}
86 />
87 </PanelBody>}
88 {tab.name === 'styles' && (
89 <>
90 <PanelBody title={__("Title Style", "betterdocs")} initialOpen={false}>
91 <TypographyDropdown
92 baseLabel={__("Typography", "betterdocs")}
93 typographyPrefixConstant={typoPrefix_title}
94 resRequiredProps={resRequiredProps}
95 defaultFontSize={16}
96 />
97
98 <ColorControl
99 label={__("Background Color", "betterdocs")}
100 color={titleBGColor}
101 onChange={(colorValue) => {
102 setAttributes({titleBGColor: colorValue})
103 }}
104 />
105
106 <ColorControl
107 label={__("Color", "betterdocs")}
108 color={titleColor}
109 onChange={(colorValue) => {
110 setAttributes({titleColor: colorValue})
111 }}
112 />
113
114 <ResponsiveDimensionsControl
115 baseLabel={__("Margin", "betterdocs")}
116 resRequiredProps={resRequiredProps}
117 controlName={ARTICLE_SUMMARY_TITLE_MARGIN}
118 />
119 <ResponsiveDimensionsControl
120 baseLabel={__("Padding", "betterdocs")}
121 resRequiredProps={resRequiredProps}
122 controlName={ARTICLE_SUMMARY_TITLE_PADDING}
123 />
124 </PanelBody>
125
126 <PanelBody title={__("Content Style", "betterdocs")} initialOpen={false}>
127 <TypographyDropdown
128 baseLabel={__("Typography", "betterdocs")}
129 typographyPrefixConstant={typoPrefix_content}
130 resRequiredProps={resRequiredProps}
131 defaultFontSize={14}
132 />
133
134 <ColorControl
135 label={__("Text Color", "betterdocs")}
136 color={contentColor}
137 onChange={(colorValue) => {
138 setAttributes({contentColor: colorValue})
139 }}
140 />
141
142 <ColorControl
143 label={__("Loading Text Color", "betterdocs")}
144 color={loadingColor}
145 onChange={(colorValue) => {
146 setAttributes({loadingColor: colorValue})
147 }}
148 />
149
150 <ResponsiveDimensionsControl
151 baseLabel={__("Margin", "betterdocs")}
152 resRequiredProps={resRequiredProps}
153 controlName={ARTICLE_SUMMARY_CONTENT_MARGIN}
154 />
155 <ResponsiveDimensionsControl
156 baseLabel={__("Padding", "betterdocs")}
157 resRequiredProps={resRequiredProps}
158 controlName={ARTICLE_SUMMARY_CONTENT_PADDING}
159 />
160 </PanelBody>
161
162 <PanelBody title={__("Icon Style", "betterdocs")} initialOpen={false}>
163 <ColorControl
164 label={__("Arrow Color", "betterdocs")}
165 color={iconColor}
166 onChange={(colorValue) => {
167 setAttributes({iconColor: colorValue})
168 }}
169 />
170
171 <RangeControl
172 label={__("Arrow Size", "betterdocs")}
173 value={iconSize}
174 onChange={(value) => setAttributes({ iconSize: value })}
175 min={8}
176 max={24}
177 />
178 </PanelBody>
179
180 <PanelBody title={__("Box Style", "betterdocs")} initialOpen={false}>
181 <ColorControl
182 label={__("Background Color", "betterdocs")}
183 color={backgroundColor}
184 onChange={(colorValue) => {
185 setAttributes({backgroundColor: colorValue})
186 }}
187 />
188
189 <ColorControl
190 label={__("Border Color", "betterdocs")}
191 color={borderColor}
192 onChange={(colorValue) => {
193 setAttributes({borderColor: colorValue})
194 }}
195 />
196
197 <RangeControl
198 label={__("Border Width", "betterdocs")}
199 value={borderWidth}
200 onChange={(value) => setAttributes({ borderWidth: value })}
201 min={0}
202 max={10}
203 />
204
205 <RangeControl
206 label={__("Border Radius", "betterdocs")}
207 value={borderRadius}
208 onChange={(value) => setAttributes({ borderRadius: value })}
209 min={0}
210 max={50}
211 />
212
213 <ResponsiveDimensionsControl
214 baseLabel={__("Margin", "betterdocs")}
215 resRequiredProps={resRequiredProps}
216 controlName={ARTICLE_SUMMARY_BOX_MARGIN}
217 />
218 <ResponsiveDimensionsControl
219 baseLabel={__("Padding", "betterdocs")}
220 resRequiredProps={resRequiredProps}
221 controlName={ARTICLE_SUMMARY_BOX_PADDING}
222 />
223 </PanelBody>
224 </>
225 )}
226 </div>
227 )
228 }
229 }
230 </TabPanel>
231 </div>
232 </InspectorControls>
233 );
234 }
235
236 export default Inspector;
237