This repository has been archived by the owner on Mar 3, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 136
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
140 additions
and
40 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
node_modules/* | ||
node_modules/*.js |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// @flow | ||
import React from 'react'; | ||
import { connect } from 'react-redux'; | ||
import type { State } from 'store'; | ||
import { SampleActions } from 'store/actionCreators'; | ||
|
||
const SampleContainer = () => { | ||
SampleActions.increase(10); | ||
return ( | ||
<div> | ||
Hello | ||
</div> | ||
); | ||
}; | ||
|
||
export default connect( | ||
({ sample }: State) => ({ | ||
value: sample.value, | ||
}), | ||
() => ({}), | ||
)(SampleContainer); |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// @flow | ||
import { createAction, handleActions } from 'redux-actions'; | ||
import { Record, type Map } from 'immutable'; | ||
|
||
const SHOW_USER_MENU = 'base/SHOW_USER_MENU'; | ||
const HIDE_USER_MENU = 'base/HIDE_USER_MENU'; | ||
const SET_FULLSCREEN_LOADER = 'base/SET_FULLSCREEN_LOADER'; | ||
|
||
export type BaseActionCreators = { | ||
showUserMenu(): any, | ||
hideUserMenu(): any, | ||
setFullscreenLoader(visibility: boolean): any, | ||
}; | ||
|
||
export const actionCreators = { | ||
showUserMenu: createAction(SHOW_USER_MENU), | ||
hideUserMenu: createAction(HIDE_USER_MENU), | ||
setFullscreenLoader: createAction(SET_FULLSCREEN_LOADER), | ||
}; | ||
|
||
export type Base = { | ||
userMenu: boolean, | ||
fullscreenLoader: boolean | ||
} | ||
|
||
const BaseRecord = Record({ | ||
userMenu: false, | ||
fullscreenLoader: false, | ||
}); | ||
|
||
|
||
const initialState: Map<string, *> = BaseRecord(); | ||
|
||
export default handleActions({ | ||
[SHOW_USER_MENU]: state => state.set('userMenu', true), | ||
[HIDE_USER_MENU]: state => state.set('userMenu', false), | ||
[SET_FULLSCREEN_LOADER]: (state, { payload: visibility }) => state.set('fullscreenLoader', visibility), | ||
}, initialState); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,51 @@ | ||
// @flow | ||
import { createAction, handleActions } from 'redux-actions'; | ||
import { Record, type Map } from 'immutable'; | ||
import { createAction, handleActions, type ActionTypes } from 'redux-actions'; | ||
import produce from 'immer'; | ||
|
||
const SHOW_USER_MENU = 'base/SHOW_USER_MENU'; | ||
const HIDE_USER_MENU = 'base/HIDE_USER_MENU'; | ||
const SET_FULLSCREEN_LOADER = 'base/SET_FULLSCREEN_LOADER'; | ||
|
||
export type BaseActionCreators = { | ||
showUserMenu(): any, | ||
hideUserMenu(): any, | ||
setFullscreenLoader(visibility: boolean): any, | ||
}; | ||
const showUserMenu = createAction(SHOW_USER_MENU); | ||
const hideUserMenu = createAction(HIDE_USER_MENU); | ||
const setFullscreenLoader = createAction( | ||
SET_FULLSCREEN_LOADER, | ||
(visibility): boolean => visibility); | ||
|
||
type ShowUserMenuAction = ActionType<typeof showUserMenu>; | ||
type HideUserMenuAction = ActionType<typeof hideUserMenu>; | ||
type SetFullscreenLoaderAction = ActionType<typeof setFullscreenLoader>; | ||
|
||
export const actionCreators = { | ||
showUserMenu: createAction(SHOW_USER_MENU), | ||
hideUserMenu: createAction(HIDE_USER_MENU), | ||
setFullscreenLoader: createAction(SET_FULLSCREEN_LOADER), | ||
export interface BaseActionCreators { | ||
showUserMenu(): ShowUserMenuAction, | ||
hideUserMenu(): HideUserMenuAction, | ||
setFullscreenLoader(): SetFullscreenLoaderAction | ||
} | ||
|
||
export const actionCreators: BaseActionCreators = { | ||
showUserMenu, hideUserMenu, setFullscreenLoader, | ||
}; | ||
|
||
export type Base = { | ||
userMenu: boolean, | ||
fullscreenLoader: boolean | ||
} | ||
}; | ||
|
||
const BaseRecord = Record({ | ||
const initialState: Base = { | ||
userMenu: false, | ||
fullscreenLoader: false, | ||
}); | ||
|
||
|
||
const initialState: Map<string, *> = BaseRecord(); | ||
}; | ||
|
||
export default handleActions({ | ||
[SHOW_USER_MENU]: state => state.set('userMenu', true), | ||
[HIDE_USER_MENU]: state => state.set('userMenu', false), | ||
[SET_FULLSCREEN_LOADER]: (state, { payload: visibility }) => state.set('fullscreenLoader', visibility), | ||
[SHOW_USER_MENU]: state => produce(state, (draft) => { | ||
draft.userMenu = true; | ||
}), | ||
[HIDE_USER_MENU]: state => produce(state, (draft) => { | ||
draft.userMenu = false; | ||
}), | ||
[SET_FULLSCREEN_LOADER]: (state, action: SetFullscreenLoaderAction) => { | ||
return produce(state, (draft) => { | ||
draft.fullscreenLoader = action.payload; | ||
}); | ||
}, | ||
}, initialState); |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// // @flow | ||
// import base, { actionCreators, type Base } from '../base'; | ||
|
||
// describe('base', () => { | ||
// describe('reducer', () => { | ||
// // let state: Base = base(undefined, {}); | ||
// // it('SHOW_USER_MENU works', () => { | ||
// // state = base(state, actionCreators.showUserMenu()); | ||
// // expect(state.userMenu).tobe(true); | ||
// // }); | ||
// }); | ||
// }); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"folders": [ | ||
{ | ||
"path": "velog-backend" | ||
}, | ||
{ | ||
"path": "velog-frontend" | ||
} | ||
], | ||
"settings": {} | ||
} |