Skip to content

Commit

Permalink
Styling changes (#4019)
Browse files Browse the repository at this point in the history
  • Loading branch information
ranbena authored Jul 31, 2019
1 parent 2082493 commit 0c0bf6e
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 10 deletions.
20 changes: 16 additions & 4 deletions client/app/components/Parameters.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export class Parameters extends React.Component {
constructor(props) {
super(props);
const { parameters } = props;
this.state = { parameters };
this.state = { parameters, dragging: false };
if (!props.disableUrlUpdate) {
updateUrl(parameters);
}
Expand Down Expand Up @@ -99,6 +99,11 @@ export class Parameters extends React.Component {
return { parameters };
});
}
this.setState({ dragging: false });
};

onBeforeSortStart = () => {
this.setState({ dragging: true });
};

applyChanges = () => {
Expand Down Expand Up @@ -161,12 +166,19 @@ export class Parameters extends React.Component {
}

render() {
const { parameters } = this.state;
const { parameters, dragging } = this.state;
const { editable } = this.props;
const dirtyParamCount = size(filter(parameters, 'hasPendingValue'));
return (
<SortableContainer axis="xy" onSortEnd={this.moveParameter} lockToContainerEdges useDragHandle>
<div className="parameter-container" onKeyDown={this.handleKeyDown}>
<SortableContainer
axis="xy"
useDragHandle
lockToContainerEdges
helperClass="parameter-dragged"
updateBeforeSortStart={this.onBeforeSortStart}
onSortEnd={this.moveParameter}
>
<div className="parameter-container" onKeyDown={this.handleKeyDown} data-draggable={editable || null} data-dragging={dragging || null}>
{parameters.map((param, index) => (
<SortableItem className="parameter-block" key={param.name} index={index} parameterName={param.name} disabled={!editable}>
{this.renderParameter(param, index)}
Expand Down
32 changes: 26 additions & 6 deletions client/app/components/Parameters.less
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,49 @@
background-size: 2px 2px;
display: inline-block;
width: 6px;
height: 34px;
height: 36px;
vertical-align: bottom;
margin-right: 5px;
margin-bottom: 2px;
cursor: move;
}

.parameter-block {
display: inline-block;
background: white;
padding: 6px;
padding: 3px 6px 6px;

.parameter-container[data-draggable] & {
margin: 4px 0 0 4px;
}

&.parameter-dragged {
box-shadow: 0 4px 9px -3px rgba(102, 136, 153, 0.15);
}
}

.parameter-heading {
display: flex;
align-items: center;
padding-bottom: 4px;

label {
margin-bottom: 1px;
}
}

.parameter-container {
position: relative;
background-color: #f6f8f9;
display: inline;
padding: 35px 0 11px;

&[data-draggable] {
padding: 0 4px 4px 0;
transition: background-color 200ms ease-out;
transition-delay: 300ms; // short pause before returning to original bgcolor
}

&[data-dragging] {
transition-delay: 0s;
background-color: #f6f8f9;
}

.parameter-apply-button {
display: none; // default for mobile
Expand Down

0 comments on commit 0c0bf6e

Please sign in to comment.