Struggling to resize tables in React Material-UI

Here is my SandBox link for reference: https://codesandbox.io/embed/material-demo-j6pz9?fontsize=14&hidenavigation=1&theme=dark

I am attempting to organize content within a card using an inline grid display to have them appear side by side. I understand that the Card component in Material-UI is responsive, adjusting its size based on the content provided.

In order to make the table smaller and have the card shrink accordingly, I tried setting the table's width and height to 30%. While the table shrinks, it creates a large margin, resulting in the card size remaining unchanged.

https://i.sstatic.net/Szicj.png

The complete code can be accessed in the sandbox. I believe the issue lies in the following section:

const useStyles = makeStyles({
  card: {
    display: "inline-grid",
    borderRadius: "1em",
    boxShadow: "1.4 1.4 #182026",
    "&:hover": {
      boxShadow: "1 1 #182026"
    },
    margin: "1em 0",
    marginRight: "1em"
  },
  table: {
    width: "30%",
    height: "30%"
  }
});

I would appreciate any assistance on this matter. Thank you.

Answer №1

Don't forget to wrap one of the tables in a Card element and assign the card class to the other.

case "interface":
      return <Card className={classes.card}>{renderTable(scaleObj[type][obj], obj)}</Card>;
case "ccc":
      return <Card className={classes.card}>{renderBFD(scaleObj[type][obj])}</Card>;

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Having trouble sending a POST request from my React frontend to the Node.js backend

My node.js portfolio page features a simple contact form that sends emails using the Sendgrid API. The details for the API request are stored in sendgridObj, which is then sent to my server at server.js via a POST request when the contact form is submitted ...

What are the steps to modify the "text" displayed on a button in a kendo grid?

How can I change the default button text "add new record" on my kendo grid? I attempted to modify it using the following code, but it did not work: #turbinegrid .k-icon.k-add::after { content: "ADD"; } ...

What can be done to prevent an app from crashing when the device's font scale is adjusted?

As a newcomer to React Native, I have been facing a challenge with preventing my app from crashing when the system font scaling increases. Despite browsing through various answers across different platforms, I am yet to find a suitable solution. Can anyone ...

What causes Firefox's CPU to spike to 100% when a slideshow begins that adjusts the width and left coordinates of certain divs?

Seeking Advice I'm in need of some help with identifying whether the code I'm working on is causing high CPU usage in Firefox or if it's a bug inherent to the browser itself. The situation is getting frustrating, and I've run out of so ...

What is the method for obtaining a unique id that changes dynamically?

Having trouble accessing the dynamically generated ID in jQuery? It seems to work fine in JavaScript but not in jQuery. Here's an example of the issue: My jQuery code: var img = $("#MAP"+current_img_height); $("#map").css({'height': img.h ...

Removing the Arrow on a Number Input Field Using Tailwind CSS

Is there a way to remove the default increment/decrement arrows that come with an input of type number using Tailwind CSS? I've searched for a solution but haven't found one yet. input type="number" placeholder="Phone number" className="border ...

In ReactJS, unable to access the response object directly within the setState method

Having an issue updating the setSet as part of the output from my RestAPI. I keep getting an error stating that the response object is undefined. Strangely enough, I am able to log it outside of the setState method. Code addNewTodo = () => { axios.pos ...

Customizing your buttons in Wordpress with extra CSS styles upon clicking

I am in the process of developing a Wordpress website and I require a button for switching between mobile and desktop versions manually. Within my .css file, I have included: @media (pointer:coarse) {} This adds modifications for the mobile version ...

Creating custom shortcuts with Storybook possible?

I have been attempting to create aliases for the storybook, but despite searching for a solution on the website, I still can't seem to get it to work. The existing aliases in my original webpack.config.js file are not being cached, and I'm encoun ...

Ignore the initial children of the highest level divs exclusively

Is there a way to apply a style to all top-level divs within a div, excluding the first one? I have tried using not(:first-child) but it seems to be recursive. How can this be achieved? <div class='want-to-skip-first-a'> <div class= ...

Reactjs error: Invariant Violation - Two different nodes with the matching `data-reactid` of .0.5

I recently encountered a problem while working with Reactjs and the "contentEditable" or "edit" mode of html5. <div contenteditable="true"> <p data-reactid=".0.5">Reactjs</p> </div> Whenever I press Enter or Shift Enter to create ...

Is it possible to disable the save option on a PDF popup window?

When displaying a PDF using an embed tag, I have managed to disable print and content copying through document properties. However, I am struggling to find a solution to disable the save option that pops up. Is there a way to achieve this using JavaScrip ...

Issue concerning the implementation of <Routes>, <Route> and <Navigate> in react-router-dom version 6

I'm feeling a bit lost when it comes to the new usage of react-router-dom v6. According to their documentation, we should be able to simply place our Route component inside the element prop, but I keep encountering this error Uncaught TypeError: meta. ...

Using Bootstrap's card component, design a grid layout for your website

I am attempting to construct a grid using the Bootstrap 4 card component. After reviewing the documentation and utilizing the card-deck feature, I aim to have each row consist of two columns with the behavior similar to col-12 col-md-6. Additionally, the s ...

Alerts appear immediately upon beginning to type, asking for 8 characters and ensuring both passwords match

Is it possible to notify users that both passwords should match and they need to enter at least 8 characters after typing? There is currently an issue where a notification appears for entering less than 8 characters, but the password reset still proceeds ...

"Enhance your React application with react-router-dom by including parameters in the index URL while also

Here is the code I am currently using: <Router history={history}> <div> <Route exact path="/:id?" component={Container1} /> <Route path="/component2/ component={Container2} /> </div> </Router> When accessin ...

Firefox 3.5: The Notorious Code Copycat

Encountering an issue in Firefox 3.5.2 where after clicking a link on the page and then returning using the back button or another link, extra HTML code appears. Unsure if it's added by Firefox or related to PHP code. Unfortunately, unable to share t ...

What is the best way to style a component within the MuiThemeProvider tag?

Currently, I am in the process of setting up the AppBar by referring to the component demo: The Navbar component structure is as follows: const styleSheet = createStyleSheet('Navbar', {}); function Navbar(props) { return ( <div> ...

The compatibility issue between Tailwind CSS and Material UI has been identified in the latest version of Next, version 14.0

Currently, I am working with Next 14.0.2 alongside Material UI and Tailwind CSS for my Frontend development tasks. However, I've run into some challenges regarding styling components. One specific issue I faced was when setting a button to navigate to ...

Disabling font-awesome checkboxes

As someone who is new to front-end technologies, I am trying to achieve the following. Despite my efforts to find a solution, I have not been successful so far. Here is the issue I am facing-- I have two master checkboxes labeled 1) I do not like numbers ...