I have a navbar component that I have created using Styled Components. I would like to create some props that change the background-color and/or text color.
For instanc
Styled components also accepts a function where in you can read props. Moreover if you choose to pass a theme prop instead, you can also define an object for your themes.
const themes = {
dark: css `
background: ${colors.dark};
color: ${colors.light};
`,
light: css`
background: ${colors.light};
color: ${colors.dark};
`
}
export const Navbar = styled.nav(({theme})=>`
width: 100%;
background: ${colors.light};
color: ${colors.dark};
... // rest of the css
${theme?themes[theme]:''}
`)