-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[add] storybook
- Loading branch information
Aqid
committed
Feb 18, 2020
1 parent
9d96225
commit 758de73
Showing
17 changed files
with
10,965 additions
and
147 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import '@storybook/addon-notes/register-panel'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { configure } from '@storybook/html'; | ||
|
||
configure(require.context('../src/components', true, /\.stories\.js$/), module); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<script type="module" src="./remote-table/remote-table.esm.js"></script> | ||
<script nomodule="" src="./remote-table/remote-table.js"></script> | ||
|
||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> | ||
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.20/css/jquery.dataTables.css"> | ||
<script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.10.20/js/jquery.dataTables.js"></script> |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,40 @@ | ||
{ | ||
"name": "remote-table", | ||
"version": "0.0.1", | ||
"description": "Stencil Component Starter", | ||
"main": "dist/index.js", | ||
"module": "dist/index.mjs", | ||
"es2015": "dist/esm/index.mjs", | ||
"es2017": "dist/esm/index.mjs", | ||
"types": "dist/types/index.d.ts", | ||
"collection": "dist/collection/collection-manifest.json", | ||
"collection:main": "dist/collection/index.js", | ||
"unpkg": "dist/remote-table/remote-table.js", | ||
"files": [ | ||
"dist/", | ||
"loader/" | ||
], | ||
"scripts": { | ||
"build": "stencil build --docs", | ||
"start": "stencil build --dev --watch --serve", | ||
"test": "stencil test --spec --e2e", | ||
"test.watch": "stencil test --spec --e2e --watchAll", | ||
"generate": "stencil generate" | ||
}, | ||
"devDependencies": { | ||
"@stencil/core": "^1.8.4" | ||
}, | ||
"license": "MIT", | ||
"dependencies": { | ||
"@types/datatables.net": "^1.10.18", | ||
"@types/jquery": "^3.3.32", | ||
"datatables.net": "^1.10.20", | ||
"datatables.net-dt": "^1.10.20", | ||
"jquery": "^3.4.1" | ||
} | ||
"name": "remote-table", | ||
"version": "0.0.1", | ||
"description": "Stencil Component Starter", | ||
"main": "dist/index.js", | ||
"module": "dist/index.mjs", | ||
"es2015": "dist/esm/index.mjs", | ||
"es2017": "dist/esm/index.mjs", | ||
"types": "dist/types/index.d.ts", | ||
"collection": "dist/collection/collection-manifest.json", | ||
"collection:main": "dist/collection/index.js", | ||
"unpkg": "dist/remote-table/remote-table.js", | ||
"files": [ | ||
"dist/", | ||
"loader/" | ||
], | ||
"scripts": { | ||
"build": "stencil build --docs", | ||
"start": "stencil build --dev --watch --serve", | ||
"test": "stencil test --spec --e2e", | ||
"test.watch": "stencil test --spec --e2e --watchAll", | ||
"generate": "stencil generate", | ||
"storybook": "start-storybook -s ./dist" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.8.4", | ||
"@stencil/core": "^1.8.4", | ||
"@storybook/addon-notes": "^5.3.13", | ||
"@storybook/html": "^5.3.13", | ||
"babel-loader": "^8.0.6" | ||
}, | ||
"license": "MIT", | ||
"dependencies": { | ||
"@types/datatables.net": "^1.10.18", | ||
"@types/jquery": "^3.3.32", | ||
"datatables.net": "^1.10.20", | ||
"datatables.net-dt": "^1.10.20", | ||
"jquery": "^3.4.1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,72 +1,11 @@ | ||
 | ||
|
||
# Stencil Component Starter | ||
# Remote Table | ||
|
||
This is a starter project for building a standalone Web Component using Stencil. | ||
This is a web component built using stencil that tries to dynamically load values from api returning `JSON Array` | ||
|
||
Stencil is also great for building entire apps. For that, use the [stencil-app-starter](https://github.com/ionic-team/stencil-app-starter) instead. | ||
How to use : | ||
1. Clone the repository | ||
2. Run `npm run build` | ||
3. Run `npm run storybook` to see the documentation with live example | ||
|
||
# Stencil | ||
|
||
Stencil is a compiler for building fast web apps using Web Components. | ||
|
||
Stencil combines the best concepts of the most popular frontend frameworks into a compile-time rather than run-time tool. Stencil takes TypeScript, JSX, a tiny virtual DOM layer, efficient one-way data binding, an asynchronous rendering pipeline (similar to React Fiber), and lazy-loading out of the box, and generates 100% standards-based Web Components that run in any browser supporting the Custom Elements v1 spec. | ||
|
||
Stencil components are just Web Components, so they work in any major framework or with no framework at all. | ||
|
||
## Getting Started | ||
|
||
To start building a new web component using Stencil, clone this repo to a new directory: | ||
|
||
```bash | ||
git clone https://github.com/ionic-team/stencil-component-starter.git my-component | ||
cd my-component | ||
git remote rm origin | ||
``` | ||
|
||
and run: | ||
|
||
```bash | ||
npm install | ||
npm start | ||
``` | ||
|
||
To build the component for production, run: | ||
|
||
```bash | ||
npm run build | ||
``` | ||
|
||
To run the unit tests for the components, run: | ||
|
||
```bash | ||
npm test | ||
``` | ||
|
||
Need help? Check out our docs [here](https://stenciljs.com/docs/my-first-component). | ||
|
||
|
||
## Naming Components | ||
|
||
When creating new component tags, we recommend _not_ using `stencil` in the component name (ex: `<stencil-datepicker>`). This is because the generated component has little to nothing to do with Stencil; it's just a web component! | ||
|
||
Instead, use a prefix that fits your company or any name for a group of related components. For example, all of the Ionic generated web components use the prefix `ion`. | ||
|
||
|
||
## Using this component | ||
|
||
### Script tag | ||
|
||
- [Publish to NPM](https://docs.npmjs.com/getting-started/publishing-npm-packages) | ||
- Put a script tag similar to this `<script src='https://unpkg.com/[email protected]/dist/mycomponent.js'></script>` in the head of your index.html | ||
- Then you can use the element anywhere in your template, JSX, html etc | ||
|
||
### Node Modules | ||
- Run `npm install my-component --save` | ||
- Put a script tag similar to this `<script src='node_modules/my-component/dist/mycomponent.js'></script>` in the head of your index.html | ||
- Then you can use the element anywhere in your template, JSX, html etc | ||
|
||
### In a stencil-starter app | ||
- Run `npm install my-component --save` | ||
- Add an import to the npm packages `import my-component;` | ||
- Then you can use the element anywhere in your template, JSX, html etc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# remote-table | ||
|
||
|
||
|
||
<!-- Auto Generated Below --> | ||
|
||
|
||
## Properties | ||
|
||
| Property | Attribute | Description | Type | Default | | ||
| ------------ | ------------- | ----------- | -------- | ----------- | | ||
| `footerText` | `footer-text` | | `string` | `undefined` | | ||
| `remoteUrl` | `remote-url` | | `string` | `undefined` | | ||
| `tableTitle` | `table-title` | | `string` | `undefined` | | ||
|
||
|
||
## Dependencies | ||
|
||
### Depends on | ||
|
||
- [remote-table-header](../remote-table-header) | ||
- [remote-table-content](../remote-table-content) | ||
- [remote-table-footer](../remote-table-footer) | ||
|
||
### Graph | ||
```mermaid | ||
graph TD; | ||
remote-table --> remote-table-header | ||
remote-table --> remote-table-content | ||
remote-table --> remote-table-footer | ||
style remote-table fill:#f9f,stroke:#333,stroke-width:4px | ||
``` | ||
|
||
---------------------------------------------- | ||
|
||
*Built with [StencilJS](https://stenciljs.com/)* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
src/components/remote-table-container/remote-table.stories.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { storiesOf } from '@storybook/html'; | ||
import notes from './readme.md'; | ||
|
||
storiesOf('RemoteTable', module) | ||
.add('Json Typicode API', () => ` | ||
<remote-table remote-url='https://jsonplaceholder.typicode.com/todos' | ||
table-title="Json Typicode Table" footer-text="development on progress..."></remote-table> | ||
`, { notes }) | ||
.add('Given API', () => ` | ||
<remote-table remote-url='https://raw.githubusercontent.com/aqidd/remote-table/master/db.json' | ||
table-title="Remote Table 0.0.1" footer-text="development on progress..."></remote-table> | ||
`, { notes }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# remote-table-content | ||
|
||
|
||
|
||
<!-- Auto Generated Below --> | ||
|
||
|
||
## Properties | ||
|
||
| Property | Attribute | Description | Type | Default | | ||
| ----------- | ------------ | ----------- | -------- | ----------- | | ||
| `remoteUrl` | `remote-url` | | `string` | `undefined` | | ||
|
||
|
||
## Dependencies | ||
|
||
### Used by | ||
|
||
- [remote-table](../remote-table-container) | ||
|
||
### Graph | ||
```mermaid | ||
graph TD; | ||
remote-table --> remote-table-content | ||
style remote-table-content fill:#f9f,stroke:#333,stroke-width:4px | ||
``` | ||
|
||
---------------------------------------------- | ||
|
||
*Built with [StencilJS](https://stenciljs.com/)* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# remote-table-footer | ||
|
||
|
||
|
||
<!-- Auto Generated Below --> | ||
|
||
|
||
## Properties | ||
|
||
| Property | Attribute | Description | Type | Default | | ||
| ------------ | ------------- | ----------- | -------- | ----------- | | ||
| `footerText` | `footer-text` | | `string` | `undefined` | | ||
|
||
|
||
## Dependencies | ||
|
||
### Used by | ||
|
||
- [remote-table](../remote-table-container) | ||
|
||
### Graph | ||
```mermaid | ||
graph TD; | ||
remote-table --> remote-table-footer | ||
style remote-table-footer fill:#f9f,stroke:#333,stroke-width:4px | ||
``` | ||
|
||
---------------------------------------------- | ||
|
||
*Built with [StencilJS](https://stenciljs.com/)* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.