show material-ui components in external window - reactjs

I'm attempting to open an external window and display React components inside of it. My implementation follows this article - https://medium.com/hackernoon/using-a-react-16-portal-to-do-something-cool-2a2d627b0202
Here's a gif of the problem - https://streamable.com/unfom
GitHub repo that reproduces the problem - https://github.com/sh3nan1gans/material-ui-external-window
I learned that I needed to use a custom JSS insertion point for the children of my external window so that any material-ui components would insert their styles into the external document.head instead of the original document. The problem with this is that when the external window is closed the material-ui components aren't styled correctly and components that use portals (i.e., Menus) don't anchor correctly. It seems like I need to reset the insertion point once the external window is closed.

Was able to figure it out based on this example - https://codesandbox.io/s/308nkoz2xp
The piece that I was missing was passing a new Map() into the sheetsManager prop for the StylesProvider

Related

Render a custom label with background color in react-minimal-pie-chart (or any pie chart library)

I am trying to implement the following design:
However, I can't seem to find implementations of this kind of a background container anywhere in the React pie chart libraries I've found. I'm attempting to use react-minimal-pie-chart as they seemed to indicate the ability to render a React component as a custom label:
However, anything custom I do that isn't an svg element fails. Every example I've seen simply uses a <text> element and no background, and I'm not well-versed enough on svgs to see a parallel to divs with text inside. I see you can create a <rect> but not a way to plop some dynamic text inside.
Is there a way I'm missing to do this with this library? Or has anyone successfully implemented this with another pie chart library?

React Dropdown dynamic buttons with material UI

I am trying to copy the parts inside black circles on the image below for training React and Material UI. My problem is that I am struggling a bit with which Material UI components to use... Any help or examples that looks like this are happily accepted!
There are some components from material-ui for composing the UI like what you asked for. You need to compose these components by yourself.
For components inside the long black circle, they can be from selects https://mui.com/components/selects/. You can find different styles from this link.
For components inside another circle. They are buttons, text_fields, chips, and cards. Which can be found from
https://mui.com/components/buttons/ https://mui.com/components/text-fields/ https://mui.com/components/chips/ https://mui.com/components/cards/
Can't give an answer for the part of Minerva Obj Name without knowing how it is interacted.

DC.JS data-grid render React component

I'm working in a dashboard inside a React App and I used the React + DC.JS (https://github.com/LightTag/dcjs-in-react) as a guide. So far, so good.
Now I was required to add some new info in a component that used to be a dc.js dataTable so when the user click in a row, it would expand and show more data. My idea was to use the dataGrid instead and inject an material-ui ExpandPanel inside the HTML function of the dataGrid. Since the documentation says you can use any template engine inside it, I thought it would work.
Well, it doesn't work. I tried use an external function to the render the elements, explicit call React.createElement, put it inside parenthesis for the JSX, but all I got is a bunch of ''[object Object]''.
Any ideas of how to render React Elements inside a DC.js DataGrid?

Custom Cursor changing when hovering Child Compobent

I have a React App with a global custom cursor (not only a png changed in CSS, but a colored circle-div that‘s following the mouse).
My App consists of various child components (project teasers), when hovering those project teaser components the cursor component should change size, color and text content.
I have no experience with Redux so far, but do I need to store the cursor state in Redux for such a scenario or can I pass it down another way?
Thanks.
You can either use react context/redux or manually pass down the props each component. If you want study react context, here's a good article.

React-Leaflet React Component as Marker

I've recently gotten into React Leaflet and from what I've gathered from the docs, it is not possible to add a custom React Element (Component or pure functional) as a marker.
What I want to achieve is to be able to use my React Element which is an SVG icon as the marker. This would be useful because I'll need to display several different color icons and it's way more convenient to pass the color as props and let React create the marker.
Am I right in assuming this isn't possible?
You are incorrect! :) React-leaflet allows the creation of custom components. Also, you should check out react-leaflet-div-icon since it seems like it's exactly what you need.

Resources