-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from bearsunday/skeleton
update UI skeleton
- Loading branch information
Showing
15 changed files
with
5,294 additions
and
17 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
File renamed without changes.
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,5 +1,5 @@ | ||
import configureStore from '../common/store/configureStore'; | ||
import App from '../common/components/App'; | ||
import configureStore from '../store/configureStore'; | ||
import App from '../components/App'; | ||
|
||
global.App = App; | ||
global.configureStore = configureStore; |
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,5 +1,5 @@ | ||
import configureStore from '../common/store/configureStore'; | ||
import App from '../common/components/App'; | ||
import configureStore from '../store/configureStore'; | ||
import App from '../components/App'; | ||
|
||
global.App = App; | ||
global.configureStore = configureStore; |
10 changes: 0 additions & 10 deletions
10
ui-skeleton/redux/ui/src/page/example/common/store/configureStore.js
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...e/example/common/containers/HelloWorld.js → ...src/page/example/containers/HelloWorld.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
File renamed without changes.
File renamed without changes.
23 changes: 23 additions & 0 deletions
23
ui-skeleton/redux/ui/src/page/example/store/configureStore.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { createStore, applyMiddleware, compose } from 'redux'; | ||
import thunkMiddleware from 'redux-thunk'; | ||
import createLogger from 'redux-logger'; | ||
import rootReducer from '../reducers'; | ||
|
||
export default function configureStore(preloadedState) { | ||
const store = createStore( | ||
rootReducer, | ||
preloadedState, | ||
compose( | ||
applyMiddleware(thunkMiddleware, createLogger()), | ||
window.devToolsExtension ? window.devToolsExtension() : f => f | ||
) | ||
); | ||
if (module.hot) { | ||
// Enable Webpack hot module replacement for reducers | ||
module.hot.accept('../reducers', () => { | ||
const nextReducer = require('../reducers').default; // eslint-disable-line global-require | ||
store.replaceReducer(nextReducer); | ||
}); | ||
} | ||
return store; | ||
} |
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 @@ | ||
<?php | ||
|
||
use BEAR\ReactJsModule\Ssr; | ||
|
||
/* @var $ssr Ssr */ | ||
list($markup, $script) = $ssr->render(['hello']); | ||
|
||
return <<<"EOT" | ||
<!doctype> | ||
<html> | ||
<head> | ||
<title>{$ssr->escape('title')}</title> | ||
</head> | ||
<body> | ||
<div id="root">{$markup}</div> | ||
<script src="build/react.bundle.js"></script> | ||
<script src="build/example.bundle.js"></script> | ||
<script>{$script}</script> | ||
</body> | ||
</html> | ||
EOT; |
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,39 @@ | ||
<?php | ||
|
||
use BEAR\ReactJsModule\ReduxModule; | ||
use Ray\Di\Injector; | ||
use BEAR\Resource\RenderInterface; | ||
use BEAR\Resource\ResourceObject; | ||
use Ray\Di\Di\Inject; | ||
use Ray\Di\Di\Named; | ||
|
||
require dirname(__DIR__, 4) . '/vendor/autoload.php'; | ||
|
||
class Index extends ResourceObject | ||
{ | ||
/** | ||
* @Inject | ||
* @Named("ssr_example") | ||
*/ | ||
public function setRenderer(RenderInterface $renderer) | ||
{ | ||
parent::setRenderer($renderer); | ||
} | ||
|
||
public $body = [ | ||
'title' => 'Greeting', | ||
'hello' => ['message' => 'Hello BEAR.Sunday'] | ||
]; | ||
|
||
public function onGet() | ||
{ | ||
return $this; | ||
} | ||
} | ||
|
||
|
||
$injector = new Injector(new ReduxModule(__DIR__ . '/dist', 'ssr_example')); | ||
$index = $injector->getInstance(Index::class); | ||
/* @var $index Index */ | ||
|
||
echo $index; |
Oops, something went wrong.