Skip to content

Commit

Permalink
Hide child status icon on SpanTreeOffset used in SpanDetailRow compon…
Browse files Browse the repository at this point in the history
…ent (#334)

* Hide child status icon on SpanTreeOffset used in SpanDetailRow component

Signed-off-by: Ruben Vargas <ruben.vp8510@gmail.com>

* Small tweak to flow type

Signed-off-by: Joe Farro <joef@uber.com>

* Rename showChildrenStatus attribute from SpanTreeOffset to showChildrenIcon

Signed-off-by: Ruben Vargas <ruben.vp8510@gmail.com>
  • Loading branch information
rubenvp8510 authored and tiffon committed Feb 23, 2019
1 parent c07c41d commit ca0454c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export default class SpanDetailRow extends React.PureComponent<SpanDetailRowProp
return (
<TimelineRow className="detail-row">
<TimelineRow.Cell width={columnDivision}>
<SpanTreeOffset span={span} />
<SpanTreeOffset span={span} showChildrenIcon={false} />
<span>
<span
className="detail-row-expanded-accent"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ describe('<SpanDetailRow>', () => {
});

it('renders the span tree offset', () => {
const spanTreeOffset = <SpanTreeOffset span={props.span} />;
const spanTreeOffset = <SpanTreeOffset span={props.span} showChildrenIcon={false} />;
expect(wrapper.contains(spanTreeOffset)).toBe(true);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ type SpanTreeOffsetPropsType = {
onClick: ?() => void,
removeHoverIndentGuideId: string => void,
span: Span,
showChildrenIcon: boolean,
};

export class UnconnectedSpanTreeOffset extends React.PureComponent<SpanTreeOffsetPropsType> {
Expand All @@ -46,6 +47,7 @@ export class UnconnectedSpanTreeOffset extends React.PureComponent<SpanTreeOffse
static defaultProps = {
childrenVisible: false,
onClick: null,
showChildrenIcon: true,
};

constructor(props: SpanTreeOffsetPropsType) {
Expand Down Expand Up @@ -105,10 +107,11 @@ export class UnconnectedSpanTreeOffset extends React.PureComponent<SpanTreeOffse
};

render() {
const { childrenVisible, onClick, span } = this.props;
const { showChildrenIcon, childrenVisible, onClick, span } = this.props;
const { hasChildren, spanID } = span;
const wrapperProps = hasChildren ? { onClick, role: 'switch', 'aria-checked': childrenVisible } : null;
const icon = hasChildren && (childrenVisible ? <IoIosArrowDown /> : <IoChevronRight />);
const icon =
showChildrenIcon && hasChildren && (childrenVisible ? <IoIosArrowDown /> : <IoChevronRight />);
return (
<span className={`SpanTreeOffset ${hasChildren ? 'is-parent' : ''}`} {...wrapperProps}>
{this.ancestorIds.map(ancestorId => (
Expand Down

0 comments on commit ca0454c

Please sign in to comment.