Skip to content

Conversation

@ryan953
Copy link
Member

@ryan953 ryan953 commented May 9, 2024

This updates the CSS theme, variable names and also how the css works.
The widget is better able to handle cases like:

  • short desktop window (scrolls form)
  • phone in portrait (full width if the screen is 600px or less)
  • phone in landscape (scrolls form)
  • when screenshots are in use, stick to screen edges

I also made it, I think, easier to position the button (aka trigger, aka actor) around the screen. You can override in css --page-margin: 16px to dictate the distance from the edge, and override --inset: auto 0 0 auto; to position the button in the different corners of the screen. For example, you can put the trigger button on the edge of the screen with something like:

#sentry-feedback {
  --actor-inset: auto 0 calc(50% - var(--header-height)) auto;
}

Docs are updated in getsentry/sentry-docs#9961 to reflect the changed config/variable names too.

Some samples of different situations:

Desc Img
Normal normal
Short Window short window
Screenshot editor screenshot
Mobile landscape mobile landscape
Mobile portrait mobile portrait
Override Color colors override

@ryan953 ryan953 requested a review from a team as a code owner May 9, 2024 13:31
@github-actions
Copy link
Contributor

github-actions bot commented May 9, 2024

size-limit report 📦

Path Size
@sentry/browser 21.65 KB (0%)
@sentry/browser (incl. Tracing) 32.68 KB (0%)
@sentry/browser (incl. Tracing, Replay) 68.02 KB (0%)
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 61.42 KB (0%)
@sentry/browser (incl. Tracing, Replay with Canvas) 72.06 KB (0%)
@sentry/browser (incl. Tracing, Replay, Feedback) 84.24 KB (+0.11% 🔺)
@sentry/browser (incl. Feedback) 37.76 KB (+0.27% 🔺)
@sentry/browser (incl. sendFeedback) 26.21 KB (0%)
@sentry/browser (incl. FeedbackAsync) 30.77 KB (+0.14% 🔺)
@sentry/react 24.33 KB (0%)
@sentry/react (incl. Tracing) 35.64 KB (0%)
@sentry/vue 25.48 KB (0%)
@sentry/vue (incl. Tracing) 34.47 KB (0%)
@sentry/svelte 21.78 KB (0%)
CDN Bundle 24.13 KB (0%)
CDN Bundle (incl. Tracing) 34.05 KB (0%)
CDN Bundle (incl. Tracing, Replay) 67.72 KB (0%)
CDN Bundle (incl. Tracing, Replay, Feedback) 72.86 KB (+0.05% 🔺)
CDN Bundle - uncompressed 70.99 KB (0%)
CDN Bundle (incl. Tracing) - uncompressed 101 KB (0%)
CDN Bundle (incl. Tracing, Replay) - uncompressed 210.61 KB (0%)
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 223.61 KB (+0.24% 🔺)
@sentry/nextjs (client) 34.87 KB (0%)
@sentry/sveltekit (client) 33.24 KB (0%)
@sentry/node 147.35 KB (+0.01% 🔺)

Comment on lines +33 to +35
--font-family: system-ui, 'Helvetica Neue', Arial, sans-serif;
--font-size: 14px;
--z-index: 100000;
Copy link
Member

Choose a reason for hiding this comment

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

Are we removing this as available customization options from constructor?

Copy link
Member Author

Choose a reason for hiding this comment

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

ya, it wasn't on docs.sentry.io, and font stuff wasn't possible to override. So i pulled it out, but it's easy to add back.

I think i'd like a general-theme section in there that's neither dark or light mode. In my testing i screwed up a couple times by setting something like themeLight: { foreground: 'red' } then rendering in dark mode i was confused why i couldn't see my color change. It wouldn't be great to have to specify font in both places, or only in one place and have it copied around imo.

So i was thinking, shorter term at least, we lean into css variables more in the docs, so that's the first stop for people. And that's where everything is available. https://github.com/getsentry/sentry-docs/pull/9961/files

@ryan953 ryan953 requested review from a team and billyvg May 9, 2024 17:31
@ryan953 ryan953 merged commit 6c3abe2 into develop May 9, 2024
@ryan953 ryan953 deleted the ryan953/ref-feedback-theme-vars branch May 9, 2024 18:39
@c298lee
Copy link
Contributor

c298lee commented May 9, 2024

we're missing the outline focus changes :(

andreiborza pushed a commit that referenced this pull request May 16, 2024
This updates the CSS theme, variable names and also how the css works.
The widget is better able to handle cases like:
- short desktop window (scrolls form)
- phone in portrait (full width if the screen is 600px or less)
- phone in landscape (scrolls form)
- when screenshots are in use, stick to screen edges

I also made it, I think, easier to position the button (aka trigger, aka
actor) around the screen. You can override in css `--page-margin: 16px`
to dictate the distance from the edge, and override `--inset: auto 0 0
auto;` to position the button in the different corners of the screen.
For example, you can put the trigger button on the edge of the screen
with something like:
```css
#sentry-feedback {
  --actor-inset: auto 0 calc(50% - var(--header-height)) auto;
}
```

Docs are updated in getsentry/sentry-docs#9961
to reflect the changed config/variable names too.

Some samples of different situations:
| Desc | Img |
| --- | --- |
| Normal |
![normal](https://github.com/getsentry/sentry-javascript/assets/187460/9223cf1f-9b4b-4bdc-b35a-65ccded71540)
| Short Window | ![short
window](https://github.com/getsentry/sentry-javascript/assets/187460/5749a07a-ccb6-4c3c-909e-712cf5172f11)
| Screenshot editor |
![screenshot](https://github.com/getsentry/sentry-javascript/assets/187460/3a3bbbd0-c982-4d23-b0cf-d6f96ad2a7d1)
| Mobile landscape | ![mobile
landscape](https://github.com/getsentry/sentry-javascript/assets/187460/aee7ca1f-c6a1-4555-9b07-0ff75aad93e2)
| Mobile portrait | ![mobile
portrait](https://github.com/getsentry/sentry-javascript/assets/187460/c7c08261-8343-4498-9084-5432c6f1c60e)
| Override Color | ![colors
override](https://github.com/getsentry/sentry-javascript/assets/187460/99d2ae92-58a0-49f0-982c-95b3e312a694)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants