What is the best method for arranging various react components in sync?

I am striving to achieve a specific style.

My current code looks like this:

<Box display="flex" flexDirection="row" alignItems="center" width={1}>
<Box flexGrow="1">
    <Typography variant="h6">
        {subscription.PlanName}
        <Box
            px={1}
            py={0.5}
            color={"primary.contrastText"}
            className={classes.success}
            display="flex"
            alignItems="center"
            justifyContent="space-between"
        >
            {subscription.Status}
        </Box>
    </Typography>
    <Typography variant="caption" component="div">Purchased on: <b>{moment(subscription.StartDate).format("DD-MM-YYYY")}</b></Typography>
    <Typography variant="caption" component="div">Expiring on: <b>{moment(subscription.EndDate).format("DD-MM-YYYY")}</b></Typography>
</Box>
<Box>
    <Button
        variant="outlined"
        color="primary"
        onClick={Actions.openBillingDrawer}>
        UPDATE CREDITS
    </Button>
</Box>
<Box>
    <Button
        variant="contained"
        color="primary"
        onClick={Actions.openBillingDrawer}>
        UPGRADE PLAN
    </Button>

Additionally, I would like a different style for the UPDATE CREDITS button. Please provide the correct button styling for that as well.

Answer №1

While this may not be precisely what you were aiming for, it serves as a solid starting point. Your layout features the correct division of boxes, appropriate sizing of the green box, and an iconButton:

<Box
  display="flex"
  flexDirection="row"
  alignItems="center"
  width={1}
  justifyContent="space-between"
>
  <Box>
    <Box display="flex" alignItems="flex-end" margin="5px 0">
      <Typography variant="h4" style={{ lineHeight: "0.8" }}>
        Basic Plan
      </Typography>
      <Box
        color="primary.contrastText"
        bgcolor="success.main"
        fontSize="8px"
        padding="2px 4px"
        marginLeft="6px"
      >
        ACTIVE
      </Box>
    </Box>
    <Typography variant="caption" component="div" color="textSecondary">
      Purchased on: <b>01-01-2020</b>
    </Typography>
    <Typography variant="caption" component="div" color="textSecondary">
      Expiring on: <b>02-02-2020</b>
    </Typography>
  </Box>
  <Box>
    <Button
      variant="outlined"
      color="primary"
      endIcon={<ArrowDropDownIcon />}
    >
      UPDATE CREDITS
    </Button>
    <Button variant="contained" color="primary">
      UPGRADE PLAN
    </Button>
  </Box>
</Box>

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

Ways to halt a script entirely once its tag has been eliminated

I have a script from a page tracker website that runs periodically. Occasionally I need to restart the script from the beginning. To do this, I typically remove the script tag from the DOM and then re-append it. However, because the script utilizes setInt ...

Global Reject in Redux Toolkit allows you to reject or handle errors

