//devices.js const size = { mobile: '425px', tablet: '768px', laptop: '1024px', laptopL: '1440px', desktop: '2560px', }; const device = { mobile: `(min-width: ${size.mobile})`, 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})`, }; export default device; //How to implement to the other files: import styled from 'styled-components'; import device from './device'; const Page = styled.div` margin: auto; font-family: "sans-serif"; text-align: center; @media ${device.laptop} { max-width: 800px; } @media ${device.desktop} { max-width: 1400px; } `;
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter