This repository has been archived by the owner on Oct 25, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace JS driven Breakpoint component with one using media queries
- Loading branch information
1 parent
96a8d03
commit 9a8d86b
Showing
3 changed files
with
49 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import React, { Component } from 'react' | ||
require('./breakpoints.css') | ||
|
||
class Breakpoint extends Component { | ||
render () { | ||
const { mobile, children } = this.props | ||
if (mobile) { | ||
return ( | ||
<div className="breakpoint-min-width-700"> | ||
{children} | ||
</div> | ||
) | ||
} else { | ||
return ( | ||
<div className="breakpoint-max-width-700"> | ||
{children} | ||
</div> | ||
) | ||
} | ||
} | ||
} | ||
|
||
Breakpoint.propTypes = { | ||
children: React.PropTypes.object, | ||
mobile: React.PropTypes.bool, | ||
} | ||
|
||
export default Breakpoint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
@media only screen and (min-width: 700px) { | ||
.breakpoint-min-width-700 { | ||
display: block; | ||
} | ||
.breakpoint-max-width-700 { | ||
display: none; | ||
} | ||
} | ||
@media only screen and (max-width: 700px) { | ||
.breakpoint-min-width-700 { | ||
display: none; | ||
} | ||
.breakpoint-max-width-700 { | ||
display: block; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters