Skip to content

Commit

Permalink
style: manual prettier run
Browse files Browse the repository at this point in the history
  • Loading branch information
bkrem committed Jan 16, 2020
1 parent 2a60cdf commit c148acf
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 26 deletions.
18 changes: 11 additions & 7 deletions src/Link/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ type LinkEventHandler = (source: NodeData, target: NodeData, evt: Event) => void

type LinkProps = {
linkData: {
source: NodeData,
target: NodeData
source: NodeData;
target: NodeData;
};
orientation: Orientation
orientation: Orientation;
pathFunc: ('diagonal' | 'elbow' | 'straight' | 'step') | ((...args: any[]) => any);
transitionDuration: number;
onClick: LinkEventHandler;
onMouseOver: LinkEventHandler
onMouseOut: LinkEventHandler
onMouseOver: LinkEventHandler;
onMouseOut: LinkEventHandler;
styles?: object;
};

Expand All @@ -26,7 +26,7 @@ type LinkState = {
export default class Link extends React.PureComponent<LinkProps, LinkState> {
static defaultProps = {
styles: {},
}
};

private link: SVGPathElement = null;

Expand All @@ -44,7 +44,11 @@ export default class Link extends React.PureComponent<LinkProps, LinkState> {
this.applyOpacity(0, this.props.transitionDuration, done);
}

applyOpacity(opacity: number, transitionDuration: LinkProps['transitionDuration'], done = () => {}) {
applyOpacity(
opacity: number,
transitionDuration: LinkProps['transitionDuration'],
done = () => {}
) {
if (transitionDuration === 0) {
select(this.link).style('opacity', opacity);
done();
Expand Down
27 changes: 18 additions & 9 deletions src/Node/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ import './style.css';
type NodeEventHandler = (id: string, evt: Event) => void;

type NodeProps = {
nodeData: NodeData
nodeData: NodeData;
nodeElement: {
shape: string,
baseProps: FIXME,
branchNodeProps: FIXME,
leafNodeProps: FIXME,
shape: string;
baseProps: FIXME;
branchNodeProps: FIXME;
leafNodeProps: FIXME;
};
nodeLabelProps: FIXME;
nodeLabelComponent?: FIXME;
nodeSize: {
x: number,
y: number
x: number;
y: number;
};
orientation: Orientation;
transitionDuration: number;
Expand Down Expand Up @@ -81,7 +81,11 @@ export default class Node extends React.Component<NodeProps, NodeState> {
nextProps.nodeData.y !== ownProps.nodeData.y ||
nextProps.orientation !== ownProps.orientation;

setTransform(nodeData: NodeProps['nodeData'], orientation: NodeProps['orientation'], shouldTranslateToOrigin = false) {
setTransform(
nodeData: NodeProps['nodeData'],
orientation: NodeProps['orientation'],
shouldTranslateToOrigin = false
) {
const { x, y, parent } = nodeData;
if (shouldTranslateToOrigin) {
const hasParent = typeof parent === 'object';
Expand All @@ -94,7 +98,12 @@ export default class Node extends React.Component<NodeProps, NodeState> {
return orientation === 'horizontal' ? `translate(${y},${x})` : `translate(${x},${y})`;
}

applyTransform(transform: string, transitionDuration: NodeProps['transitionDuration'], opacity = 1, done = () => {}) {
applyTransform(
transform: string,
transitionDuration: NodeProps['transitionDuration'],
opacity = 1,
done = () => {}
) {
if (transitionDuration === 0) {
select(this.nodeRef)
.attr('transform', transform)
Expand Down
20 changes: 10 additions & 10 deletions src/types/common.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
export type FIXME = any
export type FIXME = any;

export type Orientation = 'horizontal' | 'vertical';

export type NodeData = {
id: string,
x: number,
y: number,
name: string
attributes: Record<string, FIXME>
parent?: NodeData,
_children?: FIXME,
_collapsed: boolean
}
id: string;
x: number;
y: number;
name: string;
attributes: Record<string, FIXME>;
parent?: NodeData;
_children?: FIXME;
_collapsed: boolean;
};

0 comments on commit c148acf

Please sign in to comment.