styled components media queries not working code example
Example 1: define a media query in styled components
const CardWrapper = styled.div`
display: flex;
flex-direction: row;
@media (max-width: 768px) {
flex-direction: column;
}
`;
Example 2: conditional styled components with media query
import styled, { css } from 'styled-components'
const YourComponent = styled.div`
//...
${props => props.isFirstPage && css`
@media only screen and (max-width: 480px) {
padding: 8px 8px 24px 8px
}
`}
`;