Skip to content

Instantly share code, notes, and snippets.

@alehlopeh
Last active August 25, 2016 18:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alehlopeh/55463196384e267d79d71bb462987442 to your computer and use it in GitHub Desktop.
Save alehlopeh/55463196384e267d79d71bb462987442 to your computer and use it in GitHub Desktop.
untitled
import React from 'react'
const height = 200;
const width = 200;
class TTTWidget extends React.Component{
static title = 't'
static match(value, ast){
return value === 't'
}
constructor(props){
super()
this.state ={
cells: [0,1,2,3,4,5,6,7,8,9].reduce((acc,el)=>{
acc[el] = null;
return acc
},{})
}
}
render(){
alert('x')
return (
<div>
<div style={{height,width,flexWrap:'wrap',flexDirection:'row'}}>
{Object.keys(this.state.cells).map((c,cell) => {
return (
<div data-cell={cell}
style={{
height:height/3,
flex:1,
width:width/3,
display:'inline-flex',
border: '0px solid #000000',
borderLeftWidth: cell % 3 === 0 ? 0 : 1,
borderTopWidth: cell < 3 ? 0 : 1,
borderRightWidth: cell % 3 === 2 ? 0 : 1,
borderBottomWidth: cell > 5 ? 0 : 1,
}}>
{this.state.cells[cell]}
</div>
)
})}
</div>
</div>
)
}
}
doc.kernel.widgets.push(TTTWidget)
<TTTWidget/>
var hi;
hi = 't'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment