Created
December 28, 2016 16:09
-
-
Save inxilpro/862d1aacbeff0871e07d9661393edd3b to your computer and use it in GitHub Desktop.
General thoughts
This file contains hidden or 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
| @extends('layouts.app') | |
| <div id="app"></div> | |
| <noscript>You must have JavaScript enabled to edit this page.</noscript> | |
| @push('non-blocking-scripts') | |
| <script> | |
| window.__STATE__ = {!! json_encode($state) !!}; | |
| </script> | |
| {!! js('cms') !!} | |
| @endpush |
This file contains hidden or 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
| import React from 'react'; | |
| const Cms = ({ fields }) => ( | |
| <div className="cms"> | |
| {fields.map((field) => React.createElement(field.componentName, field.props))} | |
| </div> | |
| ) | |
| export default Cms; |
This file contains hidden or 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
| <?php | |
| namespace App\Http\Controllers; | |
| use App\Http\Controllers\Controller; | |
| class CmsController extends Controller | |
| { | |
| public function index() | |
| { | |
| return view('cms', [ | |
| 'state' => [ | |
| 'fields' => [ | |
| // definition of fields | |
| ] | |
| ] | |
| ]); | |
| } | |
| } |
This file contains hidden or 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
| import React from 'react' | |
| import { render } from 'react-dom' | |
| import Cms from './cms.jsx'; | |
| const root = document.getElementById('app'); | |
| const { fields } = window.__STATE__; | |
| render(<Cms fields={fields} />, root); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment