Skip to content

fix(ui): Fix tag distribution meter styles #13666

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

Merged
merged 1 commit into from
Jun 13, 2019
Merged
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 @@ -51,7 +51,7 @@ export default class TagDistributionMeter extends React.Component {
}

return (
<React.Fragment>
<Segments>
{segments.map((value, index) => {
const pct = percent(value.count, totalValues);
const pctLabel = Math.floor(pct);
Expand All @@ -64,24 +64,23 @@ export default class TagDistributionMeter extends React.Component {
);

return (
<Tooltip key={value.value} title={tooltipHtml} containerDisplayMode="inline">
<Segment
style={{width: pct + '%'}}
to={value.isOther ? null : value.url}
index={index}
first={index === 0}
last={index === segments.length - 1}
isOther={!!value.isOther}
>
<Description first={index === 0}>
<Percentage>{pctLabel}%</Percentage>
<Label>{value.name}</Label>
</Description>
</Segment>
</Tooltip>
<div key={value.value} style={{width: pct + '%'}}>
<Tooltip title={tooltipHtml} containerDisplayMode="block">
<Segment
to={value.isOther ? null : value.url}
index={index}
isOther={!!value.isOther}
>
<Description first={index === 0}>
<Percentage>{pctLabel}%</Percentage>
<Label>{value.name}</Label>
</Description>
</Segment>
</Tooltip>
</div>
);
})}
</React.Fragment>
</Segments>
);
}

Expand Down Expand Up @@ -150,21 +149,22 @@ const colors = [
'#dad9ed',
];

const Segments = styled('div')`
display: flex;
border-radius: ${p => p.theme.borderRadius};
overflow: hidden;
`;

const Segment = styled(Link, {shouldForwardProp: isPropValid})`
display: block;
width: 100%;
height: 16px;
display: inline-block;
color: inherit;

&:hover {
background: ${p => p.theme.purple};
}

border-top-left-radius: ${p => p.first && p.theme.borderRadius};
border-bottom-left-radius: ${p => p.first && p.theme.borderRadius};

border-top-right-radius: ${p => p.last && p.theme.borderRadius};
border-bottom-right-radius: ${p => p.last && p.theme.borderRadius};

background-color: ${p => (p.isOther ? colors[colors.length - 1] : colors[p.index])};
`;

Expand All @@ -187,12 +187,10 @@ const Description = styled('span', {shouldForwardProp: isPropValid})`
const Percentage = styled('span')`
margin-right: 6px;
color: ${p => p.theme.gray2};
display: inline-block;
vertical-align: middle;
`;

const Label = styled('span')`
display: inline-block;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
Expand Down