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

Core: Float context menu button on top of story titles in sidebar #30080

Merged
merged 5 commits into from
Dec 18, 2024

Conversation

ghengeveld
Copy link
Member

@ghengeveld ghengeveld commented Dec 16, 2024

Closes #29651

What I did

Renders story context menu buttons and status icons on top of the story/component/folder title to prevent the sidebar from reflowing on hover. Transparent backgrounds have been replaced with opaque colors to prevent the text from showing through. Buttons have a slight outer glow to make it look like a gradient.

Screenshot 2024-12-16 at 21 09 50 Screenshot 2024-12-16 at 21 09 35

Checklist for Contributors

Testing

The changes in this PR are covered in the following automated tests:

  • stories
  • unit tests
  • integration tests
  • end-to-end tests

Manual testing

This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!

Documentation

  • Add or update documentation reflecting your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

Checklist for Maintainers

  • When this PR is ready for testing, make sure to add ci:normal, ci:merged or ci:daily GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found in code/lib/cli-storybook/src/sandbox-templates.ts

  • Make sure this PR contains one of the labels below:

    Available labels
    • bug: Internal changes that fixes incorrect behavior.
    • maintenance: User-facing maintenance tasks.
    • dependencies: Upgrading (sometimes downgrading) dependencies.
    • build: Internal-facing build tooling & test updates. Will not show up in release changelog.
    • cleanup: Minor cleanup style change. Will not show up in release changelog.
    • documentation: Documentation only changes. Will not show up in release changelog.
    • feature request: Introducing a new feature.
    • BREAKING CHANGE: Changes that break compatibility in some way with current major version.
    • other: Changes that don't fit in the above categories.

🦋 Canary release

This PR does not have a canary release associated. You can request a canary release of this pull request by mentioning the @storybookjs/core team here.

core team members can create a canary release here or locally with gh workflow run --repo storybookjs/storybook canary-release-pr.yml --field pr=<PR_NUMBER>

name before after diff z %
createSize 0 B 0 B 0 B - -
generateSize 77.7 MB 77.7 MB 0 B 1.36 0%
initSize 136 MB 136 MB 3.85 kB 1.44 0%
diffSize 58.4 MB 58.4 MB 3.85 kB 1.19 0%
buildSize 7.24 MB 7.24 MB 3.99 kB 101.77 0.1%
buildSbAddonsSize 1.88 MB 1.88 MB 0 B - 0%
buildSbCommonSize 195 kB 195 kB 0 B - 0%
buildSbManagerSize 1.86 MB 1.87 MB 3.99 kB 95.61 0.2%
buildSbPreviewSize 0 B 0 B 0 B - -
buildStaticSize 0 B 0 B 0 B - -
buildPrebuildSize 3.93 MB 3.94 MB 3.99 kB 95.61 0.1%
buildPreviewSize 3.3 MB 3.3 MB 0 B -0.77 0%
testBuildSize 0 B 0 B 0 B - -
testBuildSbAddonsSize 0 B 0 B 0 B - -
testBuildSbCommonSize 0 B 0 B 0 B - -
testBuildSbManagerSize 0 B 0 B 0 B - -
testBuildSbPreviewSize 0 B 0 B 0 B - -
testBuildStaticSize 0 B 0 B 0 B - -
testBuildPrebuildSize 0 B 0 B 0 B - -
testBuildPreviewSize 0 B 0 B 0 B - -
name before after diff z %
createTime 7s 7.4s 421ms -0.86 5.6%
generateTime 21.6s 21.3s -314ms 0.51 -1.5%
initTime 15.4s 14.9s -436ms 0.42 -2.9%
buildTime 8.9s 9s 52ms -0.76 0.6%
testBuildTime 0ms 0ms 0ms - -
devPreviewResponsive 4.4s 4.8s 424ms -0.52 8.7%
devManagerResponsive 3.3s 3.6s 279ms -0.53 7.6%
devManagerHeaderVisible 592ms 533ms -59ms -1.12 -11.1%
devManagerIndexVisible 618ms 564ms -54ms -1.08 -9.6%
devStoryVisibleUncached 1.7s 1.8s 56ms 0.06 3%
devStoryVisible 617ms 565ms -52ms -1.1 -9.2%
devAutodocsVisible 511ms 561ms 50ms 0.06 8.9%
devMDXVisible 477ms 504ms 27ms -0.65 5.4%
buildManagerHeaderVisible 555ms 561ms 6ms -0.78 1.1%
buildManagerIndexVisible 631ms 643ms 12ms -0.82 1.9%
buildStoryVisible 513ms 528ms 15ms -0.71 2.8%
buildAutodocsVisible 432ms 422ms -10ms -0.82 -2.4%
buildMDXVisible 398ms 440ms 42ms -0.5 9.5%

Greptile Summary

Based on the provided information, I'll create a concise summary of the PR changes focused on improving the sidebar's context menu and status icon rendering:

Improves sidebar rendering by making context menu buttons and status icons float on top of story titles using absolute positioning, preventing layout reflow issues when hovering.

  • Modified Tree.tsx to use absolute positioning for menu buttons and handle overflow properly
  • Updated StatusButton.tsx to include opaque backgrounds and box shadows instead of transparent backgrounds
  • Added theme-specific color calculations for better visibility and contrast
  • Implemented media queries to handle desktop/mobile breakpoint differences
  • Fixed issue [Bug]: Showing/hiding the context menu can cause the whole sidebar to reflow #29651 where showing/hiding context menus caused sidebar reflow

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.

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

code/core/src/manager/components/sidebar/StatusButton.tsx Outdated Show resolved Hide resolved
code/core/src/manager/components/sidebar/StatusButton.tsx Outdated Show resolved Hide resolved
Copy link

nx-cloud bot commented Dec 16, 2024

☁️ Nx Cloud Report

CI is running/has finished running commands for commit eed0b8b. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this CI Pipeline Execution


✅ Successfully ran 1 target

Sent with 💌 from NxCloud.

@storybook-pr-benchmarking
Copy link

storybook-pr-benchmarking bot commented Dec 17, 2024

Package Benchmarks

Commit: eed0b8b, ran on 18 December 2024 at 10:16:26 UTC

No significant changes detected, all good. 👏

@ghengeveld
Copy link
Member Author

As discussed with MA, I've updated the status icons to never overlay the text but instead claim space for themselves. Only the context menu button should overlay the text because it's visible only on hover.

@ghengeveld ghengeveld merged commit abe4c88 into next Dec 18, 2024
58 checks passed
@ghengeveld ghengeveld deleted the floating-menu-button branch December 18, 2024 11:28
@github-actions github-actions bot mentioned this pull request Dec 18, 2024
6 tasks
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.

[Bug]: Showing/hiding the context menu can cause the whole sidebar to reflow
2 participants