Skip to content

Commit 179fa9d

Browse files
authored
feat: add storybook to component libraries and a private package for component documentation (#1928)
This adds the storybook implementation to the @microsoft/fast-components-react-msft and @microsoft/fast-components-react-base packages to replace the soon-to-be deprecated development site and also adds a private package that contains a site to be used for component documentation.
1 parent b4aa7be commit 179fa9d

File tree

303 files changed

+5209
-6584
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

303 files changed

+5209
-6584
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
package-lock=false
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
coverage/*
2+
dist/*
3+
www/*
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Introduction
2+
3+
This is the documentation site for `@microsoft/fast-components-react-msft`.
4+
5+
It is built using the `@microsoft/fast-tooling-react` and `@microsoft/fast-components-react-msft` packages to view, configure, and document each component.
6+
7+
## Getting Started
8+
Follow setup instructions in [contributing](https://github.com/Microsoft/fast-dna/blob/master/CONTRIBUTING.md).
9+
10+
- Running the app locally: `npm start`
11+
- Build production app: `npm run build`
12+
13+
## Testing
14+
- Run all tests: `npm test`
15+
- tslint all files: `npm run tslint`
16+
17+
## Troubleshooting
18+
- The application uses service-workers, which means views might not update as expected during the development process. To ensure files are updated when changed, you can configure your developer tools to [update the assets on reload](https://stackoverflow.com/questions/40783790/disable-service-workers-when-in-development-mode).
19+
20+
## Contributing components
21+
22+
If you are adding a component to the documentation site, you will need to:
23+
24+
- Add curated component configs to the `./app/utilities/configs/` folder. See the `./app/utilities/configs/README.md` for details.
25+
- If your component includes a plugin, add any plugin ids and custom plugins to the `./app/utilities/plugins/` folder. For more information on how plugins work, read the [documentation](https://github.com/microsoft/fast-dna/blob/master/packages/fast-tooling-react/README.md) for the `@microsoft/fast-tooling-react` package.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import React from "react";
2+
import Adapter from "enzyme-adapter-react-16";
3+
import { configure, mount, shallow } from "enzyme";
4+
import App from "./app";
5+
6+
/*
7+
* Configure Enzyme
8+
*/
9+
configure({ adapter: new Adapter() });
10+
11+
describe("App", (): void => {
12+
test("should not throw", () => {
13+
expect(() => {
14+
mount(<App />);
15+
}).not.toThrow();
16+
});
17+
});
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import React from "react";
2+
import Dictionary from "./dictionary";
3+
import Explorer from "./explorer";
4+
import Preview from "./preview";
5+
import { history } from "./config";
6+
import { Route, Router } from "react-router-dom";
7+
8+
/**
9+
* The root level app
10+
*
11+
* This is where the routes are declared
12+
*/
13+
export default class App extends React.Component<{}, {}> {
14+
public render(): React.ReactNode {
15+
return (
16+
<Router history={history}>
17+
<div>
18+
<Route component={Dictionary} exact={true} path="/" />
19+
<Route
20+
component={Explorer}
21+
exact={true}
22+
path="/components/:component"
23+
/>
24+
<Route component={Preview} exact={true} path="/preview" />
25+
</div>
26+
</Router>
27+
);
28+
}
29+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import React from "react";
2+
3+
export interface GroupProps {
4+
style?: React.CSSProperties;
5+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"$schema": "http://json-schema.org/schema#",
3+
"title": "Group",
4+
"description": "A group's schema definition.",
5+
"id": "group",
6+
"type": "object",
7+
"properties": {},
8+
"reactProperties": {
9+
"children": {
10+
"title": "Children",
11+
"type": "children",
12+
"defaults": [
13+
"text"
14+
]
15+
}
16+
}
17+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import React from "react";
2+
import { GroupProps } from "./group.props";
3+
4+
/**
5+
* This component is used as a container to group child components together
6+
*/
7+
export class Group extends React.Component<GroupProps, {}> {
8+
public render(): React.ReactNode {
9+
return <div style={this.props.style}>{this.props.children}</div>;
10+
}
11+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from "./group";
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from "./group";

0 commit comments

Comments
 (0)