Skip to content

Instantly share code, notes, and snippets.

View alshdavid's full-sized avatar

David Alsh alshdavid

View GitHub Profile
@alshdavid
alshdavid / alertcomponent.ts
Last active November 14, 2016 02:40
angular2 popup input help
@Component({
html:
"
<section *ngFor="status">
<div> {{ msg }} </div>
<input id="popup_input" type="text" />
<button id="popup_button">send</button>
</section>
"
})
import { Component, OnInit } from '@angular/core';
import { StartyourdayService } from './startyourday.service'
@Component({
selector: 'trc-startyourday',
template: `
<button (click)="one()"> {{val_one}} </button>
<span>{{why.tasks[0].status}}</span>
<br><br>
type Thing = {
data: string
printData: () => void
}
const printData = (t: Thing) => () => {
console.log(t.data)
}
const createThing = (): Thing => {
@alshdavid
alshdavid / About.jsx
Last active May 11, 2019 07:27
Animated Routes
import React from 'react'
export const About = (req, nav) => () => (
<main>
<nav>
<div>
<button onClick={() => nav.navigate('/home')}>Home</button>
<button onClick={() => nav.navigate('/about')}>About</button>
</div>
<div>
* {
-webkit-tap-highlight-color: rgba(0,0,0,0);
-webkit-font-smoothing: antialiased;
-Mac-osx-font-smoothing: grayscale;
list-style-type: none;
text-decoration: none;
color: inherit;
font-family: 'Rubik', sans-serif;
margin: 0;
padding: 0;
import crayon from 'crayon';
import react from 'crayon/react';
import transition from 'crayon/transition';
import { Home } from './pages/home'
import { More } from './pages/more'
import { About } from './pages/about'
import './index.css'
const app = crayon.create()
.router-view.fade {
opacity: 0;
transition: opacity .5s;
}
.router-view.fade-enter-first {
position: static;
transition-duration: 0s !important;
}
import React from 'react'
import * as crayon from 'crayon'
import * as react from 'crayon/react'
import * as transition from 'crayon/transition'
const TabA = () => <div>Tab A</div>
const TabB = () => <div>Tab B</div>
export const Items = (nav) => () => {
const [ tabs, setTabs ] = react.useRouter('tab-view', (tabs, selector) => {
const createStore = () => {
let items = [];
const watchers = [];
const add = item => {
items.push(item);
emit();
};
const complete = id => {
import React from 'react'
import * as item from './item'
export const ListView = (store) => () => {
const [ items, setItems ] = useState([])
useEffect(() => {
const sub = store.onChanges(items => setItems(items))
return () => sub()
}, [ store ])