-
Notifications
You must be signed in to change notification settings - Fork 49.3k
Added responsive styles (redux) #25
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
Conversation
Thanks Martin! I'll take a look at this soon, we've just been following up with some other issues today. Not forgotten though :) |
width: auto; | ||
} | ||
.nav-docs { | ||
display: none; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the only behavior that's bugging me. Since this nav is important for getting around the docs, hiding it is a bummer. Can you do something else with it instead? (Maybe unfloat, and compact it a bit?)
Hi Paul, I’ll get on these two issues now. |
function classToggle(element, tclass) { | ||
var classes = element.className; | ||
var pattern = new RegExp(tclass); | ||
var hasClass = pattern.test(classes); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is actually a pretty naive implementation (eg. if the element had class="reallyopen"
it would not work right).
var classes = ' ' + element.className + ' ';
var hasClass = classes.indexOf(' ' + className + ' ') > -1
// then add/remove, trim, set
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see 😞
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you're attached to RegExps, you might be able to just use '\b' + tclass + '\b'
when constructing so it matches word boundaries.
The other thing we should do is actually set up listeners instead of hijacking window.onload
. We do this in our transform script so we should do that: https://github.com/facebook/react/blob/master/vendor/browser-transforms.js#L106-L110
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’m not particularly attached to RegExp; in fact JavaScript isn’t my main proficiency as you may see above! That class toggle function was just something I cobbled together without the comfort of jQuery.
I’ve pushed the style changes mentioned, and will look at improving the JavaScript for the responsive menu.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can't use word boundaries (\b
) for this since hyphens are valid in class names. You need something like new RegExp('(?:^|\\s)' + tclass + '(?:\\s|$)')
.
Hey @martinbean, I'm sorry we haven't made this work. We're actually working a on sizable redesign and I think it's going to be response from the start there (yea @jordwalke?), so I'm going to close this out and let it just happen there. I really appreciate you taking the time to give this a go though! |
Added responsive styles, such as making the menu collapsible and content columns fluid and collapsible at small widths.