Working with Redux Toolkit and managing multiple slices, there is one specific slice called sessionSlice. This slice includes various extraReducers that import thunks from other slices as shown below: [fetchDashboardUserReq.rejected]: (state, ...

A commonly used method to adjust the width of a table column to accommodate the size of the child element

I have a specific table width of 776 pixels with three columns. The third column has a fixed width of 216 pixels, but the widths of the other two are unknown. I want the second column to adjust its width based on its content, and whatever space is left aft ...

Setting the maximum height for a tr or td element that is compatible with Chrome

Is there a way to set the max-height for a tr or td element that is specifically supported in Chrome? Previously, an answer suggested at this link did not work for Chrome: How to fix height of TR? ...

Display a customized modal showcasing the data of a particular user

Seeking advice on how to pass data to a modal based on a specific user. I have an array with user information and would like to display their name and email in a modal when the user is clicked on. Any suggestions on how to accomplish this? ...

How to visually represent options without labels using icons in Material UI Autocomplete

My options are structured as follows: const options = ['option1', 'option2']; I am looking to display the options with icons like this: https://i.stack.imgur.com/aubHS.png The current code for rendering options looks like this: ...

Using a specialized component to trigger the opening of a Material UI dialog

I have a requirement where I need to pass a custom component to an MUI Dialog so that the Dialog can open itself and render its children. const CustomDialog = ({children, someCustomComponent}) => { const handleClickOpen = () => { setOpen(true); } ...

The content on my HTML webpage exceeds the width of the screen on mobile devices and certain PCs

I've exhausted most of the solutions available online, yet I haven't been able to resolve the issue. The content on my webpage is appearing wider than the screen size on mobile devices and some PCs URL: html, body,{ max-width: 100%; ...

Ways to stop Next JS 13 from automatically preloading pages

While using my app that is connected to Firebase, I have noticed that each time a page loads, my usage count exceeds due to the Next JS preloading feature. This unexpected increase in cost is concerning. How can I prevent Next JS 13 from preloading? I susp ...

How to implement a Django block for loading CSS files

I have multiple pages and I need to load unique CSS for each page. I am using this method for all static files. In the head of my index.html file, I have the following code: {% block css %} {% endblock %} However, in my contact.html file, I have the fol ...

Tips for inserting a footer at the bottom of every page during the conversion process from HTML to PDF

Could use some assistance with converting HTML into a PDF report. In particular, I want the footer to always appear at the bottom of the last page, even if there is minimal content on that page. Any suggestions? I've been utilizing the wkhtmltopdf to ...

The authentication process of OAuth2 in React is malfunctioning whenever a request is being dispatched

Trying to implement social authentication for my React site using Django Rest Framework (DRF) on the server side. I opted for the react-oauth2/google library instead of the deprecated react-google-login npm package. The issue I encountered is that react-go ...

Navbar tab toggle with HeadlessUI

Currently, I have implemented a Tabs-Section using headlessui. Within my Navbar, there are Links/Buttons corresponding to each Tab. However, I am encountering an issue in controlling the Tabs using the buttons/links within the Navbar. The Tabs are also bei ...

Which elements should I focus on when utilizing Media Query?

For the width specified in the CSS for various tags within my HTML, do I need to individually list each tag when setting CSS for a Media Query? If so, how can I do this while maintaining the same ratio for full screen? <!DOCTYPE html PUBLIC "-//W3C//DT ...

having trouble loading marker in react leaflet within next.js

I am facing difficulty in implementing react leaflet Marker in my next.js project. Below is the code snippet where I have included my map component: const MapSearch = dynamic(import('../../components/Map'), { ssr: false, loading: () => ( ...

How to handle multiple query strings in React Router Version 4

Is there a way to concatenate multiple query strings using React Router v4? I have been searching for a solution but cannot find one anywhere. Currently, I can only achieve www.example.com/products?sort=newest or www.example.com/products?page=1 What I am ...

What is the best way to showcase React Components in a inline format?

I'm attempting to place multiple React Components in the same line so that I can scroll through them later. Unfortunately, React and Material UI are not cooperating. The Card Components consist of a standard div element with text and an image inside. ...

Ways to Implement Horizontal Scrolling in Dojo FilteringSelect Component

The select field on my form contains option values that are over 250 characters long, making it difficult for users to read them within the select box. Is there a solution to make the select field scroll horizontally or wrap the lengthy text? ...

Leveraging the power of a local environment to conduct sanity checks on

Encountered an error: Uncaught error: Can't find variable: process http://localhost:3333/sanity.config.ts:5:26 The issue lies within the .env.local file. I discovered this when manually inputting my project ID into the sanity config file. Howeve ...

The error encountered is: "Unable to modify the 'x' property as it is readonly for the '[object Array]' object."

I've attempted various methods to modify this problem, regardless of how it's explained on different Stack Overflow threads. I am faced with an obstacle where I have an array composed of objects, and my goal is to iterate through the array and mo ...