Skip to content

Conversation

@pyaromchyk-stack
Copy link

@pyaromchyk-stack pyaromchyk-stack commented Dec 11, 2025

After blueprint's component modernization update DocGen's side bar started to look misaligned to the left, the dropdown items were pushed outside the container. This PR I adjusts the look of DocGen tags dropdown and adds stories with this component.

Ticket link

Before:
image
After:
image

Summary by CodeRabbit

  • Style

    • Updated sidebar styles: adjusted tag padding, collapsed section layout, and text formatting for improved spacing and consistent presentation.
    • Removed per-level left indentation in the tag tree to simplify visual hierarchy.
  • Documentation

    • Added interactive example stories showcasing the document generation sidebar and a modernized variant for preview and testing.

✏️ Tip: You can customize this high-level summary in your review settings.

@pyaromchyk-stack pyaromchyk-stack requested review from a team as code owners December 11, 2025 09:52
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 11, 2025

Walkthrough

Removes inline indentation from TagTree Accordion items, centralizes indentation and other presentation via updates to DocGenSidebar SCSS, and adds Storybook stories (with MSW handlers) demonstrating DocGenSidebar variants using mock data.

Changes

Cohort / File(s) Summary
Styles
src/elements/content-sidebar/DocGenSidebar/DocGenSidebar.scss
Adds global .bcs-DocGen-tagPath { padding-left: var(--space-1) }; within .bcs-DocGen-accordion * sets nested .bcs-DocGen-tagPath to padding-left: 0 and font-weight: bold; updates .bcs-DocGen-collapsible to remove top/right padding, add min-width: 0, width: 100%, and unset text-transform for descendants.
Component (inline style removal)
src/elements/content-sidebar/DocGenSidebar/TagTree.tsx
Removes paddingLeft inline styles from Accordion.Item instances so indentation is driven by CSS instead of per-level inline props.
Storybook
src/elements/content-sidebar/DocGenSidebar/stories/DocGenSidebar.stories.tsx
Adds Storybook module exporting meta, basic, and withModernizedBlueprint stories; defines default args, docGenSidebarProps with async getDocGenTags mock, feature-flag toggles, and MSW handler returning mock JSON for file requests.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Check visual indentation and font-weight across accordion states after CSS changes.
  • Verify removed inline styles don't affect other layout contexts.
  • Confirm Storybook stories' props and MSW handler payload match component expectations.

Possibly related PRs

Suggested labels

ready-to-merge

Suggested reviewers

  • jfox-box
  • tjuanitas
  • reneshen0328

Poem

🐇 I hopped through SCSS and found my way,

padding moved where styles now stay.
Stories told with mock delight,
the sidebar beams in Storybook light.

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: fixing the misaligned DocGen sidebar dropdown after blueprint modernization, addressing the specific styling issue mentioned in the PR description.
Description check ✅ Passed The PR description clearly explains the problem, includes before/after screenshots, references the Jira ticket, and explains the fix. However, it lacks technical details about what was changed in each file.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8c2c316 and 8a3e853.

📒 Files selected for processing (1)
  • src/elements/content-sidebar/DocGenSidebar/stories/DocGenSidebar.stories.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/elements/content-sidebar/DocGenSidebar/stories/DocGenSidebar.stories.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: lint_test_build
  • GitHub Check: Summary

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (3)
src/elements/content-sidebar/DocGenSidebar/DocGenSidebar.scss (2)

31-36: Quoted CSS values here are invalid and likely ignored

width: '100%', min-width: 'fit-content', height: '100%', and overflow: 'auto' 'auto' are not valid CSS value syntaxes and will be ignored by the browser. If this wrapper’s sizing/overflow still matters, consider normalizing to unquoted, valid values in a follow‑up:

-.bcs-TagsSection-accordion-wrapper {
-    width: '100%';
-    min-width: 'fit-content';
-    height: '100%';
-    overflow: 'auto' 'auto';
-}
+.bcs-TagsSection-accordion-wrapper {
+    width: 100%;
+    min-width: fit-content;
+    height: 100%;
+    overflow: auto;
+}

