@@ -5,12 +5,10 @@ https://quickstarts.netlify.app/
55
66## Install
77
8- Note: These instructions can change over time as the module gets more refined
9-
108``` bash
11- ` yarn add @patternfly/quickstarts @patternfly/patternfly`
9+ yarn add @patternfly/quickstarts @patternfly/patternfly
1210or
13- ` npm install @patternfly/quickstarts @patternfly/patternfly`
11+ npm install @patternfly/quickstarts @patternfly/patternfly
1412```
1513
1614The package currently has these peer dependencies:
@@ -35,7 +33,7 @@ import '@patternfly/quickstarts/dist/quickstarts.css';
3533
3634## Usage
3735
38- In your main app file wrap your application:
36+ In your main app file wrap your application with the QuickStartContext and the QuickStartDrawer :
3937
4038``` js
4139import {
@@ -44,29 +42,24 @@ import {
4442 QuickStartCatalogPage ,
4543 useValuesForQuickStartContext ,
4644 useLocalStorage ,
47- QuickStartContextValues ,
48- QuickStartContext ,
45+ QuickStartContextValues
4946} from ' @patternfly/quickstarts' ;
5047// for how these yaml files should look see below
5148import quickstartOne from ' .yamls/quickstart-one.yaml' ;
5249import quickstartTwo from ' .yamls/quickstart-two.yaml' ;
5350
5451const App = () => {
5552 const allQuickStarts = [quickstartOne, quickstartTwo];
53+ // You can use the useLocalStorage hook if you want to store user progress in local storage
54+ // Otherwise you can use React.useState here or another means (backend) to store the active quick start ID and state
5655 const [activeQuickStartID , setActiveQuickStartID ] = useLocalStorage (' quickstartId' , ' ' );
5756 const [allQuickStartStates , setAllQuickStartStates ] = useLocalStorage (' quickstarts' , {});
58- const { pathname: currentPath } = window .location ;
59- const quickStartPath = ' /quickstarts' ;
6057 const valuesForQuickstartContext = useValuesForQuickStartContext ({
6158 allQuickStarts,
6259 activeQuickStartID,
6360 setActiveQuickStartID,
6461 allQuickStartStates,
65- setAllQuickStartStates,
66- footer: {
67- showAllLink: currentPath !== quickStartPath,
68- onShowAllLinkClick : () => history .push (quickStartPath),
69- },
62+ setAllQuickStartStates
7063 });
7164
7265 return (
@@ -86,7 +79,7 @@ const App = () => {
8679};
8780
8881const SomeNestedComponent = () => {
89- const qsContext = React .useContext < QuickStartContextValues > QuickStartContext;
82+ const qsContext = React .useContext < QuickStartContextValues> QuickStartContext;
9083 return (
9184 < button onClick= {() => qsContext .setActiveQuickStart (' a quickstart id' )}>
9285 Open a quickstart from a nested component
0 commit comments