Removing the Shadow from Material UI's Dialog Box

I am currently struggling with the Material UI dialog component that displays information about a location marker. My issue is with disabling the unattractive box shadow that surrounds the component. Despite setting box-shadow: none and trying different solutions, I can't seem to make it work!

Screenshothttps://i.stack.imgur.com/pGipa.jpg

Below is the code for this particular component:

const useStyles = makeStyles({
  root: {
    maxWidth: '400px',
    marginLeft: '5px',
    width: '446px',
    height: '200px',
    marginTop: '50px',
    overflow: 'hidden',
    boxShadow: 'none',
  },
  closeButton: {
    color: Colours.Black,
    float: 'right',
    paddingTop: '15px',
    marginRight: '5px',
    marginLeft: 'auto',
    height: '24px',
    width: '24px',
  },
  flexContainerContent: {
    display: 'flex',
    justifyContent: 'space-between',
    paddingRight: '10px',
  },
  flexContainerButtons: {
    display: 'flex',
    justifyContent: 'space-between',
    padding: '0px 18px 15px 18px',
  },
});

const InfoWindow = ({
  title,
  address,
  open,
  handleClose,
}: {
  title: string;
  address: string;
  open: boolean;
  handleClose: () => void;
}) => {
  const infoStyles = useStyles();
  
  return (
    <Dialog
      classes={{ root: infoStyles.root }}
      open={open}
      onClose={handleClose}
      hideBackdrop
      disableEnforceFocus
    >
      <Container classes={{ root: infoStyles.flexContainerContent }}>
        <DialogContent style={{ overflow: 'hidden', paddingLeft: '0px', boxShadow: 'none' }}>
          <Typography variant="body1" color="textSecondary">
            Name:
            <span
              style={{ display: 'inline', color: Colours.Black }}
              color="textPrimary"
            >
              {` ${title} `}
            </span>
          </Typography>
          <Typography variant="body1" color="textSecondary">
            Location:
            <span
              style={{ display: 'inline', color: Colours.Black }}
              color="textPrimary"
            >
              {` ${address} `}
            </span>
          </Typography>
        </DialogContent>
        <CloseIcon
          onClick={handleClose}
          classes={{ root: infoStyles.closeButton }}
        />
      </Container>
      <DialogActions style={{ padding: '0px', boxShadow: 'none' }}>
        <Container classes={{ root: infoStyles.flexContainerButtons }}>
          <Button size="small" style={{ color: Colours.Danger }}>
            Delete
          </Button>
          <Button size="small" style={{ color: Colours.Secondary }}>
            Edit
          </Button>
        </Container>
      </DialogActions>
    </Dialog>
  );
};

export default InfoWindow;

If you have any advice or suggestions on how to resolve this issue, your help would be greatly appreciated!

Answer №1

To focus on the Paper element within the Dialog, apply the following CSS snippet:

.MuiDialog-container .MuiPaper-root {
    box-shadow: none;
}

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

Unlimited Cycle using Vue Router Global Precautionary Measures

Currently, I am facing an issue with redirecting users using Firebase Auth and Vue Router. The problem arises when the Router redirects the user to '/' as it results in a blank white screen on the website. I am aware that there is an error in m ...

What could be improved in this Angular script?

angular.module('events.services', []) .factory('EventService', function($http, $cordovaSQLite) { return { fetchData: function() { return 'Data fetched successfully!'; } ...

How can you use a single parameter in a JavaScript function to swap the values of two numbers

Here's the challenge I'm facing: I need to create a function that will output 5 when given a(0), and 0 when given a(5). a(0) = 5 a(5) = 0 It should look like this: Hint: Use the following function structure function A(num){} something ...

Is it better to manually input a list of select options in the user interface or retrieve them dynamically from the database in case of future changes?

Imagine designing a user interface that allows users to choose their favorite Pokemon from options like Bulbasaur, Squirtle, and Charmander. Within the database, there is a lookup table containing all possible choices: pokemon --- id name 1 Bulbasaur 2 ...

Dynamic Visualizations with D3.js: Live Charts for Real-Time

This is my first time using D3.js and I am attempting to create a basic sparkline graph. The graph should have time on the X-axis and numbers up to 1000 on the Y-axis. I have a web socket server that sends random numbers up to 1000 to clients. My goal is t ...

Exploring the method to retrieve data on the server side through Express when it is shared by the client within a put request

Here is the angular http put request I am working with: sendPutRequest(data) : Observable<any>{ return this.http.put("http://localhost:5050", data).pipe(map(this.handleData)); } After making this call, the server side method being invoked is ...

Dynamically uploading an HTML file using AJAX

My webpage has a feature that dynamically creates HTML with drop down elements. Additionally, there is a "create File" button on the page. The goal is for this button to trigger an AJAX POST request and upload the dynamic page created with drag and drops a ...

Incorporate the key as a prop within a Child Component in a React application

I am trying to display a list of elements in React, where the key of each element is used as an index in front of the item. However, when I try to access props.key, it just returns undefined. Does anyone have any suggestions on how to access the key proper ...

Highlighting text within ReactJS using Rasa NLU entities

Currently, I am working on a React application that retrieves data from the Rasa HTTP API and displays it. My goal is to tag the entities in a sentence. The code functions correctly for single-word entities but encounters issues with two-word entities (onl ...

Learning React - Troubleshooting issues with setState() not updating the counter in the state

As I begin my journey into the React world with a simple application, I find myself facing challenges with the setState() function. My goal is to update a counter in the state every time a button is clicked. However, I am encountering an issue where the co ...

Master the Art of Animating Letters in the DOM by Navigating Through Any Array of Characters

I am attempting to implement a typewriter effect animation where a new message is displayed and animated as I type into an input box. Initially, I tried using a global char variable to iterate through each element of the array. However, whenever I passed ...

Basic HTML Audio Player Featuring Several Customizable Variables

I have a unique API that manages music playback. Instead of playing audio in the browser, it is done through a Discord bot. Achievement Goal https://i.stack.imgur.com/w3WUJ.png Parameters: current: indicates the current position of the track (e.g. 2:3 ...

Uploading a Node.js Package to GitHub Packages - Issue ENEEDAUTH

Hello everyone, I am currently attempting to deploy my NPM package to GitHub packages using the following yaml configuration: # This workflow will run tests using node and then publish a package to GitHub Packages when a release is created # For m ...

Sleek side-to-side sliding - REACT THREE FIBER

I have been experimenting with creating a small horizontal scroll using react three fiber to eventually incorporate WebGL Distorsion effects on the elements. While I have managed to achieve it in a basic way, there are still areas that require enhancement: ...

SurveyJs Input component with additional feature

Currently working on a project using ReactJS and surveyjs. I am interested in incorporating an input element for capturing percentage values (%). I am curious if there is a solution for this: Integrating a bootstrap addon or similar feature with surveyjs ...

Implementing dynamic font color based on background color in reactJs

My container has a dynamic background that changes based on user input. I need to set the text color based on the background color. For example, if I set a black background for my container, I would like the text color to be white. I am building my app u ...

Set up Amplify to utilize a pre-existing Cognito token for authentication

I have a project where I am utilizing Amplify (JS) Storage to upload files to an S3 bucket. The setup is already completed and working smoothly, but now I need to add an extra layer of security by implementing a policy that restricts file uploads to only ...

When utilizing a JQuery plugin for sliders, Dart does not function in the same way that traditional JavaScript does

Starting out with Dart for Front-End development has been a bit challenging for me. I am trying to incorporate a JQuery plugin called FlexSlider using the Js-Interop Dart Library. However, it's not functioning as expected compared to pure JavaScript, ...

JavaScript's sequential addition of nested arrays

Having trouble adding together 4 nested arrays in JavaScript. The arrays are structured like this: x = [[Array1(9)], [Array2(9)], [Array3(9)], [Array4(9)]] I am looking to "zip" them together and add the values. For example, I want to add Array1[0] with c ...

Using React hooks to reset state in a reducer: step-by-step guide

event.js import React, { useEffect, useState } from 'react'; import { useDispatch, useSelector } from 'react-redux'; import { Link, useHistory } from 'react-router-dom'; import { addEvent } from '../actions/event'; ...