Why is my grid not showing the elements properly in ReactJS and CSS?

Currently, I am working with ReactJS, GridCSS in the Gatsby framework. I am attempting to create a subgrid within a subcomponent of the Gatsby layout.js file. However, after setting up my grid, the subcomponent fails to display the component correctly in its designated position. Even when I try to view the grid on Firefox using a special Firefox plugin, it does not show up.

The footer component is imported from a file named footer.js. Typically, the footer consists of two columns for social media items and newsletter subscription form. Everything appears fine except for the footer grid which fails to display properly.

This is my layout.js:

<div >
    <div className={style.header}>
      <div className= {style.headbar}> 
        <div className={style.headerLeft}>
          <Logo className={style.logo} /> 

        </div>
        <div className={style.headerRight}>
          <Menu className={style.menu}/> 
        </div>
      </div>
     </div>
    <Chat/>

   <div className={style.children}>
    {children()} 
    </div>

    <div> 
    <Footer  className={style.footer} /> // everything is well display but not the footer, this is the footer grid which fails to display well

    </div>
  </div>

This is my layout.css:

.layout{ 
    width: 100%;
    margin:auto;
    text-align: justify;
    text-justify: inter-word;
    display : grid; 
    grid-template-areas:  
                "header   header"
                "children children"
                "footer   footer" ;             
}

{...}

.footer{ 
    height: 20em;
    width: 100vw; 
    grid-area: footer; 
    background-color: white; 
}

This is my footer.js (imported from footer.js):

export default () => {
  return (
    <div className={style.footer_grid}>
            <div className={style.social_media}>
             social media
            </div>
            <div className={style.newsletter_subscription}>
            subscriptionewsletter
            </div>
    </div>
  )
}

This is my footer.css :

.footer_grid{       
width: 100vw; 
display:grid;
grid-template-areas: 
    "footer_social_media  footer_newsletter_subscription";
grid-template-columns:  2.5fr 1fr; 
} 

.social_media{ 
grid-area: footer_social_media;
display : flex; 
justify-content: center; 
align-items: center
}

.newsletter_subscription{ 
grid-area: footer_newsletter_subscription; 
display : flex; 
justify-content: end; 
align-items: start;
}

Even though I have followed all the grid rules diligently, my grid refuses to display correctly. If anyone has any suggestions, it would be greatly appreciated. Thank you

Answer №1

The proper way to name your CSS module file in Gatsby is as follows: name.module.css

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

Installation of React has encountered an error and has been aborted. Please try running yarnpkg add --exact react react-dom react-scripts cra-template again

I am facing difficulties while trying to create npx create-react-app . ➤ YN0009: │ core-js@npm:2.6.11 could not be built successfully (exit code 1, check logs at: /C:/Users/acer/AppData/Local/Temp/logfile-10088VPjTiMAhqTi1.log) ➤ YN0009: │ fseven ...

Optimal Placement for FB.Event.subscribe

Here is the code I have implemented on my website for the Facebook Like and Share buttons. The functionality works seamlessly. When I click the Like button, a notification is promptly displayed on my Facebook profile page. Additionally, Facebook automatic ...

Unique float structure within a division of divs

Can divs be floated within another div like this? Here is the code: <div class="event_month"> <div class="event1">1</div> <div class="event2">2</div> <div class="event3">3</div> <div class="event4">4</di ...

Using Next.JS useRouter to access a dynamic route will result in receiving an empty object as the return value

I've encountered an issue with dynamic routing in my specialized calendar application built with Next.JS. One of my pages is working perfectly fine while the other is not functioning at all. The first page (working): // pages/date/[year]/[month]/[day ...

Issue with child rows not functioning properly in DataTables when utilizing Datetime-moment

I've successfully integrated this data into live.datatables.net and almost have it running smoothly. However, I am encountering an issue with displaying the last detail as a child element. The final part of the row should be shown with the label "Mes ...

`Changing the output of a jQuery .load function`

I've created a webpage that pulls content from an article, but I'm looking to display only the first 100 words of the article. Currently, my page successfully loads the article using this code: $(function(){ $('#startOfArticle').l ...

Is it possible to have setTimeOut() executed after the page has been redirected?

Why is it not possible to duplicate: The question was not addressed in the previous post. I have a link for deletion, which, when clicked, triggers a popup with a button. Upon clicking that button, the page inside the popup redirects to a new internal pag ...

Appending the desired URL to the existing URL using an Ajax callback

Ever since I started working on a Drupal 7 project, I have been facing an issue with making an ajax call back. The problem arises when the URL I intend to use for the callback gets appended to the current page the user is viewing. It's quite puzzling ...

Stop my ::after element from interfering with my select dropdown menu

Check out this JSFiddle I created to showcase my issue: JSFiddle I am currently working on a customized dropdown menu using an icomoon icon instead of a V. While the design looks great, the ::after pseudo-element for the parent container is causing issues ...

Confirm the session validity before invoking the web service function from an ajax function triggered by clicking a button

I am experiencing a complex issue. On a page, users input data and then click on a button to save all the parameters into a JSON object. After saving locally, they click another button which triggers an ajax method that calls a web service method on the sa ...

What is the best way to transform a current callback API into promises?

Exploring the transition to working with promises poses a challenge when dealing with callback APIs structured as follows: ###1. Handling DOM load or other one-time event: window.onload; // set to callback ... window.onload = function() { }; ###2. Utili ...

Dynamically select checkbox groups based on items already listed in a textarea

Hello! Would you be able to review this example and provide guidance on how I can use jQuery to dynamically select the checkboxes that have the same text as in the textarea below? <br /> <br /> Default Items From Database <br /> < ...

How to stop the mobile keyboard from hiding in JavaScript

On a webpage, I have an HTML setup with an editor and buttons positioned above the keyboard: ------------ |1| Hello | |2| World | | | | | | | ------------ |Tab|( ) [ | ------------ |qwertyuiop| | asdfghkl | | zxcvbnm | | [ ] | ------- ...

JavaScript GridView

Is there a way to determine if an ASP.NET GridView contains at least one row by using JavaScript? ...

issue with node callback function - code malfunctioning

I have written a script in Node.js and Express to send an email after a SQL transaction is successfully completed! router.post('/',function(req,res,next){ sql.connect(config).then(function() { var request = new sql.Request(); ...

AngularJS - smooth scrolling with $anchorScroll duration

While going through the AngularJS documentation, I have not been able to determine whether $anchorScroll has a duration or easing option for smoother scrolling to elements. The documentation only shows: $location.hash('bottom'); // call $ancho ...

Initiating the click event on a designated element

I'm working on a grid of team members represented by figures with figcaptions. I want to be able to trigger a click function only for the specific figure that has been clicked, rather than applying the function to all figures at once. Here is an exam ...

Ways to resolve the problem of connecting Provider with my store and efficiently transmitting data to components in my Redux-React application

Encountering an error that reads: Uncaught Error: Could not find "store" in either the context or props of "Connect(WebShop)". Either wrap the root component in a <Provider>, or explicitly pass "store" as a prop to "Connect(WebShop)". Despite havin ...

Toggle React like button

I am working on a component that displays the number of likes next to a 'like' button. I want to implement a functionality where clicking the button once adds to the number of likes, but if clicked again, it reverts back to the previous state. Th ...

Ways to modify a single attribute of an object without changing the others

I'm developing a note-taking application. When a user adds a note, they receive an empty text area component where they can input text and the date when the note was added. I am working on allowing users to update only the text of the note for editing ...