Home > Enterprise >  how to import values to styled components from another file
how to import values to styled components from another file

Time:04-15

Im trying to pass a value imported from another file to my styled component , but i get notification from my editor that the syntax is wrong , whats the correct way of writing this or how i can pass the value for the background color to this component?

import { Colors } from "../theme/Theme";

const FootergEl = styled.div`
  position: relative;
  height: 482px;
  width: 100vw;
  margin-top: 196px;
  background-color: `${Colors.Brand.BGFooter}`;
`;

CodePudding user response:

the correct way do this is as below

import { Colors } from "../theme/Theme";

const FootergEl = styled.div`
position: relative;
height: 482px;
width: 100vw;
margin-top: 196px;
background-color: ${()=>Colors.Brand.BGFooter};`;
;
  • Related