Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid appBarIconVisible calculation in Layout docs #1231

Closed
codeaid opened this issue Feb 9, 2017 · 2 comments
Closed

Invalid appBarIconVisible calculation in Layout docs #1231

codeaid opened this issue Feb 9, 2017 · 2 comments

Comments

@codeaid
Copy link
Contributor

codeaid commented Feb 9, 2017

Calculation of the appBarIconVisible variable in the Layout docs for Hiding icon in AppBar when permanentAt rule is active is off by one pixel.

It should be:

const appBarIconVisible = this.state.width <= breakpoints[permanentAt];

instead of

const appBarIconVisible = this.state.width < breakpoints[permanentAt];

Currently the icon disappears while the viewport is 1280px wide even though NavBar is not visible yet (only appears at 1281px). Without the fix the icon is only visible while the viewport is 1279px wide. Changing the comparison to <= fixes it.

Here's the change diff:

diff --git a/components/layout/readme.md b/components/layout/readme.md
index 3870a28..3ad0e66 100644
--- a/components/layout/readme.md
+++ b/components/layout/readme.md
@@ -264,7 +264,7 @@ class MyComponent extends React.Component {
 
   render() {
 +    const permanentAt = 'lg';
-+    const appBarIconVisible = this.state.width < breakpoints[permanentAt];
++    const appBarIconVisible = this.state.width <= breakpoints[permanentAt];
    
     return (
       <Layout>
@olegstepura
Copy link
Contributor

Good catch, the issue is confirmed!

@olegstepura
Copy link
Contributor

PR is ready

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants