Skip to content

Instantly share code, notes, and snippets.

@acao
Last active April 21, 2022 10:09
Show Gist options
  • Save acao/6f65d7230ec954e01fe76046d5062c6e to your computer and use it in GitHub Desktop.
Save acao/6f65d7230ec954e01fe76046d5062c6e to your computer and use it in GitHub Desktop.
roadmap for @graphiql/react component library

GraphiQL Roadmap Notes

GraphiQL Component Library Roadmap

Initial Workspace Setup

Begin with setting up @graphiql/react workspace & component library tooling with:

  • storybook/ladle/etc
  • css-in-js framework with css variables-driven customization such as stitches
  • using vite as a bundler
  • exports hooks, components and providers
  • readme

Initial Style Guide

prior art

Implement the default style guide & dark mode as color theme(s) from the redesign.

Decide:

  • whether themes will each have their own dark mode variant palette, or whether there will just be themes which are light and themes which are dark.
  • how users will provide the custom theme
  • whether we should use stiches or similar?
  • how typography & font rendering & scaling will be handled

Keep in mind:

  • many graphiql users are used to a simple html file setup that uses the bundled javascript and css. if we can ship custom themes which are just cdn files that specify css variables that can cascade to whatever stitches is doing, then we're in a good place for them
  • users will be re-using these components & hooks for custom sidebar and results components.

Theme Provider? and Hooks?

the default theme should provide some hooks for accessing theme values inline, for when users want to customize their plugins (if this makes sense with stitches)

Tabs

prior art

Start with tabs and dropdowns towards the basic embedded doc experience (top right of the figma). Following terminology for tab UX elements will follow wai-aria spec - we have tab, tabpanel and tablist

Multi-purpose tabpanel UX

We will need a tabs DX that allows for both a re-rendered tabpanel, and a persistent tabpanel. For example, @radix ui only supports the former. The latter would have wai aria props transform at runtime when the tab changes, as we do in graphiql tabs now, to prevent re-renders of the editor components. In other cases, we do want the components to unmount when toggling the tab editor, in other cases, we just want to execute a state change and tell the underlying editor to switch to the in-memory (or persisted) model for that tab.

Multi-purpose tablist container, aka "toolbar"

prior art

this could also include a section for dropdown, or just have a mode where the tabs push into a dropdown when there are too many tabs for the current render width

sandpack also has a great example of this

Resizer

prior art

A utility component to control the size of it's children based on a parent onresize window event listener.

I would re-architect this to have a single provider that listens to onresize (debounced) and tells the child context subscribers the resulting height and width when it changes.

Pane

Perhaps a pane component that can have it's own toolbar/footer/etc? Similar to how a Card component might work?

TypeInfo components

prior art story

This is a simple set of primitive visual styling components that Laura put together for us to build out and style the classic doc explorer experience. The only things for "classic" DocExplorer needed outside of this simple example are:

  • collapsing region for deprecated fields
  • toolbar with navigation buttons
  • search input component doesn't exist yet?

Phase 2 - More components!

These aren't as important as others but will help move things along!

  • Buttons (for toolbars, forms, etc)
  • Form/Input components for user/other settings
  • Dropdown menu (for toolbar and otherwise)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment