This file contains hidden or 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
Show hidden characters
{ | |
"defaultSeverity": "warning", | |
"extends": [ | |
"tslint:recommended" | |
], | |
"rules": { | |
"quotemark": [true, "double"], | |
"indent": [true, "spaces", 2], | |
"interface-name": false, | |
"ordered-imports": false, |
This file contains hidden or 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
import { Component, Prop } from "@stencil/core"; | |
import { $ as t } from "../../tachyons-styles"; | |
import { $ } from "./app-root-styles"; | |
import { h } from "@stencil/core/dist/renderer/vdom"; | |
@Component({ | |
tag: "app-root", | |
styleUrls: ["app-root.css", "../../tachyons.css"], | |
shadow: false | |
}) |
This file contains hidden or 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
export class MyActions { | |
public changeName: (e: Event) => void; | |
public saveName: (e: Event) => void; | |
public startOver: (e: Event) => void; | |
} |
This file contains hidden or 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
import { FRETS } from "frets"; |
This file contains hidden or 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
public getIPLocation = () => { | |
const context = this; | |
const req = axios.get("//freegeoip.net/json/") | |
.then((res) => { | |
if (res.data.region_code && res.data.region_code.length === 2) { | |
context.data.locationState = res.data.region_code; | |
} | |
context.renderer(context.data); | |
}) | |
.catch((x) => { context.renderer(context.data); }); |
This file contains hidden or 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
app.init([ | |
{ | |
comp: app.views.ViewLoader, | |
el: document.getElementById("mainapp"), | |
}]); |
This file contains hidden or 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
const app = new App<CalculationProps, ViewComponents>(container, { | |
locationState: "CO", | |
viewing: Views.HOME, | |
weight: 150, | |
} as CalculationProps); |
This file contains hidden or 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
const configuration: AppConfiguration<CustomProps, ViewComponents> = { | |
action: (m: Model<CustomProps>): ViewActions<CustomProps> => new AppViewActions(m), | |
model: { | |
validate: (props: CustomProps): Error[] => { | |
return []; // TODO | |
}, | |
}, | |
state: { | |
calculate: (props: CustomProps): CustomProps => { | |
props.hasUserData = ((props.gender === "MALE" || props.gender === "FEMALE") && props.weight > 0); |
This file contains hidden or 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
return $.button.circle.h({ | |
classes: new CC().when(model.viewing === view) | |
.bgAqua.blue | |
.otherwise().bgSilver.red | |
.toObj, | |
}, ["OK"]); |
This file contains hidden or 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
return $.div.border.h({ | |
classes: { | |
"bg-aqua": isActive, | |
"blue": isActive, | |
"bg-gray": !isActive, | |
"red": !isValid, | |
}}, []); |