| 1 |
import { PanelBody, TabPanel, TextControl } from "@wordpress/components"; |
| 2 |
import { InspectorControls } from '@wordpress/block-editor'; |
| 3 |
import objAttributes from './attributes'; |
| 4 |
import { __ } from "@wordpress/i18n"; |
| 5 |
import { typoPrefix_author, typoPrefix_updated_time } from "./typographyPrefixConstants"; |
| 6 |
import ColorControl from "../../../util/color-control"; |
| 7 |
import TypographyDropdown from "../../../util/typography-control-v2"; |
| 8 |
import ResponsiveRangeController from "../../../util/responsive-range-control"; |
| 9 |
import ResponsiveDimensionsControl from "../../../util/dimensions-control-v2"; |
| 10 |
import BorderShadowControl from "../../../util/border-shadow-control"; |
| 11 |
import BackgroundControl from "../../../util/background-control"; |
| 12 |
import { AUTHOR_BOX_BACKGROUND, AUTHOR_BOX_BORDER, AUTHOR_BOX_SIZE, AUTHOR_BOX_WRAPPER_MARGIN, AUTHOR_BOX_WRAPPER_PADDING } from "./constants"; |
| 13 |
|
| 14 |
const Inspector = ({attributes, setAttributes}) => { |
| 15 |
const { resOption, docAuthorColor, updatedTimeColor } = attributes; |
| 16 |
const resRequiredProps = { |
| 17 |
setAttributes, |
| 18 |
resOption, |
| 19 |
attributes, |
| 20 |
objAttributes |
| 21 |
}; |
| 22 |
|
| 23 |
return ( |
| 24 |
<InspectorControls key="controls"> |
| 25 |
<div className="eb-panel-control"> |
| 26 |
<TabPanel className="eb-parent-tab-panel" activeClass="active-tab" tabs={[ |
| 27 |
{ |
| 28 |
name:"styles", |
| 29 |
title:__("Styles", "betterdocs"), |
| 30 |
className:"eb-tab styles" |
| 31 |
} |
| 32 |
]}> |
| 33 |
{ |
| 34 |
(tab) => { |
| 35 |
return ( |
| 36 |
<div className={"eb-tab-controls " + tab.name}> |
| 37 |
{tab.name === "styles" && ( |
| 38 |
<> |
| 39 |
<PanelBody title={__("Author Box", "betterdocs")}> |
| 40 |
<BackgroundControl |
| 41 |
controlName={ |
| 42 |
AUTHOR_BOX_BACKGROUND |
| 43 |
} |
| 44 |
resRequiredProps={resRequiredProps} |
| 45 |
noOverlay={true} |
| 46 |
/> |
| 47 |
<ResponsiveDimensionsControl |
| 48 |
baseLabel={__("Padding", "betterdocs")} |
| 49 |
resRequiredProps={resRequiredProps} |
| 50 |
controlName={AUTHOR_BOX_WRAPPER_PADDING} |
| 51 |
/> |
| 52 |
<ResponsiveDimensionsControl |
| 53 |
baseLabel={__("Margin", "betterdocs")} |
| 54 |
resRequiredProps={resRequiredProps} |
| 55 |
controlName={AUTHOR_BOX_WRAPPER_MARGIN} |
| 56 |
/> |
| 57 |
<BorderShadowControl |
| 58 |
controlName={AUTHOR_BOX_BORDER} |
| 59 |
noShadow={true} |
| 60 |
resRequiredProps={resRequiredProps} |
| 61 |
/> |
| 62 |
<ResponsiveRangeController |
| 63 |
baseLabel={__("Size", "betterdocs")} |
| 64 |
controlName={AUTHOR_BOX_SIZE} |
| 65 |
resRequiredProps={resRequiredProps} |
| 66 |
min={1} |
| 67 |
max={100} |
| 68 |
step={1} |
| 69 |
/> |
| 70 |
<ColorControl |
| 71 |
label={__("Color", "betterdocs")} |
| 72 |
color={docAuthorColor} |
| 73 |
onChange={(docAuthorColor) => setAttributes({ docAuthorColor })} |
| 74 |
/> |
| 75 |
<TypographyDropdown |
| 76 |
baseLabel={__("Typography", "betterdocs")} |
| 77 |
typographyPrefixConstant={typoPrefix_author} |
| 78 |
resRequiredProps={resRequiredProps} |
| 79 |
defaultFontSize={16} |
| 80 |
/> |
| 81 |
</PanelBody> |
| 82 |
<PanelBody title={__("Updated Time", "betterdocs")}> |
| 83 |
<ColorControl |
| 84 |
label={__("Color", "betterdocs")} |
| 85 |
color={updatedTimeColor} |
| 86 |
onChange={(updatedTimeColor) => setAttributes({ updatedTimeColor })} |
| 87 |
/> |
| 88 |
<TypographyDropdown |
| 89 |
baseLabel={__("Typography", "betterdocs")} |
| 90 |
typographyPrefixConstant={typoPrefix_updated_time} |
| 91 |
resRequiredProps={resRequiredProps} |
| 92 |
defaultFontSize={16} |
| 93 |
/> |
| 94 |
</PanelBody> |
| 95 |
</> |
| 96 |
)} |
| 97 |
</div> |
| 98 |
) |
| 99 |
} |
| 100 |
} |
| 101 |
</TabPanel> |
| 102 |
</div> |
| 103 |
</InspectorControls> |
| 104 |
); |
| 105 |
} |
| 106 |
|
| 107 |
export default Inspector; |
| 108 |
|