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

Add guide for creating CxJS components #405

Closed
mstijak opened this issue Apr 4, 2018 · 5 comments · Fixed by #1160
Closed

Add guide for creating CxJS components #405

mstijak opened this issue Apr 4, 2018 · 5 comments · Fixed by #1160

Comments

@mstijak
Copy link
Member

mstijak commented Apr 4, 2018

Explain all steps for creating new CxJS components and associated concepts.

@chris77ve
Copy link

I would like to know how to create a new CxJS wrapper for react-leaflet just like cx-google-maps has been written for react-google-maps.

@chris77ve
Copy link

chris77ve commented Jan 4, 2019

Is there a way to create a CxJS component from Leaflet without having to write an entire wrapper for react-leaflet? I just want to insert a Leaflet map inside <cx> ... </cx>.

@mstijak
Copy link
Member Author

mstijak commented Jan 4, 2019

@chris77ve I was curious about Leaflet too, so I made a quick POC. You can see it here: https://codesandbox.io/s/zll15v2ozx

I couldn't make markers to render (relative paths), but it was relatively straightforward for circles.

Creating complex components is a tricky job which requires good understanding of framework internals and we need to address that much better in our documentation.

@chris77ve
Copy link

Thank you so much for your answer!
I managed to render the marker in my CxJS app, I just had to use url-loader in webpack.config.js like this:
...
module: {
loaders: [{
test: /.js$/,
//add here any ES6 based library
include: /\/[\/]/,
loader: 'babel-loader',
query: babelCfg
},
{
test: /.(jpe?g|png|gif|woff|woff2|eot|ttf|svg)(?[a-z0-9=.]+)?$/,
loader: 'url-loader?limit=100000'
}

    ]
}

...
...and put "import 'leaflet/dist/leaflet.css'" in my index.js.

But the marker's position is always the same regardless the coordinates I put as arguments (maybe the component is not complete), and its precise position varies as the zoom level changes.

@mstijak
Copy link
Member Author

mstijak commented Jan 4, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Pending review
Development

Successfully merging a pull request may close this issue.

2 participants