Summary: "yoga-playground" contains the code for the playground used on the Yoga website. It lives inside the "website" package, but also has its own separate package.json and lockfile. The package wasn't ever published, and does not share a workspace with the website or other JS packages. We can remove the package.json and related files to remove the lockfile, build steps, etc, while letting it still be used by the website (the only thing using the playground right now). Pull Request resolved: https://github.com/facebook/yoga/pull/1192 Test Plan: GitHub Actions will test that the website build still succeeds. Reviewed By: christophpurrer Differential Revision: D42240825 Pulled By: NickGerleman fbshipit-source-id: fe0de2a25536d4e6b5a8531d0c0a2a51215fa38f
Yoga documentation and playground
This site uses gatsby.js as static site generator. Which transforms all markdown and react code to static HTML and JS files.
Development
yarn install
yarn develop
Structure
Documentation pages are generated from the Markdown files in contents/
. The files are organized in 4 sections/folders (getting-started, properties, examples, contributing) which are dynamically listed on the docs overview page. The Markdown files can have some header files containing metadata.
---
path: "docs/flexDirection"
title: "Flex Direction"
hasPlayground: true
editableProperties: ['flexDirection']
---
The path
can be any URL this page should be available at. The title
is used as the page's HTML-title and when referencing the file from the documentation overview. There are two kinds of templates for a page: with and without playground. hasPlayground
selects the corresponding template (src/templates/{with|without}Playground.js
). When using hasPlayground: true
, editableProperties
can list all Yoga properties which are editable in the playground.
Design
We are using antd for various UI elements. See their documentation for the components available. gatsby-config.js
can be used to overwrite LESS-variables from antd.
For styling react components we create a CSS-file with the same name next to each component and import it in the component. E.g. there is index.js
and index.css
. In the react-component we import the stylesheet: import './index.css'
.
Build
To generate the static files run:
yarn build
The output will be in public/
and can be published on GitHub pages.