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

fix: LEAP-1708: improve styling for relation overlay #6875

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import { FF_DEV_3391, isFF } from "../../utils/feature-flags";
import { isDefined } from "../../utils/utilities";
import NodesConnector from "./NodesConnector";

import styles from "./RelationsOverlay.module.scss";

const ArrowMarker = ({ id, color }) => {
return (
<marker
Expand Down Expand Up @@ -110,8 +112,14 @@ const RelationItem = ({ id, startNode, endNode, direction, rootRef, highlight, d
return () => relation.destroy();
}, []);
if (start.width < 1 || start.height < 1 || end.width < 1 || end.height < 1) return null;

const itemStyles = [styles.relationItem];
if (highlight) {
itemStyles.push(styles._highlighted);
}

return (
<g opacity={dimm && !highlight ? 0.5 : 1} visibility={hideConnection ? "hidden" : "visible"}>
<g id={id} className={itemStyles.join(" ")} visibility={hideConnection ? "hidden" : "visible"}>
<RelationItemRect {...start} />
<RelationItemRect {...end} />
<RelationConnector
Expand Down Expand Up @@ -202,12 +210,26 @@ class RelationsOverlay extends PureComponent {
zIndex: 100,
};

const containerStyles = ["relations-overlay", styles.container];
if (hasHighlight) {
containerStyles.push(styles._highlighting);
}

return (
<AutoSizer onResize={this.onResize}>
{() => (
<svg className="relations-overlay" ref={this.rootNode} xmlns="http://www.w3.org/2000/svg" style={style}>
<svg
className={containerStyles.join(" ")}
ref={this.rootNode}
xmlns="http://www.w3.org/2000/svg"
style={style}
>
<title>{this.state.shouldRender ? "Arrow Marker" : ""}</title>
{this.state.shouldRender && this.renderRelations(relations, visible, hasHighlight, highlighted)}
{
// mowing a highlighted relation into the foreground
Copy link
Collaborator

Choose a reason for hiding this comment

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

*moving?

highlighted ? <use xlinkHref={`#${highlighted.id}`} /> : null
}
</svg>
)}
</AutoSizer>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.container {
.relationItem {
transition: opacity 300ms;
}

&._highlighting {
Copy link
Collaborator

Choose a reason for hiding this comment

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

why do you use underscore here?

& .relationItem {
opacity: 0.2;

&._highlighted {
opacity: 1;
}
}
}
}
Loading