Skip to content

Instantly share code, notes, and snippets.

@drenther
Last active June 25, 2018 08:12
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 drenther/286eff05fd08fa8cfcbe8020456f6bc6 to your computer and use it in GitHub Desktop.
Save drenther/286eff05fd08fa8cfcbe8020456f6bc6 to your computer and use it in GitHub Desktop.
Media queries in styled-components
/* src/components/UserProfile.js */
.
.
.
/* line 44 */
const breakPoint = '600px';
.
.
.
/* line 53 - 65 */
const Details = styled.div`
width: 350px;
height: 200px;
display: row;
margin: 10px;
jusify-content: center;
align-items: flex-start;
color: black;
@media (max-width: ${breakPoint}) {
width: 280px;
}
`;
.
.
.
/* line 85 - 99 */
export default styled(UserProfile)`
padding: 10px;
margin: 40px 0;
display: flex;
position: relative;
background: ${getColor('secondary')};
border-radius: 5px;
box-sizing: border-box;
@media (max-width: ${breakPoint}) {
flex-direction: column;
justify-content: center;
align-items: center;
}
`;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment