Skip to content

Commit c3f2d6f

Browse files
michellewzhangtrillville
authored andcommitted
ref(feedback): change position of tags expand/collapse button (#63355)
The original tags button was hard to see/discover, so let's change the color and also move it to a more obvious spot. https://github.com/getsentry/sentry/assets/56095982/d32ada91-0bfa-4b98-ad28-f73323757952
1 parent 5992b27 commit c3f2d6f

2 files changed

Lines changed: 40 additions & 34 deletions

File tree

static/app/components/feedback/feedbackItem/feedbackItem.tsx

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import {Fragment, useState} from 'react';
1+
import {Fragment} from 'react';
22
import styled from '@emotion/styled';
33

4-
import {Button} from 'sentry/components/button';
54
import ErrorBoundary from 'sentry/components/errorBoundary';
65
import CrashReportSection from 'sentry/components/feedback/feedbackItem/crashReportSection';
76
import FeedbackActivitySection from 'sentry/components/feedback/feedbackItem/feedbackActivitySection';
@@ -40,7 +39,6 @@ export default function FeedbackItem({feedbackItem, eventData, tags}: Props) {
4039
const crashReportId = eventData?.contexts?.feedback?.associated_event_id;
4140

4241
const {hasSentOneReplay} = useHaveSelectedProjectsSentAnyReplayEvents();
43-
const [isHidden, setIsHidden] = useState(true);
4442
const platformSupported = replayPlatforms.includes(feedbackItem.platform);
4543

4644
return (
@@ -95,16 +93,8 @@ export default function FeedbackItem({feedbackItem, eventData, tags}: Props) {
9593
</Section>
9694
)}
9795

98-
<Section
99-
icon={<IconTag size="xs" />}
100-
title={t('Tags')}
101-
contentRight={
102-
<Button borderless onClick={() => setIsHidden(!isHidden)}>
103-
{isHidden ? t('Expand Tags') : t('Collapse Tags')}
104-
</Button>
105-
}
106-
>
107-
{isHidden ? <TagsSection tags={tags} collapsed /> : <TagsSection tags={tags} />}
96+
<Section icon={<IconTag size="xs" />} title={t('Tags')}>
97+
<TagsSection tags={tags} />
10898
</Section>
10999

110100
<Section icon={<IconChat size="xs" />} title={t('Activity')}>
Lines changed: 37 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,52 @@
1+
import styled from '@emotion/styled';
2+
3+
import {Button} from 'sentry/components/button';
4+
import Collapsible from 'sentry/components/collapsible';
15
import {KeyValueTable, KeyValueTableRow} from 'sentry/components/keyValueTable';
26
import TextOverflow from 'sentry/components/textOverflow';
37
import {Tooltip} from 'sentry/components/tooltip';
8+
import {t} from 'sentry/locale';
49
import {space} from 'sentry/styles/space';
510

611
interface Props {
712
tags: Record<string, string>;
8-
collapsed?: boolean;
913
}
1014

11-
export default function TagsSection({tags, collapsed}: Props) {
15+
export default function TagsSection({tags}: Props) {
1216
const entries = Object.entries(tags);
1317

1418
return (
15-
<KeyValueTable
16-
noMargin
17-
style={
18-
collapsed
19-
? {maxHeight: '90px', overflow: 'hidden', marginBottom: `${space(1)}`}
20-
: undefined
21-
}
22-
>
23-
{entries.map(([key, value]) => (
24-
<KeyValueTableRow
25-
key={key}
26-
keyName={key}
27-
value={
28-
<Tooltip showOnlyOnOverflow title={value}>
29-
<TextOverflow>{value}</TextOverflow>
30-
</Tooltip>
31-
}
32-
/>
33-
))}
19+
<KeyValueTable noMargin>
20+
<Collapsible
21+
maxVisibleItems={3}
22+
collapseButton={({onCollapse}) => (
23+
<StyledButton priority="primary" size="xs" onClick={onCollapse}>
24+
{t('Collapse tags')}
25+
</StyledButton>
26+
)}
27+
expandButton={({onExpand}) => (
28+
<StyledButton priority="primary" size="xs" onClick={onExpand}>
29+
{t('See all tags')}
30+
</StyledButton>
31+
)}
32+
>
33+
{entries.map(([key, value]) => (
34+
<KeyValueTableRow
35+
key={key}
36+
keyName={key}
37+
value={
38+
<Tooltip showOnlyOnOverflow title={value}>
39+
<TextOverflow>{value}</TextOverflow>
40+
</Tooltip>
41+
}
42+
/>
43+
))}
44+
</Collapsible>
3445
</KeyValueTable>
3546
);
3647
}
48+
49+
const StyledButton = styled(Button)`
50+
margin-top: ${space(1)};
51+
width: 150px;
52+
`;

0 commit comments

Comments
 (0)