53-62: Consider text-transform: none instead of unset for reliability

Setting --accordion-min-width: 0 and width: 100% on .bcs-DocGen-collapsible is a good way to prevent Blueprint’s layout constraints from clipping the dropdown.

For the descendant rule:

.bcs-DocGen-collapsible {
    …
    * {
        text-transform: unset;
    }
}

text-transform is an inherited property; unset here effectively behaves like inherit, which may not override an uppercase style applied higher up. To reliably keep labels in their original case, consider:

-    * {
-        text-transform: unset;
-    }
+    * {
+        text-transform: none;
+    }

This ensures text is not force‑uppercase regardless of ancestor styles.

src/elements/content-sidebar/DocGenSidebar/stories/DocGenSidebar.stories.js (1)

24-55: Factor out shared docGenSidebarProps to remove duplication

basic and withModernizedBlueprint share identical docGenSidebarProps. To keep the stories easier to maintain if this shape changes, consider extracting a shared constant:

- export const basic = {
-     args: {
-         defaultView: 'docgen',
-         docGenSidebarProps: {
-             enabled: true,
-             isDocGenTemplate: true,
-             checkDocGenTemplate: () => {},
-             getDocGenTags: () =>
-                 Promise.resolve({
-                     pagination: {},
-                     data: mockDocGenTags,
-                 }),
-         },
-     },
- };
+const docGenSidebarProps = {
+    enabled: true,
+    isDocGenTemplate: true,
+    checkDocGenTemplate: () => {},
+    getDocGenTags: () =>
+        Promise.resolve({
+            pagination: {},
+            data: mockDocGenTags,
+        }),
+};
+
+export const basic = {
+    args: {
+        defaultView: 'docgen',
+        docGenSidebarProps,
+    },
+};
 
 export const withModernizedBlueprint = {
     args: {
         enableModernizedComponents: true,
         defaultView: 'docgen',
-        docGenSidebarProps: {
-            enabled: true,
-            isDocGenTemplate: true,
-            checkDocGenTemplate: () => {},
-            getDocGenTags: () =>
-                Promise.resolve({
-                    pagination: {},
-                    data: mockDocGenTags,
-                }),
-        },
+        docGenSidebarProps,
     },
 };

Functionally identical, but reduces the chance of the two stories drifting apart unintentionally.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5555899 and 31b68ea.

