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

Hide child status icon on SpanTreeOffset used in SpanDetailRow component #334

Merged
merged 3 commits into from
Feb 23, 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
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