I made a component and a module.css because it has got inputs with specific CSS style compared to the rest of the inputs of my projects.
This is why I have inputs style in the global CSS for all the inputs expect these in my component.
I have made several components with module.css and so far, it is all working fine but for this specific component, I don't know why, the module.css is not applying, instead it is the global CSS.
My component:
import React, { useState } from "react";
import style from "./searchBar.module.css";
const SearchBar = () => {
const [city, setCity] = useState("");
return (
<form className={style.searchBar}>
<div>
<label>Ville</label>
<input
type="text"
name="city"
placeholder="Où veux-tu jouer?"
value={city}
onChange={(e) => {
setCity(e.target.value);
}}
/>
</div>
<div>
<label>Sport</label>
<input />
</div>
<div>
<label>Nom</label>
<input />
</div>
<div>
<label>Type</label>
<select></select>
</div>
<button>Rechercher</button>
</form>
);
};
export default SearchBar;
The CSS module:
.searchBar {
margin: 0 auto;
border: 1px solid var(--grey);
width: 74.37%; /* 937px; */
height: 14.91%; /* 72px; */
background-color: #fff;
border-radius: 42px;
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
padding: 8px;
}
.searchBar input {
width: 100px;
height: 50px;
}
On the following screenshot you can see that the global CSS has been applied instead of the module.css. What am I missing or doing wrong?
