Fix long error titles pushing buttons out of view
Summary: This diff fixes an issue where error messages that are to long pushed the buttons out of view, or the other rows too much down. Reviewed By: passy Differential Revision: D18083659 fbshipit-source-id: 54bdae682e6e756c9dad1a8cd247dd694ae0eef2
This commit is contained in:
committed by
Facebook Github Bot
parent
0ba190e3ac
commit
561d560e18
@@ -76,14 +76,8 @@ function ErrorTile({
|
|||||||
const [collapsed, setCollapsed] = useState(true);
|
const [collapsed, setCollapsed] = useState(true);
|
||||||
return (
|
return (
|
||||||
<ErrorRow>
|
<ErrorRow>
|
||||||
<FlexRow>
|
<FlexRow style={{flexDirection: 'row-reverse'}}>
|
||||||
<FlexColumn style={{flexGrow: 1}}>{error.message}</FlexColumn>
|
<ButtonSection>
|
||||||
{error.occurrences! > 1 && (
|
|
||||||
<ErrorCounter title="Nr of times this error occurred">
|
|
||||||
{error.occurrences}
|
|
||||||
</ErrorCounter>
|
|
||||||
)}
|
|
||||||
<FlexColumn style={{marginLeft: '8px'}}>
|
|
||||||
<ButtonGroup>
|
<ButtonGroup>
|
||||||
{(error.details || error.error) && (
|
{(error.details || error.error) && (
|
||||||
<Button onClick={() => setCollapsed(s => !s)}>
|
<Button onClick={() => setCollapsed(s => !s)}>
|
||||||
@@ -92,6 +86,20 @@ function ErrorTile({
|
|||||||
)}
|
)}
|
||||||
<Button onClick={onDismiss}>Dismiss</Button>
|
<Button onClick={onDismiss}>Dismiss</Button>
|
||||||
</ButtonGroup>
|
</ButtonGroup>
|
||||||
|
</ButtonSection>
|
||||||
|
{error.occurrences! > 1 && (
|
||||||
|
<ErrorCounter title="Nr of times this error occurred">
|
||||||
|
{error.occurrences}
|
||||||
|
</ErrorCounter>
|
||||||
|
)}
|
||||||
|
<FlexColumn
|
||||||
|
style={
|
||||||
|
collapsed
|
||||||
|
? {overflow: 'hidden', whiteSpace: 'nowrap', flexGrow: 1}
|
||||||
|
: {flexGrow: 1}
|
||||||
|
}
|
||||||
|
title={error.message}>
|
||||||
|
{error.message}
|
||||||
</FlexColumn>
|
</FlexColumn>
|
||||||
</FlexRow>
|
</FlexRow>
|
||||||
{!collapsed && (
|
{!collapsed && (
|
||||||
@@ -153,6 +161,12 @@ const ErrorRow = styled('div')({
|
|||||||
lineHeight: '28px',
|
lineHeight: '28px',
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const ButtonSection = styled(FlexColumn)({
|
||||||
|
marginLeft: '8px',
|
||||||
|
flexShrink: 0,
|
||||||
|
flexGrow: 0,
|
||||||
|
});
|
||||||
|
|
||||||
const ErrorCounter = styled(FlexColumn)({
|
const ErrorCounter = styled(FlexColumn)({
|
||||||
backgroundColor: colors.cherryDark3,
|
backgroundColor: colors.cherryDark3,
|
||||||
color: colors.cherry,
|
color: colors.cherry,
|
||||||
@@ -162,4 +176,7 @@ const ErrorCounter = styled(FlexColumn)({
|
|||||||
marginTop: 2,
|
marginTop: 2,
|
||||||
lineHeight: '24px',
|
lineHeight: '24px',
|
||||||
textAlign: 'center',
|
textAlign: 'center',
|
||||||
|
flexShrink: 0,
|
||||||
|
flexGrow: 0,
|
||||||
|
marginLeft: '8px',
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user