Skip to content

Draft: DocsDrawers PoC

Paul Gascou-Vaillancourt requested to merge 365287-docs-drawer-poc into master

What does this MR do and why?

This is a PoC to include docs drawers in the product. Some of the code here is inspired by !82516 (closed).

Screenshots or screen recordings

Advanced Search Syntax GLFM (dummy drawer for this PoC only)
Screen_Shot_2022-08-26_at_8.39.42_AM Screen_Shot_2022-08-26_at_8.39.57_AM
Screen recording
docs_drawer

How to set up and validate locally

To view the drawers implemented in this MR

  1. In the top navbar, search for any text.
  2. On the next page, click on the Advanced search syntax or GitLab Flavored Markdown button.

To add a new docs drawer

  1. Create a Markdown file in the doc/drawers directory.
  2. In app/assets/javascripts/docs_drawer/constants.js, add a an entry to the DOCS_DRAWERS map.
    • The new key should correspond to the Markdown file's path you've just created, relative to the doc/drawers directory and omitting the .md extension. So, it you've created doc/drawers/foo/bar.md, the new key should be 'foo/bar'.
    • The value can be an empty object ({}), or you can provide options to the drawer (refer to the comment in app/assets/javascripts/docs_drawer/constants.js for more information on available options).
  3. In the area where you want to add the docs drawer, import the toggleDocsDrawer helper:
    import { toggleDocsDrawer } from '~/docs_drawer';
  4. On the interaction that should trigger the docs drawer, call toggleDocsDrawer with the key you've added to the DOCS_DRAWERS map earlier, eg:
    toggleDocsDrawer('foo/bar');

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #365287 (closed)

Edited by Paul Gascou-Vaillancourt

Merge request reports

Loading