Skip to content

Conversation

@alexluong
Copy link
Collaborator

Sidebar Refactor

Problem

Previously, ConfigurationModal and FilterSyntaxModal each created their own portal with id="sidebar". When both were open simultaneously, they would overlap and render unreadable content.

CleanShot 2025-12-16 at 21 48 39

Solution

Introduced a shared Sidebar context that manages a single sidebar instance. Only one sidebar can be visible at a time - opening a new one replaces any existing sidebar.

API

import { useSidebar } from "../Sidebar/Sidebar";

const sidebar = useSidebar();

// Toggle - opens if closed, closes if same ID is already open
sidebar.toggle("filter-syntax", <FilterSyntaxGuide />);

// Always opens (replaces current sidebar if different ID)
sidebar.open("filter-syntax", <FilterSyntaxGuide />);

// Closes only if that ID is currently open
sidebar.close("filter-syntax");

Usage Example

const MyComponent = () => {
  const sidebar = useSidebar();

  return (
    <Button
      onClick={() =>
        sidebar.toggle("filter-syntax", <FilterSyntaxGuide />)
      }
    >
      Filter Syntax Guide
    </Button>
  );
};

@vercel
Copy link

vercel bot commented Dec 16, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
outpost-docs Ready Ready Preview, Comment Dec 16, 2025 2:49pm
outpost-website Ready Ready Preview, Comment Dec 16, 2025 2:49pm

@alexluong alexluong merged commit dc1c0a8 into v0.10.0 Dec 17, 2025
14 checks passed
@alexluong alexluong deleted the sidebar branch December 17, 2025 07:49
alexluong added a commit that referenced this pull request Dec 17, 2025
* refactor: sidebar component

* refactor: sidebar api
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