Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: adds fast-development-site for testing component libraries #7

Merged
merged 4 commits into from
Mar 3, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,5 @@ typings/
# dotenv environment variables file
.env

# Ignore distribution directory
dist/
2 changes: 2 additions & 0 deletions packages/fast-development-site/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# FAST development site
This is the development site which can be used to create a react environment for a group of react or web components.
63 changes: 63 additions & 0 deletions packages/fast-development-site/app/app.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import * as React from "react";
import * as ReactDOM from "react-dom";
import Site, { ISiteProps, ISiteCategoryProps } from "../src";

import Button from "./components/button";
import Paragraph from "./components/paragraph";
import PolymerHeading from "./components/polymer-heading";

const items: ISiteCategoryProps[] = [
{
name: "components",
items: [
{
name: "button",
component: Button,
data: [
{
children: "foo"
},
{
children: "bar"
},
{
children: "bat"
}
]
},
{
name: "paragraph",
component: Paragraph,
data: [{}, {}, {}, {}]
},
{
name: "polymer-heading",
component: PolymerHeading,
type: "polymer",
data: [
{
class: "foo",
children: "Heading 1"
},
{
class: "bar",
children: "Heading 2"
},
{
class: "bat",
children: "Heading 3"
}
]
}
]
}
];

const render: any = (): void => {
ReactDOM.render(
<Site categories={items} />,
document.getElementById("root")
);
};

render();
14 changes: 14 additions & 0 deletions packages/fast-development-site/app/components/button.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import * as React from "react";

class Button extends React.Component<{}, {}> {

public render(): JSX.Element {
return (
<button>
{this.props.children}
</button>
);
}
}

export default Button;
14 changes: 14 additions & 0 deletions packages/fast-development-site/app/components/paragraph.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import * as React from "react";

class Paragraph extends React.Component<{}, {}> {

public render(): JSX.Element {
return (
<p>
paragraph
</p>
);
}
}

export default Paragraph;
31 changes: 31 additions & 0 deletions packages/fast-development-site/app/components/polymer-heading.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import {
Element as PolymerElement
} from "../../node_modules/@polymer/polymer/polymer-element.js";

export default class PolymerHeading extends PolymerElement {
private class: string;

constructor() {
super();

this.class = "";
}

static get is(): string {
return "polymer-heading";
}

static get template(): string {
const style: string = `<style></style>`;
const element: string = `<h2 class="[[class]]"><slot></slot></h2>`;
return style + element;
}

static get properties(): any {
return {
class: String
};
}
}

customElements.define(PolymerHeading.is, PolymerHeading);
11 changes: 11 additions & 0 deletions packages/fast-development-site/app/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>FAST development app</title>
</head>
<body>
<div id="root"></div>
</body>
</html>
Loading