Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@gavinsharp
Created January 15, 2020 01:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gavinsharp/0948b398661673134df4256ba010a0f1 to your computer and use it in GitHub Desktop.
Save gavinsharp/0948b398661673134df4256ba010a0f1 to your computer and use it in GitHub Desktop.
example of styling sub-component of a styled component
======== Modal.js
export const ModalContainer = styled.div`
...
width: ...
`
export default () => {
...
<ModalContainer>
...
</ModalContainer>
}
======== TourScheduling.js
import { ModalContainer } from '...';
const ModalStyleWrapper = styled.div`
${ModalContainer} {
@media(...) {
width: 1024px;
}
}
`
<ModalStyleWrapper>
<Modal>
....
</Modal>
</ModalStyleWrapper>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment