Styling Broken In Larger App
I'm attempting to utilize this library in an app and while I can get the nodes to render, the styling doesn't seem to be working correctly. If I include just the scss found in the app's src folder it looks like:
If I instead include the css file from dist I get what looks correct, but it also doesn't bound correctly:
In the second one I'm able to pull it left all the way onto my app's menu. This might be some weird interaction with my app's styling itself, but I'd like to confirm so before mucking with currently working css.
Additionally if the storm-diagrams-canvas canvas has position: relative on it, it flies off screen. Once again, possibly due to the css of my top and side menus.
Well, it's hard to tell without looking at your code. However, demo5 works fine for the similar scenario. There are a header and sidebar that shifts diagram, but it still works as expected. You can take a look
P.S: issue №100!
Glancing through demo5 gave me the inspiration to mess with my z-index. Setting the sidebar to z-index: 1000; made it appear over the drag-and-drop stuff. Still having issues w/ the svg background and panning though.
Dropping it in raw, styling is still broken. Should webpack be doing some auto-compiling for the styling? Are there a couple of scss files I should be grabbing?
There are few possible reasons of your broken layout:
- This library styles
- Your app styles
- Incorrect usage of library styles
I can't say which one of them without looking at your code. I believe it's 2 or 3, because demo works fine
What library style should I be using? If I utilize: https://github.com/projectstorm/react-diagrams/blob/master/src/sass.scss It doesn't show up at all. Is that the correct sass file?
@krishnaglick Im using the same sass file you just show(sass.scss) and its working fine. Just be careful you aren't using it as entry file on the config.I had the same problem and was because I was loading the sass file on the webpack entry point instead of just importing the sass file on the component where I was using the library. Also can mess up other css files that uses svg . Hope this helps.
Are you using a babel loader to import the scss into the JS file? Cause I've been converting it to css and serving it up.
Im using sass loader and importing it in like: import "../../styles.scss"; in my component
Importing it like that didn't change anything. I messed w/ the styles and it's mostly working except for a few minor things. Calling it good enough. Thanks for the help!
if anyone is still stuck with this, same thing happenned to me, what i did was look at the demos - they import test.scss which itself references sass.css which is under src. i just copied both into my component folder and referenced test to sass correctly then walla!