⛔ Files ignored due to path filters (1)
  • i18n/en-US.properties is excluded by !i18n/**
📒 Files selected for processing (3)
  • src/elements/content-sidebar/DocGenSidebar/DocGenSidebar.scss (2 hunks)
  • src/elements/content-sidebar/DocGenSidebar/TagTree.tsx (0 hunks)
  • src/elements/content-sidebar/DocGenSidebar/stories/DocGenSidebar.stories.js (1 hunks)
💤 Files with no reviewable changes (1)
  • src/elements/content-sidebar/DocGenSidebar/TagTree.tsx
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-06-17T13:30:02.172Z
Learnt from: rafalmaksymiuk
Repo: box/box-ui-elements PR: 4144
File: src/elements/content-sidebar/versions/VersionsList.js:24-33
Timestamp: 2025-06-17T13:30:02.172Z
Learning: In the box-ui-elements codebase, Flow components use .flow.js type definition files, not TypeScript .ts files. The InternalSidebarNavigation type is a union type where different variants may have different properties like versionId, and proper type safety is ensured through conditional checks in methods like getSelectedVersionId.

Applied to files:

  • src/elements/content-sidebar/DocGenSidebar/stories/DocGenSidebar.stories.js
📚 Learning: 2025-09-03T18:30:44.447Z
Learnt from: fpan225
Repo: box/box-ui-elements PR: 4239
File: src/elements/content-sidebar/SidebarPanels.js:0-0
Timestamp: 2025-09-03T18:30:44.447Z
Learning: In the CustomSidebarPanel type, the component field is required (React.ComponentType<any>), so runtime checks for component existence are unnecessary since Flow will catch missing components at compile time. User fpan225 prefers to rely on the type system rather than adding redundant runtime checks.

Applied to files:

  • src/elements/content-sidebar/DocGenSidebar/stories/DocGenSidebar.stories.js
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: lint_test_build
  • GitHub Check: Summary
🔇 Additional comments (3)
src/elements/content-sidebar/DocGenSidebar/DocGenSidebar.scss (1)

38-40: Tag path base padding looks consistent with overrides

Defining a base padding-left for .bcs-DocGen-tagPath and then zeroing it out within .bcs-DocGen-accordion for the dropdown context is a reasonable pattern and keeps indentation logic in CSS instead of inline styles.

src/elements/content-sidebar/DocGenSidebar/stories/DocGenSidebar.stories.js (2)

1-22: Imports and default story args look consistent with existing patterns

Using ContentSidebar as the component with defaultArgs wired to global.FEATURES, global.FILE_ID, and global.TOKEN matches how other stories in this repo typically bootstrap the sidebar. No issues from a Storybook/Flow perspective as long as those globals are defined in the Storybook environment.


57-70: MSW integration and default export are wired correctly

The default export (title, component, args) and the MSW handler that returns mockFileRequest.response for mockFileRequest.url form a solid baseline for exercising the DocGen sidebar in isolation. This should give you stable visual stories for both legacy and modernized Blueprint layouts.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/elements/content-sidebar/DocGenSidebar/DocGenSidebar.scss (1)

32-35: Pre-existing: Invalid quoted CSS values.

Lines 32-35 contain syntax errors with quoted CSS values ('100%', 'fit-content', 'auto' 'auto'). These should be unquoted. While not introduced by this PR, they could prevent proper styling.

Apply this diff to fix the syntax errors:

 .bcs-TagsSection-accordion-wrapper {
-    width: '100%';
-    min-width: 'fit-content';
-    height: '100%';
-    overflow: 'auto' 'auto';
+    width: 100%;
+    min-width: fit-content;
+    height: 100%;
+    overflow: auto;
 }

Would you like me to open a separate issue to track fixing these pre-existing errors?

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 31b68ea and 290f02c.

📒 Files selected for processing (3)
  • src/elements/content-sidebar/DocGenSidebar/DocGenSidebar.scss (2 hunks)
  • src/elements/content-sidebar/DocGenSidebar/TagTree.tsx (0 hunks)
  • src/elements/content-sidebar/DocGenSidebar/stories/DocGenSidebar.stories.js (1 hunks)
💤 Files with no reviewable changes (1)
  • src/elements/content-sidebar/DocGenSidebar/TagTree.tsx
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-06-17T13:30:02.172Z
Learnt from: rafalmaksymiuk
Repo: box/box-ui-elements PR: 4144
File: src/elements/content-sidebar/versions/VersionsList.js:24-33
Timestamp: 2025-06-17T13:30:02.172Z
Learning: In the box-ui-elements codebase, Flow components use .flow.js type definition files, not TypeScript .ts files. The InternalSidebarNavigation type is a union type where different variants may have different properties like versionId, and proper type safety is ensured through conditional checks in methods like getSelectedVersionId.

Applied to files:

  • src/elements/content-sidebar/DocGenSidebar/stories/DocGenSidebar.stories.js
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: lint_test_build
  • GitHub Check: Summary
🔇 Additional comments (4)
src/elements/content-sidebar/DocGenSidebar/DocGenSidebar.scss (2)

38-40: LGTM! Padding structure supports tag hierarchy.

The new global padding rule for .bcs-DocGen-tagPath works well with the existing override at line 48 that zeros out padding for nested tags within accordions. This creates the proper visual hierarchy.


54-61: LGTM! Changes address the overflow/alignment issues.

The combination of min-width: 0, width: 100%, and unsetting text-transform are appropriate fixes for the Blueprint modernization issues described in the PR:

  • min-width: 0 allows flex/grid children to shrink below their content size
  • width: 100% ensures the collapsible takes full available width
  • Unsetting text-transform removes unwanted inherited styling from Blueprint
src/elements/content-sidebar/DocGenSidebar/stories/DocGenSidebar.stories.js (2)

1-22: LGTM! Standard Storybook setup with appropriate configuration.

The imports and defaultArgs are well-structured. Using global variables for features, fileId, and token is appropriate for Storybook stories.


57-70: LGTM! MSW handler properly mocks the file request.

The Storybook configuration follows best practices with proper MSW setup for HTTP mocking. The handler correctly returns the mock file request response as JSON.

jfox-box
jfox-box previously approved these changes Dec 11, 2025
Copy link
Contributor

@jfox-box jfox-box left a comment

Choose a reason for hiding this comment

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

LGTM, one nit

Comment on lines +58 to +60
* {
text-transform: unset;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

which element(s) are we trying to target? we should avoid using a wildcard like this unless necessary

Copy link
Author

Choose a reason for hiding this comment

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

These dropdown headers ("about") and dropdown items ("item") all should be in the original formating
image

Copy link
Contributor

Choose a reason for hiding this comment

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

got it I see, your change makes sense then. but I also think that we'll need to fix Blueprint eventually because this seems like a weird behavior and has internalization issues

Copy link
Contributor

Choose a reason for hiding this comment

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

@pyaromchyk-stack could you open an issue for blueprint and let them know there's a concern with setting text-transform: uppercase?

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/elements/content-sidebar/DocGenSidebar/stories/DocGenSidebar.stories.tsx (1)

52-65: Simplify the meta typing using satisfies.

The current intersection type approach is heavier than necessary. Since your project uses TypeScript 5.2.2, use satisfies Meta<typeof ContentSidebar> instead, which will provide proper type inference and validation while keeping the code cleaner. This pattern is already used elsewhere in the codebase.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 290f02c and 8c2c316.

📒 Files selected for processing (1)
  • src/elements/content-sidebar/DocGenSidebar/stories/DocGenSidebar.stories.tsx (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-07-11T14:43:02.677Z
Learnt from: jpan-box
Repo: box/box-ui-elements PR: 4166
File: src/elements/content-sidebar/SidebarNav.js:126-126
Timestamp: 2025-07-11T14:43:02.677Z
Learning: In the box-ui-elements repository, there's a file-type-based pattern for internationalization: TypeScript files (.tsx) predominantly use the modern useIntl hook (41 vs 15 files), while JavaScript files (.js) predominantly use the legacy injectIntl HOC (64 vs 5 files). New TypeScript components should use useIntl, while existing JavaScript components typically continue using injectIntl for consistency.

Applied to files:

  • src/elements/content-sidebar/DocGenSidebar/stories/DocGenSidebar.stories.tsx
🧬 Code graph analysis (1)
src/elements/content-sidebar/DocGenSidebar/stories/DocGenSidebar.stories.tsx (1)
src/elements/content-sidebar/stories/ContentSidebar.stories.js (1)
  • defaultArgs (6-21)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: lint_test_build
  • GitHub Check: Summary
🔇 Additional comments (1)
src/elements/content-sidebar/DocGenSidebar/stories/DocGenSidebar.stories.tsx (1)

27-35: checkDocGenTemplate: noop is a solid mock choice (handles any-args signature).
This avoids brittle “wrong arity” mocks and keeps the story minimal.

Copy link
Contributor

@tjuanitas tjuanitas left a comment

Choose a reason for hiding this comment

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

lgtm

Comment on lines +58 to +60
* {
text-transform: unset;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

@pyaromchyk-stack could you open an issue for blueprint and let them know there's a concern with setting text-transform: uppercase?

Copy link
Contributor

Choose a reason for hiding this comment

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

I see quite of few blueprint overrides in this file. in general, we should avoid overriding blueprint because it can potentially lead to issues such as what caused this PR

Copy link
Author

Choose a reason for hiding this comment

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

Let blueprint team know about case issue

Since I am not authorized to merge tin this project, would you mind helping me with that?

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