Skip to content
Snippets Groups Projects
Commit 4771218e authored by Eryk Mika's avatar Eryk Mika
Browse files

refactor: export default, removed console logs

parent a7ed0ea4
Branches
Tags
1 merge request!1Main
import {Button} from "@wordpress/components";
function AlignButtons(props) {
export default function AlignButtons ({label, onChange}) {
const {label, onChange} = props;
const handleChange = function (newAlignment) {
const handleChange = (newAlignment) => {
if (onChange) {
onChange(newAlignment);
}
......@@ -34,7 +33,3 @@ function AlignButtons(props) {
</div>
);
}
export default AlignButtons;
......@@ -2,8 +2,7 @@ import {__} from "@wordpress/i18n";
import {PanelBody} from "@wordpress/components";
import Placeholder from "./Placeholder";
function BlockPlaceholders(props) {
const {placeholders,children} = props;
export default function BlockPlaceholders({placeholders, children}) {
return (
<PanelBody title={__('Placeholders', 'flexible-invoices-core')}>
{children && <p className='fi-placeholders-list-description'>{children}</p>}
......@@ -15,7 +14,3 @@ function BlockPlaceholders(props) {
</PanelBody>
);
}
export default BlockPlaceholders;
function Placeholder(props) {
const {label, children} = props;
export default function Placeholder({label, children}) {
return (
<div>
<input type='text' disabled value={label}/>
......@@ -8,7 +7,3 @@ function Placeholder(props) {
</div>
);
}
export default Placeholder;
import {ColorPicker} from "@wordpress/components";
import {useState} from "react";
function ColorSelector(props) {
export default function ColorSelector({label, onChange, value, enableAlpha = true, returnFormat = 'rgb'}) {
const {label, onChange, value, enableAlpha = true, returnFormat = 'rgb'} = props;
const [isPopupActive, setIsPopupActive] = useState(false);
const handleColorChange = function (newColor) {
......@@ -57,7 +56,3 @@ function ColorSelector(props) {
</div>
);
}
export default ColorSelector;
import NumberWithUnit from "../NumberWithUnit/NumberWithUnit";
function DuoInput(props) {
const {label, onChange, values, layout = 'column'} = props;
export default function DuoInput({label, onChange, values, layout = 'column'}) {
const keys = Object.keys(values);
const valuesArray = Object.values(values);
......@@ -39,5 +36,3 @@ function DuoInput(props) {
</div>
);
}
export default DuoInput;
......@@ -16,7 +16,7 @@ import FontStyles from "../FontStyles/FontStyles";
import QuatroInput from "../QuatroInput/QuatroInput";
import BlockPlaceholders from "../BlockPlaceholders/BlockPlaceholders";
function FlexibleTable({attributes, setAttributes, placeholders, footer, additionalOptions }) {
export default function FlexibleTable({attributes, setAttributes, placeholders, footer, additionalOptions }) {
const {
headers,
rows,
......@@ -424,5 +424,3 @@ function FlexibleTable({attributes, setAttributes, placeholders, footer, additio
</>
);
}
export default FlexibleTable;
import {Button} from "@wordpress/components";
import {useState} from "react";
function FontStyles(props) {
const {label, onChange, values} = props;
export default function FontStyles({label, onChange, values} ) {
const [isItalic, setIsItalic] = useState(values.fontStyle === 'italic');
const [isBold, setIsBold] = useState(values.fontWeight === 'bold');
......@@ -15,7 +13,6 @@ function FontStyles(props) {
const textDecoration = isUnderline ? 'underline' : isLineThrough ? 'line-through' : 'none';
const handleChange = function (updatedValues) {
console.log([updatedValues, textDecoration]);
const newStyles = {
fontStyle: updatedValues.fontStyle || fontStyle,
fontWeight: updatedValues.fontWeight || fontWeight,
......@@ -25,7 +22,6 @@ function FontStyles(props) {
setIsBold( newStyles.fontWeight === 'bold');
setIsUnderline( newStyles.textDecoration.includes('underline'));
setIsLineThrough( newStyles.textDecoration.includes('line-through'));
console.log(newStyles);
if (onChange) {
onChange(newStyles);
......@@ -99,5 +95,3 @@ function FontStyles(props) {
</div>
);
}
export default FontStyles;
import {SelectControl, TextControl} from "@wordpress/components";
import {useState} from "react";
function NumberWithUnit(props) {
const {label, onChange, value, className} = props;
export default function NumberWithUnit({label, onChange, value, className}) {
const splitValues = function (fontSize) {
const match = fontSize.match(/^(\d+)([a-z%]+)$/i);
......@@ -63,7 +61,3 @@ function NumberWithUnit(props) {
</div>
);
}
export default NumberWithUnit;
import NumberWithUnit from "../NumberWithUnit/NumberWithUnit";
function QuatroInput(props) {
const {label, onChange, values, layout = 'cross'} = props;
export default function QuatroInput({label, onChange, values, layout = 'cross'}) {
const keys = Object.keys(values);
const valuesArray = Object.values(values);
......@@ -83,5 +80,3 @@ function QuatroInput(props) {
</div>
);
}
export default QuatroInput;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment