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

fix(feedback): Improve spacing between feedback list items #58182

Merged
merged 2 commits into from
Oct 16, 2023
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
102 changes: 55 additions & 47 deletions static/app/components/feedback/list/feedbackListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function useIsSelectedFeedback({feedbackItem}: {feedbackItem: HydratedFeedbackIt
return feedbackId === feedbackItem.feedback_id;
}

const FeedbackListItem = forwardRef<HTMLAnchorElement, Props>(
const FeedbackListItem = forwardRef<HTMLDivElement, Props>(
({className, feedbackItem, isChecked, onChecked, style}: Props, ref) => {
const organization = useOrganization();
const {projects} = useProjects();
Expand All @@ -63,57 +63,64 @@ const FeedbackListItem = forwardRef<HTMLAnchorElement, Props>(
const slug = project?.slug;

return (
<Wrapper
ref={ref}
className={className}
style={style}
data-selected={isSelected}
to={() => {
const location = browserHistory.getCurrentLocation();
return {
pathname: normalizeUrl(`/organizations/${organization.slug}/feedback/`),
query: {
...location.query,
referrer: 'feedback_list_page',
feedbackSlug: `${project.slug}:${feedbackItem.feedback_id}`,
},
};
}}
onClick={() => {
trackAnalytics('feedback_list.details_link.click', {organization});
}}
>
<InteractionStateLayer />
<Flex column style={{gridArea: 'right'}}>
<Checkbox
checked={isChecked}
onChange={e => onChecked(e.target.checked)}
onClick={e => e.stopPropagation()}
/>
</Flex>
<strong style={{gridArea: 'user'}}>
<FeedbackItemUsername feedbackItem={feedbackItem} />
</strong>
<span style={{gridArea: 'time'}}>
<TimeSince date={feedbackItem.timestamp} />
</span>
<div style={{gridArea: 'message'}}>
<TextOverflow>{feedbackItem.message}</TextOverflow>
</div>
<Flex style={{gridArea: 'icons'}} gap={space(1)} align="center">
<Flex align="center" gap={space(0.5)}>
<ProjectAvatar project={project} size={12} /> {slug}
<CardSpacing className={className} style={style} ref={ref}>
<LinkedFeedbackCard
data-selected={isSelected}
to={() => {
const location = browserHistory.getCurrentLocation();
return {
pathname: normalizeUrl(`/organizations/${organization.slug}/feedback/`),
query: {
...location.query,
referrer: 'feedback_list_page',
feedbackSlug: `${project.slug}:${feedbackItem.feedback_id}`,
},
};
}}
onClick={() => {
trackAnalytics('feedback_list.details_link.click', {organization});
}}
>
<InteractionStateLayer />
<Flex column style={{gridArea: 'checkbox'}}>
<Checkbox
checked={isChecked}
onChange={e => onChecked(e.target.checked)}
onClick={e => e.stopPropagation()}
/>
</Flex>
{feedbackItem.replay_id ? <ReplayBadge /> : null}
</Flex>
</Wrapper>
<Flex column style={{gridArea: 'right'}}>
{''}
</Flex>
<strong style={{gridArea: 'user'}}>
<FeedbackItemUsername feedbackItem={feedbackItem} />
</strong>
<span style={{gridArea: 'time'}}>
<TimeSince date={feedbackItem.timestamp} />
</span>
<div style={{gridArea: 'message'}}>
<TextOverflow>{feedbackItem.message}</TextOverflow>
</div>
<Flex style={{gridArea: 'icons'}} gap={space(1)} align="center">
<Flex align="center" gap={space(0.5)}>
<ProjectAvatar project={project} size={12} /> {slug}
</Flex>
{feedbackItem.replay_id ? <ReplayBadge /> : null}
</Flex>
</LinkedFeedbackCard>
</CardSpacing>
);
}
);

const Wrapper = styled(Link)`
const CardSpacing = styled('div')`
padding: ${space(0.25)} ${space(0.5)};
`;

const LinkedFeedbackCard = styled(Link)`
position: relative;
border-radius: ${p => p.theme.borderRadius};
padding: ${space(1)} ${space(0.75)} ${space(1)} ${space(1)};
padding: ${space(1)} ${space(1.5)} ${space(1)} ${space(1.5)};

color: ${p => p.theme.textColor};
&:hover {
Expand All @@ -128,11 +135,12 @@ const Wrapper = styled(Link)`
grid-template-columns: max-content 1fr max-content;
grid-template-rows: max-content 1fr max-content;
grid-template-areas:
'right user time'
'checkbox user time'
'right message message'
'right icons icons';
gap: ${space(1)};
place-items: stretch;
align-items: center;
`;

export default FeedbackListItem;