Skip to content

Commit 9ff390b

Browse files
committed
update docs, few prop defs
1 parent 4ee7ff1 commit 9ff390b

File tree

9 files changed

+97
-19
lines changed

9 files changed

+97
-19
lines changed

packages/module/package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"version": "2.2.3",
44
"description": "PatternFly quick starts",
55
"files": [
6+
"src",
67
"dist"
78
],
89
"main": "dist/index.js",
@@ -20,7 +21,7 @@
2021
"scripts": {
2122
"clean": "rm -rf dist",
2223
"prebuild": "yarn clean",
23-
"build": "rollup -c && yarn purge-css && yarn combine && yarn min-css && yarn min-css-standalone",
24+
"build": "rollup -c && yarn purge-css && yarn combine && yarn min-css && yarn min-css-standalone && yarn docs:copy",
2425
"watch": "rollup -w --config rollup-quick.config.js",
2526
"quick": "rollup --config rollup-quick.config.js",
2627
"combine": "node ./combineCss.js",
@@ -36,7 +37,8 @@
3637
"docs:develop": "pf-docs-framework start",
3738
"docs:build": "pf-docs-framework build all --output public",
3839
"docs:serve": "pf-docs-framework serve public --port 5000",
39-
"docs:screenshots": "pf-docs-framework screenshots --urlPrefix http://localhost:5000"
40+
"docs:screenshots": "pf-docs-framework screenshots --urlPrefix http://localhost:5000",
41+
"docs:copy": "mkdir -p dist/patternfly-docs && cp -R patternfly-docs/content/extensions/quick-starts dist/patternfly-docs"
4042
},
4143
"peerDependencies": {
4244
"@patternfly/react-core": ">=4.115.2",

packages/module/patternfly-docs/content/extensions/quick-starts/design-guidelines/design-guidelines.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,11 @@ section: extensions
66
# should be the same for all markdown files for each extension
77
id: Quick Starts
88
# Tab
9-
source: Design-Guidelines
9+
source: design-guidelines
1010
---
1111

12-
A **quick start** is a set of step-by-step instructions and tasks presented in a side panel embedded in a product’s UI. Quick starts can help users get started with a product, and they often provide guidance around installation and setup.
13-
14-
Each task in a quick start has multiple steps, and each quick start has multiple tasks. The outcome of the quick start includes the artifacts or state needed to successfully use the product, specific features, or add-ons.
15-
12+
# Quickstarts
1613
## Elements
17-
1814
### Card
1915

2016
Quick starts are usually surfaced within a [catalog](https://www.patternfly.org/v4/components/card/design-guidelines/#cards-in-catalog-views) as clickable cards.
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
---
2+
# Sidenav top-level section
3+
# should be the same for all markdown files for each extension
4+
section: extensions
5+
# Sidenav secondary level section
6+
# should be the same for all markdown files for each extension
7+
id: Quick Starts
8+
# Tab
9+
source: about
10+
---
11+
# About
12+
The **@patternfly/quickstarts** extension is made up of two parts: `Quickstarts` and `In App Documenation` product documentation tools.
13+
14+
## Full live demo application
15+
A live demo of **Quickstarts and In App Documentation** can be found [here](https://quickstarts.netlify.app/), or view the [demo code](https://github.com/patternfly/patternfly-quickstarts/tree/main/packages/dev).
16+
17+
A few key concepts are outlined below.
18+
19+
## Quickstarts
20+
A `Quickstart` is a set of step-by-step instructions and tasks presented in a side panel embedded in a product’s UI. Quick starts can help users get started with a product, and they often provide guidance around installation and setup.
21+
22+
Each task in a quick start has multiple steps, and each quick start has multiple tasks. The outcome of the quick start includes the artifacts or state needed to successfully use the product, specific features, or add-ons.
23+
24+
<img src="./img/side-panel.png" alt="Side panel elements" width="449"/>
25+
26+
For more detailed design guidelines and visuals see [here.](/extensions/quick-starts/design-guidelines#quickstarts)
27+
28+
### Quickstart format
29+
30+
#### For developers
31+
A detailed breakdown of the quickstart format in code can be seen [here](https://github.com/patternfly/patternfly-quickstarts/blob/main/packages/module/src/utils/quick-start-types.ts).
32+
33+
Quickly preview a [basic exmaple](/extensions/quick-starts/Basic-Quick-Starts), and remember there is a [live demo](https://quickstarts.netlify.app/) with [full demo code](https://github.com/patternfly/patternfly-quickstarts/tree/main/packages/dev).
34+
35+
#### For content authors
36+
Quickstarts can be written in `yaml` with markdown support, `asciidoc`, or just `json`. For examples of each of these formats see [here](https://github.com/patternfly/patternfly-quickstarts/tree/main/packages/dev/src/quickstarts-data)
37+
38+
### Opening and closing the side panel
39+
40+
#### Custom handler
41+
Open the side panel by calling the `setActiveQuickStart` or `setActiveQuickstartID` methods. These methods are provided by the `QuickStartContext` and can be accessed in your React components:
42+
```typescript
43+
const { setActiveQuickStart } = React.useContext<QuickStartContextValues>(
44+
QuickStartContext,
45+
);
46+
```
47+
48+
#### Quickstart catalog
49+
By providing a set of quickstarts to the `QuickStartContainer`, a full page catalog view will be generated. Clicking on a catalog card will open its respective `Quickstart` in the side panel.
50+
51+
<img src="./img/catalog.png" alt="Quick start catalog" width="1680"/>
52+
53+
## In App Documenation
54+
In App Documentation is used to provide definitions for a set of topics relevant to your product. A single unit of In App Documentation can be called a `HelpTopic`, which is also the name used in code. `HelpTopic`'s essential sections are a **content** section that contains a definition of the term or topic, and an optional list of **links** to provide the user with other relevant information.
55+
56+
`HelpTopics` are displayed in a side panel just like `Quickstarts`:
57+
58+
<img src="./img/help-topic.png" alt="Quick start catalog" width="449"/>
59+
60+
### Help Topic format
61+
62+
#### For developers
63+
A detailed breakdown of the `HelpTopic` format in code can be seen [here](https://github.com/patternfly/patternfly-quickstarts/blob/main/packages/module/src/utils/help-topic-types.ts).
64+
65+
Quickly preview a [basic exmaple](/extensions/quick-starts/In-App-Documentation), and remember there is a [live demo](https://quickstarts.netlify.app/in-context-help) with [full demo code](https://github.com/patternfly/patternfly-quickstarts/tree/main/packages/dev).
66+
67+
#### For content authors
68+
HelpTopics are written in `yaml` with markdown support. An example can be seen [here](https://github.com/patternfly/patternfly-quickstarts/blob/main/packages/dev/src/quickstarts-data/yaml/in-context-help/example-topics.yaml)
69+
70+
### Opening and closing the side panel
71+
Open the side panel by calling `setActiveHelpTopicByName` (available from `HelpTopicContext`) with a `HelpTopic`'s name value.
72+
73+
```typescript
74+
const { setActiveHelpTopicByName } = React.useContext<HelpTopicContextValues>(HelpTopicContext);
75+
```
76+
77+
Close it by calling `setActiveHelpTopicByName` with an empty string. There is no prebuilt `HelpTopic` catalog. simply attach a handler with `setActiveHelpTopicByName` to the appropriate DOM element. See the [basic exmaple](/extensions/quick-starts/In-App-Documentation), or [live demo code](https://github.com/patternfly/patternfly-quickstarts/tree/main/packages/dev) for more details.

packages/module/patternfly-docs/content/extensions/quick-starts/examples/HelpTopics.md renamed to packages/module/patternfly-docs/content/extensions/quick-starts/examples/help-topics.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ section: extensions
77
id: Quick Starts
88
# Tab
99
source: In-App-Documentation
10+
propComponents: ['HelpTopicContainer']
1011
---
1112

1213
import { LoadingBox, HelpTopicContainer, HelpTopicContext } from '@patternfly/quickstarts';
192 KB
Loading
77.7 KB
Loading
89.7 KB
Loading

packages/module/src/HelpTopicDrawer.tsx

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,25 @@ import { QuickStartContextValues } from './utils/quick-start-context';
1111
import { HelpTopic } from './utils/help-topic-types';
1212

1313
export interface HelpTopicContainerProps extends React.HTMLProps<HTMLDivElement> {
14-
/* array of HelpTopics */
14+
/** array of HelpTopics */
1515
helpTopics: HelpTopic[];
16-
/* text resources object */
16+
/** text resources object
17+
* Add custom strings: https://github.com/patternfly/patternfly-quickstarts/tree/main/packages/module#localization
18+
*/
1719
resourceBundle?: any;
18-
/* language of the current resource bundle */
20+
/** language of the current resource bundle */
1921
language?: string;
20-
/* if true, will show a loading spinner on the catalog page (default false) */
22+
/** if true, will show a loading spinner on the catalog page (default false) */
2123
loading?: boolean;
2224
/**
2325
* Additional markdown extensions and renderers to use
24-
* TODO: example usage - In the meantime you can take a look at:
25-
* https://github.com/openshift/console/blob/master/frontend/packages/console-app/src/components/quick-starts/utils/quick-start-context.tsx#L235
26+
* Example usage: https://github.com/patternfly/patternfly-quickstarts/tree/main/packages/module#markdown-extensions
2627
*/
2728
markdown?: {
2829
extensions?: any[];
2930
renderExtension?: (docContext: HTMLDocument, rootSelector: string) => React.ReactNode;
3031
};
31-
/* additional quick start context props */
32+
/** additional quick start context props */
3233
contextProps?: QuickStartContextValues;
3334
}
3435

@@ -41,7 +42,7 @@ export const HelpTopicContainer: React.FC<HelpTopicContainerProps> = ({
4142
markdown,
4243
contextProps,
4344
...props
44-
}) => {
45+
}: HelpTopicContainerProps) => {
4546
const valuesForHelpTopicContext: HelpTopicContextValues = useValuesForHelpTopicContext({
4647
helpTopics,
4748
language,

packages/module/src/QuickStartDrawer.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ export interface QuickStartContainerProps extends React.HTMLProps<HTMLDivElement
4040
useLegacyHeaderColors?: boolean;
4141
/** text resources object */
4242
resourceBundle?: any;
43-
/** language of the current resource bundle */
43+
/** language of the current resource bundle
44+
* Add custom strings: https://github.com/patternfly/patternfly-quickstarts/tree/main/packages/module#localization
45+
*/
4446
language?: string;
4547
/** if true, will show a loading spinner on the catalog page (default false) */
4648
loading?: boolean;
@@ -50,8 +52,7 @@ export interface QuickStartContainerProps extends React.HTMLProps<HTMLDivElement
5052
alwaysShowTaskReview?: boolean;
5153
/**
5254
* Additional markdown extensions and renderers to use
53-
* TODO: example usage - In the meantime you can take a look at:
54-
* https://github.com/openshift/console/blob/master/frontend/packages/console-app/src/components/quick-starts/utils/quick-start-context.tsx#L235
55+
* Example usage: https://github.com/patternfly/patternfly-quickstarts/tree/main/packages/module#markdown-extensions
5556
*/
5657
markdown?: {
5758
extensions?: any[];

0 commit comments

Comments
 (0)