In my React project, I have a day/night theme button that changes the main body color in the App.scss
. It's a simple setup using body.light
and body.dark
. However, I need to also change the text color in the navigation bar, which is located in a different folder with Navbar.jsx
and Navbar.scss
. Since I can only edit the App.scss
file due to how the button is set up, I'm wondering how I can export or add the .site-nav
class from Navbar.scss
into my App.scss
so that I can include .site-nav.dark
and .site-nav.light
for it to function correctly.
I attempted renaming Navbar.scss
to _Navbar.scss
and using a mixin:
@mixin nav {
//code
.site-nav {
//code
}
}
Then I tried adding this to my App.scss
:
@use './Navbar/Navbar.scss' as Navi;
body.dark {
color: #a58c6f;
background-color: #1c221f;
@include Navi.site-nav;
}
But I received an error:
Invalid CSS after " @include Navi": expected "}", was ".site-nav;"
. Any suggestions on how to resolve this?