I have created a Dropdown Component in React using Styled Components. Here is a simplified outline of the component:
const Dropdown = (
<DropdownBase>
<Trigger>
{title}
</Trigger>
<Submenu>
{children}
</Submenu>
</DropdownBase>
)
const DropdownBase = styled.div`
/* Default Styles */
`
const Trigger = styled(Link)`
/* Default Styles */
`
const Submenu = styled.div`
/* Default Styles */
`
Now, when I import and use the component I want to be able to override the default styles of the nested components (i.e., DropdownBase
, Trigger
and Submenu
). And I want to be able to override those default styles using Styled Components. The problem is, that I do not import those nested components -- I only import the Dropdown
component -- like this:
import { Dropdown } from '../path/to/dropdown'
<Dropdown />
So I am wondering, how can I override those nested components when I import the parent component using Styled Components?