Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

React Integration in Drupal Page #11

Closed
p-a-s-c-a-l opened this issue Sep 10, 2018 · 4 comments
Closed

React Integration in Drupal Page #11

p-a-s-c-a-l opened this issue Sep 10, 2018 · 4 comments
Assignees
Labels
BB: UI Integration Platform UI Integration Platform Building Block enhancement New feature or request

Comments

@p-a-s-c-a-l
Copy link
Member

p-a-s-c-a-l commented Sep 10, 2018

@fgeyer16 idea to be defined "create react field of group entity" = entry point for react applications

@therter
Copy link
Contributor

therter commented Oct 5, 2018

Integrate a react-app
The module React Mount Node is used to add a react app to the drupal system. Therefore the react app will be packed into a js file (e.g. with webpack) and added as a library to a drupal theme.

Example to add a library to the bartik theme
Add the following code to the end of the bartik.libraries.yml file:

react-app:
  css:
    component:
     css/leaflet.css: {}
  js:
    js/bundle.js: {}

This library can be referenced by the react-mount module.

react-mount

The react objects can be bound to the window variable and easily invoked from the docker page.

Example:

<script type="text/javascript">
  function go(la, ln) {
    //mapComp is the react object
    window.mapComp.setView(la, ln, 8);
  }
</script>
<input onclick="go(48.858093, 2.294694)" style="margin-right: 20px;" type="button" value="Paris" />
<input onclick="go(51.509865, -0.118092)" type="button" value="London" />

@p-a-s-c-a-l
Copy link
Member Author

If the react apps need to reside in a subfolder of the csis-theme, then we might run in to problems if we want to use dedicated git repositories for our react apps. See also #25

@p-a-s-c-a-l
Copy link
Member Author

@therter According to the React Mount Node documentation, you can place the react app in the libraries folder of the theme or in the general /libraries folder. Please check also the Best practices for handling external libraries in Drupal 8.

@p-a-s-c-a-l
Copy link
Member Author

done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BB: UI Integration Platform UI Integration Platform Building Block enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants