Skip to content

Commit

Permalink
FIX Reorder text checkbox group and apply Reactstrap styles
Browse files Browse the repository at this point in the history
  • Loading branch information
raissanorth committed Nov 1, 2018
1 parent 784af9a commit a99225e
Show file tree
Hide file tree
Showing 8 changed files with 1,363 additions and 2 deletions.
2 changes: 1 addition & 1 deletion client/dist/js/bundle.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion client/dist/styles/bundle.css

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions client/src/boot/registerComponents.js
Expand Up @@ -12,6 +12,7 @@ import InlineEditForm from 'components/ElementEditor/InlineEditForm';
import AddElementPopover from 'components/ElementEditor/AddElementPopover';
import HoverBar from 'components/ElementEditor/HoverBar';
import DragPositionIndicator from 'components/ElementEditor/DragPositionIndicator';
import TextCheckboxGroupField from 'components/TextCheckboxGroupField/TextCheckboxGroupField';

export default () => {
Injector.component.registerMany({
Expand All @@ -28,5 +29,6 @@ export default () => {
AddElementPopover,
HoverBar,
DragPositionIndicator,
TextCheckboxGroupField,
});
};
@@ -0,0 +1,23 @@
import React from 'react';
import { InputGroup, InputGroupAddon, InputGroupText } from 'reactstrap';
import fieldHolder from 'components/FieldHolder/FieldHolder';

const TextCheckboxGroupField = () => {
const { children } = this.props;

const childrenWithProps = React.Children.toArray(
React.Children.map(children, child =>
React.cloneElement(child, { noHolder: true })
)
);
return (
<InputGroup className="text-checkout-group-field">
{childrenWithProps[0]}
<InputGroupAddon addonType="append">
<InputGroupText >{childrenWithProps[1]}</InputGroupText>
</InputGroupAddon>
</InputGroup>
);
};

export default fieldHolder(TextCheckboxGroupField);
@@ -0,0 +1,9 @@
// Temporarily overwriting the styles form the CheckboxField component
// since it cannot be removed easily
.text-checkout-group-field {
.form-check {
display: inline;
padding-left: 0;
margin-bottom: 0;
}
}
1 change: 1 addition & 0 deletions client/src/styles/bundle.scss
Expand Up @@ -22,3 +22,4 @@
@import "../components/ElementEditor/DragPositionIndicator";
@import "../components/ElementEditor/ElementEditor";
@import "../components/ElementEditor/ElementDragPreview";
@import "../components/TextCheckboxGroupField/TextCheckboxGroupField";
2 changes: 2 additions & 0 deletions src/Forms/TextCheckboxGroupField.php
Expand Up @@ -6,6 +6,8 @@

class TextCheckboxGroupField extends CompositeField
{
protected $schemaComponent = 'TextCheckboxGroupField';

/**
* Set the composite's title to that of the first child
*
Expand Down

0 comments on commit a99225e

Please sign in to comment.