Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Styling changes #4019

Merged
merged 3 commits into from
Jul 31, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
Copy link
Member

@gabrieldutra gabrieldutra Jul 30, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A slight and cool detail when it's over the drag background 😁

}
}

.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