Documentation site for Pendo's design system, Prism. Live on GitHub Pages.
Tip
Just making a small change? Try editing directly in Github! You won't need to clone the repository or set up a local development environment.
See the linked Github documentation for how to edit! Be sure to create a new branch and pull request so that your changes can be reviewed.
For engineers:
To run the site locally, you must have NodeJS and NPM installed.
Additionally, you must have authenticated yourself in Artifactory, and associated the @pendo
package scope to our private registry. Instructions for how to do so are on Confluence.
Once that setup is complete, installation on the command line is simple:
npm install
As you make changes to the source files, the site will automatically recompile and re-render on any browser where it is being previewed.
By default, the site is served locally at http://localhost:8080/prism-design-system
.
npm start
# OR
npm run serve
You shouldn't need to run the build script unless you're messing with the deployment process.
npm run build
The main content for the site is largely pulled from extended Markdown files (MDX) within the src/content
directory. Most contributions can happen exclusively within that folder.
Any file within the src/content
directory with a .mdx
extension will be used to generate a page (or tab) on the built site.
For example, a file called icons.mdx
in the directory src/content/foundations/reference/
will be rendered at a URL like http://localhost:8080/prism-design-system/foundations/reference/icons
.
There are a couple of exceptions:
- If the file is named
index.mdx
specifically, it will be dropped from the URL:src/content/components/buttons/index.mdx
is rendered at a URL likehttp://localhost:8080/prism-design-system/components/buttons
. - A file with a
META.tab
field set will only be rendered in a tab (not a standalone page). See the "Tabs" section of the README for details.
Important
The sidebar is not currently auto-generated. After creating new files, the URLs will be valid, but the links need to be manually added to src/components/SidebarNav.vue
, in the NAV_ITEMS
array. Simply copy-pasting existing links and sections in that variable should be sufficient.
Any valid Markdown is valid MDX! You can simply write as you normally would in a README.md file, and the site will be rendered appropriately.
Additionally, MDX allows you to import Component Library components and display them inline with your Markdown documentation. The syntax (called JSX) is very similar to standard HTML and JS.
For example, to render a Pendo Button in a MDX file:
import { PendoButton } from '@pendo/components';
## Overview
A button is an essential UI component in most designs. Here is an example:
<PendoButton label="Button" type="primary" />
Pretty interesting!
Sometimes an example requires the use of reactive props or events from the Component Library's exposed interface. External variables may be necessary to wire a flow together.
The syntax to accomplish this in JSX is a bit different from Vue:
- "Reactive" attributes must be surrounded by
{curly braces}
to distinguish them from regular string attributes - Variables declared elsewhere in the MDX document must be
export
ed for them to be usable by a component in the document
A small example of a button whose label is incremented on each click follows:
import { ref } from 'vue';
import { PendoButton } from '@pendo/components';
# Reactive button example
export const count = ref(0);
<PendoButton label={`Count: ${count.value}`} onClick={() => count.value++} />
Caution
Documentation with heavy logic should be the exception, rather than the rule. Use the above syntax only when absolutely necessary, and look for ways to simplify examples to be purely visual. The purpose of this documentation is not to demonstrate full-fledged application snippets: look to Storybook for those examples.
To render multiple Markdown files in separate tabs of a single documentation page, a specific structure is necessary:
src/content/components/buttons
index.mdx
spec.mdx
properties.mdx
(...et cetera)
The index.mdx
file should import and use the ContentTabs
prebuilt component, like so:
import ContentTabs from '@/components/ContentTabs.vue';
# Buttons
Summary of the Button component here
<ContentTabs />
For every other file to be rendered in a tab, add the following export to the top of the file:
export const META = {
tab: true,
index: 1,
label: 'Specs'
};
## Overview
Blah blah documentation content
META.tab
should be set to a truthy valueMETA.label
is the human-readable label for the tabMETA.index
is used for sorting the tabs' rendered order
Make a pull request to the main
branch of the repository and follow Pendo's standard review process.
A lookaside will be built and deployed at a Google Cloud URL with the following form:
https://storage.googleapis.com/prism-design-system/{{ BRANCH_NAME }}/index.html#/
You will also be given a link to the deployment at the bottom of the PR discussion:
Warning
Merges to the main
branch automatically trigger the site's deployment to Github Pages. Therefore, a handful of conditions are enforced on branches before they can merge into main
:
- The branch needs an open pull request
- The
build
job needs to pass on that branch
Once both of those conditions are met, merging can take place in either the Github UI, or on the command line.
Within a minute or two after merging into the main
branch, the latest changes should be visible at https://pendo-io.github.io/prism-design-system
.
The best way to contribute is to migrate documentation from Figma into the site! If you see any pages that need updating (or creation), don't hesitate to give it a shot.
For technical, engineering-related tasks, please refer to the Github Project for a list of work to be done.
If you notice a bug in the live site and aren't sure how to address it, feel free to create an issue here on Github, and it will be addressed as soon as possible!