styled components media query lessthan small code example
Example 1: 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
}
`}
`;
Example 2: media queries in styled components
export const device = {
mobileS: `(min-width: ${size.mobileS})`,
mobileM: `(min-width: ${size.mobileM})`,
mobileL: `(min-width: ${size.mobileL})`,
tablet: `(min-width: ${size.tablet})`,
laptop: `(min-width: ${size.laptop})`,
laptopL: `(min-width: ${size.laptopL})`,
desktop: `(min-width: ${size.desktop})`,
desktopL: `(min-width: ${size.desktop})`
};