React Semantic UI Font - reactjs

I start to use the React Semantic UI library, but it's not so easy to customize elements.
I have a basic HTML header in y component that I want to set the Font to "Rubik"
So in my src/semantic-UI/site/globals/site.variables i added this line
#headerFont 'Rubik', I am not sure if it's the good way to do that, also I would to also edit the font-size, line-height, and font-weight?

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?

How to use Material UI Grid spacing prop properly in nested grids?

I am trying to create a Basic Layout with React using Material UI Grid component.
I am following official documentation but the spacing prop seems very confusing and there is very less information available or its unclear in documentation.
When i am trying to nest Grid to create the layout, the negative margins added by the spacing prop confusingly pulling the items and breaking the UI.
Below is the very simple Layout in trying to do
I finally managed to do it with some very complex nestings and custom styles using sx prop as shown below in the codesandbox.
https://codesandbox.io/s/materialgriddilemma-vheq19?file=/src/Layout.js
But I am wondering, for a simple use case as this do I really need to write custom styles?!!
What is the cleanest and recommended way to use Nested Grids in Material UI with Spacing ?

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.

Material-UI Box Component Import Order and Style Tag Generation

I'm using the Material-UI (Mui) Box component to save time. It works great most of the time, but I sometimes run into issues when the styling clashes with the default styling of other Mui components. For example, I'm using the Box component to override the default padding-right of the Mui Toolbar (see picture below).
The problem and my question lie in the way the style tags are generated from this code. The style tags generated by this Box component are being overridden by the style tags generated by the Toolbar component (see picture below).
Additionally, when I inspect these style tags the MuiBox tags are definitely inserted before the majority of the other style tags and they seem to be empty. (see pictures below).
I've read the docs over and over, and tried many things. The most promising thing I could find was in the documentation for the Box component:
⚠️ The CSS specificity relies on the import order. If you want the guarantee that the wrapped component's style will be overridden, you need to import the Box last.
I tried this but still have had no success (see image below).
I know there are several ways to get around this (e.g., makeStyles, withStyles, inline styles, !important), but these strategies make using the Box component somewhat pointless in many situations. So my question is how do I make the MuiBox style tags have the highest priority (inserted last) and why are they empty when I look at them in DevTools?

Bootstrap DropdownButton Styling

I have the following code:
header_contents.push(<DropdownButton bsSize='xsmall' bsStyle='link' pullRight={true} id={1} title='Menu'>
{item_menu}
</DropdownButton>);
I want to have the styling in Bootstrap to be white lettering (currently blue) as I think the link option is defaulted to that. How can you change the styling for Bootstrap to pass link color, and other properties like if you want to move the link down a little on the page?
I should mention we do very little CSS styling as most of that is done within the ReactJS components.
Either override bootstrap CSS in a css file (that is what your seem to avoid I understand): it is the better way to ensure a global effect over every link in your application.
Or do no sent bsStyle='link' as DropdownButton property but instead, insert a style property with custom CSS. Yet you can insert style even if you don't remove bsStyle. You could then create your own component wrapping DropdownButton to ensure the same graphic chart in your application.
I figured it out with the help of an online chat room. Here's what I did.
I first made a style (dropDownLinkStyle) in the react component like this.
let dropDownLinkStyle = {
color: 'white'
};
Then I used it (dropDownLinkStyle) in the dropdownButton like this.
header_contents.push(<DropdownButton bsSize='large' style={dropDownLinkStyle} bsStyle='link' pullRight={true} id={1 /* avoids react warning */} title='Menu'>
{item_menu}
</DropdownButton>);
I hope this helps. This allowed me to keep my bsStyle which is link (tells Bootstrap I want a link type on my screen instead of a button) and allows me to change that link to white lettering. I could also pass more styling by just adding it to the object -- dropDownLinkStyle

Resources