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: make survey spacing consistent between visualizations #28562

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lucasheriques
Copy link
Contributor

Problem

all components define space by themselves, which makes it harder to add new ones.

instead, move the spacing rule between each section to the parent component.

Changes

no functionality nor UI changes, it's just a code refactor

👉 Stay up-to-date with PostHog coding conventions for a smoother review.

Does this work well for both Cloud and self-hosted?

yes

How did you test this code?

checked if tests are still running as expected

@lucasheriques lucasheriques requested a review from a team February 11, 2025 19:15
@lucasheriques lucasheriques self-assigned this Feb 11, 2025
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

This PR refactors spacing management in the survey visualization components by moving spacing responsibilities from individual components to the parent container.

  • Added space-y-4 class to parent div in /frontend/src/scenes/surveys/SurveyView.tsx to handle consistent spacing between components
  • Removed individual margin classes (mb-4, mb-8) from visualization components in /frontend/src/scenes/surveys/surveyViewViz.tsx
  • Removed unnecessary nested fragments and added proper div wrappers for NPS score display
  • Simplified styling structure by centralizing spacing control without changing visual appearance

2 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile

frontend/src/scenes/surveys/SurveyView.tsx Show resolved Hide resolved
Comment on lines +477 to +483
<div className="space-y-4">
<Summary surveyUserStatsLoading={surveyUserStatsLoading} surveyUserStats={surveyUserStats} />
{survey.questions.map((question, i) => {
if (question.type === SurveyQuestionType.Rating) {
return (
<>
{question.scale === 10 && (
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high number of line changes is misleading here. I removed a fragment, so nesting shifted left, but the only change here is adding space-y-4 to the parent div

Copy link
Contributor

Size Change: 0 B

Total Size: 1.18 MB

ℹ️ View Unchanged
Filename Size
frontend/dist/toolbar.js 1.18 MB

compressed-size-action

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant