Utilize a Material UI GridList to transform images into a captivating background display

Incorporating a GridList displaying a variety of images fetched from an external source, I have successfully created an ever-changing image gallery. Now, my goal is to convert this dynamic image gallery into grayscale or transparency and utilize it as a backdrop for overlaying content like text boxes and additional images on top.

Currently, here's the code snippet I have:

<GridList cols={3}>
{
this.state.images.map(image => (
      <GridListTile
        rows={1}
        ref={this.imageRef}
        key={image.id}
        style={{ padding: 0 }}
      >
        <img src={image.urls.regular} alt={image.alt_description} />
      </GridListTile>
    ))
}
</GridList>

Presently, my UI appears as shown in this screenshot: https://i.stack.imgur.com/yhSUS.jpg

An issue arises with the positioning of the Hello World text, which is displayed at the bottom left corner of the image. I aim to centralize this text and transform the GridList of images into a background that can either be transparent or rendered in grayscale.

The ultimate objective is to enable the addition of other Material UI components on top of the GridList of images, using the images as a background to support overlaying content.

Despite multiple attempts to incorporate z-index in the components, I have yet to achieve the desired result.

Answer №1

Make sure to place both the GridList and the text "Hello world" within the same Box container provided by material-ui. You can use the props of the Box container to center the text.

Give this a try:

<Box position="relative" >
    <GridList cols={3}>
    {
       this.state.images.map(image => (
          <GridListTile
            rows={1}
            ref={this.imageRef}
            key={image.id}
            style={{ padding: 0 }}
          >
            <img src={image.urls.regular} alt={image.alt_description} />
          </GridListTile>
        ))
    }
    </GridList>

    <Box position="absolute" top="50%" align="center" width="100%" zIndex={1}>
        <Typography>Hello World</Typography>
    </Box>

</Box>

This should guide you through it

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

Experiencing SyntaxError when utilizing rewire and mocha for Node.js testing. Unexpected token encountered

Trying to test a function exported from a nodejs file, I am utilizing q to manage promises. The function returns a promise that is either resolved or rejected internally through a callback. Within this callback, another function from a different location i ...

NextJS not displaying class name

Recently, I've been tackling the Login page project using next.js framework. I started implementing simple designs with react for some text elements, but unfortunately, they are not appearing on the browser. I suspect that they might not be properly ...

Is it possible to personalize/modify the dropdown menu text?

Is it feasible to adjust the positioning and font color of my drop-down menu text? I aim to have the "title" section in black text on the left side and the "type" section in gray text on the right side of the drop-down menu. Currently, all the text is in ...

What is the best way to gather user input and incorporate it into a selected template, ensuring it is verified before sending?

I'm in the process of developing a project that involves gathering user input through a collector and displaying it on my template for verification before sending it out. The format I'm aiming for can be seen here: This is the template format I ...

Tips for reversing a sketch: Creating a timer where the text continuously refreshes causing it to intersect

Currently, I am working on developing a stopwatch that is functional. However, I am facing an issue where the text overlaps itself when it changes due to repetitive drawing. Removing the strokeText and fillText from the interval prevents it from changing a ...

Creating a navigation bar that stays fixed at the top of

Hey there, currently I am utilizing a combination of jquery and css to affix my navigation menu at the top when scrolled. However, the problem is that my navigation menu is positioned beneath a div with a height set in viewport units (vh). The jquery scr ...

Is there a way to bring in a variable from the front end script?

Is it possible to transfer an array of data from one HTML file to another? If so, how can this be done? Consider the following scenario: First HTML file <script> let tmp = <%- result %>; let a = '' for (const i in tmp){ ...

Trouble with innerHTML in a for loop when using getJSON

My current challenge involves displaying a series of JSON results within a div tag using innerHTML. <script> $(document).ready(function() { var html2 = ''; var thread_id = ''; var created_thread_ids ...

What is causing the issue of my oversized images not showing up on GoDaddy?

I recently uploaded my website on GoDaddy and I am facing an issue where some of my small images (sizes: 872 × 546px) are displaying perfectly fine, but the large ones (banners with a size of 2700 × 900px) aren't showing up. Does anyone have ...

Issue with retrieving the value of a JavaScript dynamically generated object property

I'm currently working on a React Material-UI autocomplete component and facing challenges with accessing a Javascript Object property within a handleSelect function. Although I can retrieve the townname value using document.getElementById, I know thi ...

reloading a URL dynamically using an array in JavaScript

I need assistance with a Chrome extension code. The goal is to have it check the page that initially loads, and if it matches my website st.mywebsite.com, execute the specified code. Currently, it does not perform this check and runs on every loaded page ...

Testing the axios mock with a 400 response does not result in the expected value being returned

Currently, I am utilizing nock to simulate my ajax call with axios. Below is the code snippet that I am working with: describe("unSuccessful rest call",()=>{ it('should dispatch types: SET_DROP_DOWN_CHECK_STATUS in order ', () => ...

Nest a dictionary within a parent dictionary in a React component

Trying to work with a React component that includes a dictionary object (foo) holding another dictionary (bar) as its state. Desire to update the value of the inner dictionary but struggling on how to proceed: class App extends Component { state = { ...

Terminating a function during execution in JavaScript/TypeScript

Currently, I am in the process of developing a VSCODE extension using TypeScript. Within this extension, there is a particularly large function that is frequently called, but only the final call holds significance. As a solution, I am attempting to elimina ...

Material 15 provides a sleek and modern button design featuring both an icon and text

Here's a simple question - how can I create a button with both icon and text in material 15? <button mat-button> <mat-icon>keyboard_arrow_left</mat-icon> Back To Home </button> https://i.stack.imgur.com/Llhx1.png However, ...

Determine the Height of the Container once the Font File has Finished Loading

When styling a website with a unique font using @font-face, the browser must download the font file before it can display the text correctly, similar to how it downloads CSS and JavaScript files. This poses an issue in Chrome (v16.0.912.63) and Safari (v5 ...

Setting the offset for panResponder with hooks: A step-by-step guide

While exploring a code example showcasing the use of panResponder for drag and drop actions in react native, I encountered an issue with item positioning. You can experiment with the code on this snack: The problem arises when dropping the item in the des ...

Choosing a versatile model field in a Django CMS plugin

Currently, I am developing a Django CMS plugin that includes a model choice field dependent on another field in the form. To update the choices in the model choice field based on the trigger field selection, I am using AJAX. However, when submitting the fo ...

Storage can be shared globally in a React/Nextjs application

My current situation involves retrieving data through an application, however I am encountering 429 errors due to server limits restricting infinite requests. To address this issue, my plan is to fetch data nightly and store it in a centralized storage ac ...

HTML comment without the presence of javascript

Is it possible to use different expressions besides checking for the browser or version of IE in order to display/hide content? For example: <!--[if 1 == 0]--> This should be hidden <!--[endif]--> I am considering this option because I send o ...