Skip to content

Instantly share code, notes, and snippets.

View notakaos's full-sized avatar

Nobutaka OSHIRO notakaos

View GitHub Profile
@notakaos
notakaos / imports [slash] ui [slash] components [slash] MemoItem.js
Created March 25, 2016 17:52
Meteor 1.3 + React Simple Memo Step 6-1
// imports/ui/components/MemoItem.js
import React from 'react';
export default class MemoItem extends React.Component {
constructor(props) {
super(props);
const { memo } = this.props;
this.state = {
textAreaValue: memo.content
};
@notakaos
notakaos / imports [slash] api [slash] memos [slash] memos.js
Created March 25, 2016 17:30
Meteor 1.3 + React Simple Memo Step 5-3
// imports/api/memos/memos.js
import { Mongo } from 'meteor/mongo';
class MemosCollection extends Mongo.Collection {
insert(doc, callback) {
doc.createdAt = doc.createdAt || new Date();
const result = super.insert(doc, callback);
return result;
}
}
@notakaos
notakaos / imports [slash] ui [slash] components [slash] MemoItem.js
Created March 25, 2016 17:17
Meteor 1.3 + React Simple Memo Step 5-2
// imports/ui/components/MemoItem.js
import React from 'react';
export default class MemoItem extends React.Component {
constructor(props) {
super(props);
this.onClick = this.onClick.bind(this);
}
onClick(event) {
@notakaos
notakaos / imports [slash] ui [slash] containers [slash] AppContainer.js
Last active March 25, 2016 17:07
Meteor 1.3 + React Simple Memo Step 5-1
// imports/ui/containers/AppContainer.js
import AppLayout from '../layouts/AppLayout';
import { Memos } from '../../api/memos/memos';
import { createContainer } from 'meteor/react-meteor-data';
const createMemo = content => {
Memos.insert({content});
};
export default createContainer(() => {
@notakaos
notakaos / imports [slash] ui [slash] layouts [slash] AppLayout.js
Last active March 20, 2016 11:52
Meteor 1.3 + React Simple Memo Step 4-2
// imports/ui/layouts/AppLayout.js
import React from 'react';
import Header from '../components/Header';
import MemoList from '../components/MemoList';
export default class AppLayout extends React.Component {
static get propTypes() {
return {
memos: React.PropTypes.array.isRequired,
};
@notakaos
notakaos / bash
Created March 20, 2016 11:20
Meteor 1.3 + React Simple Memo Step 4-1
mkdir -p imports/api/memos
touch imports/api/memos/memos.js
@notakaos
notakaos / bash
Last active March 25, 2016 16:33
Meteor 1.3 + React Simple Memo Step 3-3
touch imports/ui/components/MemoItem.js
touch imports/ui/components/MemoList.js
@notakaos
notakaos / bash
Last active March 25, 2016 16:19
Meteor 1.3 + React Simple Memo Step 3-2
mkdir -p imports/ui/components
touch imports/ui/components/Header.js
@notakaos
notakaos / bash
Last active March 20, 2016 08:58
Meteor 1.3 + React Simple Memo Step 3-1
mkdir -p imports/ui/layouts
touch imports/ui/layouts/AppLayout.js
@notakaos
notakaos / bash
Last active March 20, 2016 08:29
Meteor 1.3 + React Simple Memo Step 2
meteor npm install --save react react-dom
meteor add [email protected]