Skip to content

feat(oc-docs): match playground method dropdown and url bar to Bruno app - #141

Merged
bijin-bruno merged 7 commits into
opencollection-dev:mainfrom
sundram-bruno:feat/oc-docs-playground-method-parity
Jul 23, 2026
Merged

feat(oc-docs): match playground method dropdown and url bar to Bruno app#141
bijin-bruno merged 7 commits into
opencollection-dev:mainfrom
sundram-bruno:feat/oc-docs-playground-method-parity

Conversation

@sundram-bruno

@sundram-bruno sundram-bruno commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

JIRA : BRU-3753

Summary

Brings the playground query bar's HTTP method control (the method dropdown and the url bar trigger) in line with the Bruno app for visual parity.

Changes

Method dropdown

  • Dropdown items now render as MethodBadge (bold, monospace, uppercase, method-coloured), matching the trigger badge, instead of plain coloured text.
  • Constrained the dropdown surface width to 110-150px (Bruno parity) and tightened item spacing (line-height: 1, padding, 1px margin) and surface padding.
  • Dropdown surface background now uses the app base background so it blends with the overall dark background instead of sitting on a lighter surface; border matches the query bar's --border-color.
  • Dropdown is left-aligned to the url box's left border with a 1px gap below it (via Tippy offset).

Url bar (method trigger)

  • Long methods are abbreviated in the trigger for tight spaces (DELETE -> DEL, OPTIONS -> OPT) through a new short prop on MethodBadge; the dropdown list keeps the full names.
  • Reduced the method trigger's left/right padding to match the docs url bar.

Implementation notes

  • MethodBadge gained an optional short prop that renders getShortMethod(...) while keeping the colour derived from the full method. Default behaviour (full, uppercased) is unchanged, so the sidebar, example cards and docs url bar are unaffected.
  • Dropdown-specific styling is scoped under a method-menu-dropdown class on the shared MenuDropdown surface, so other dropdowns are untouched.

Align the playground query bar's HTTP method control with the Bruno
app for visual parity:

- Method dropdown items now render as MethodBadge (bold, mono,
  uppercase, method-coloured) instead of plain text, matching the
  trigger badge.
- Constrain the method dropdown surface to 110-150px width, tighten
  item spacing (line-height, padding, margin) and surface padding.
- Match the dropdown surface background and border to the query bar
  (app base background and --border-color) so it blends in dark mode.
- Left-align the dropdown to the url box border with a 1px gap below
  it via Tippy offset.
- Abbreviate long methods in the url bar trigger (DELETE -> DEL,
  OPTIONS -> OPT) through a new MethodBadge `short` prop.
- Reduce the method trigger's left/right padding to match the docs
  url bar.
Comment thread packages/oc-docs/src/ui/MenuDropdown/StyledWrapper.ts
sundram-bruno and others added 5 commits July 22, 2026 19:24
…pdown

Address review: the method-menu-dropdown overrides lived in the shared
MenuDropdown StyledWrapper. Move them to QueryBar via an Emotion Global
so the query-bar-specific styling is owned by QueryBar. A Global is
used (rather than QueryBar's nested StyledWrapper) because the dropdown
surface is portaled to <body>, so a nested selector can't reach it.
…ound-method-parity

# Conflicts:
#	packages/oc-docs/src/components/Playground/Content/Views/PlaygroundView/QueryBar/QueryBar.tsx
#	packages/oc-docs/src/components/Playground/Content/Views/PlaygroundView/QueryBar/StyledWrapper.ts
The method-menu-dropdown item overrides tied the base .dropdown-item
selector (0,2,0) and lost on source order, so items fell back to the
shared padding. Qualify with .dropdown to win the cascade.
const resolvedMethod = method || 'GET';
return (
<StyledWrapper
className={['method-badge', className].filter(Boolean).join(' ')}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please use cx function from utils

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done in 86eaa82 - switched to cx('method-badge', className).

Comment on lines +17 to +22
expect(html).toContain('>DEL<');
expect(html).not.toContain('DELETE');
});

it('keeps short methods intact when short is set', () => {
expect(renderToStaticMarkup(<MethodBadge method="GET" short />)).toContain('>GET<');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please confirm these texts with text, and not from html

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done in 86eaa82 - the short-mode tests now assert the rendered text (markup stripped) via a badgeText helper, e.g. expect(badgeText(<MethodBadge method="DELETE" short />)).toBe('DEL'), instead of matching the HTML string.

- Use the cx util for className composition instead of a manual
  filter/join.
- Assert MethodBadge short-mode output by rendered text (strip markup)
  rather than matching the raw HTML string.

@vasharma05-bruno vasharma05-bruno left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM, thanks!

@bijin-bruno
bijin-bruno merged commit 8f98842 into opencollection-dev:main Jul 23, 2026
1 check passed
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.

4 participants