-
Notifications
You must be signed in to change notification settings - Fork 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
Gatsby V2 upgrade #8
Conversation
Have also added a couple of scripts copied from the official Gatsby starter, which run ESLint and Prettier. |
Hey @thetre97, thanks so much for this PR! I'm just getting back into work after several weeks attending to a family medical emergency. I won't be able to review this straight away, but hopefully I can get to it soon. Thanks! |
No problem @bradfrost - I'm sorry to hear that, I hope everything is okay. |
@thetre97 Did you ever figure this out? I've been wrestling with it for days. |
@jcameronjeff I'm afraid not - I couldn't get it to work either. |
src/components/PrimaryNavItem.js
Outdated
|
||
export class PrimaryNavItem extends Component { | ||
constructor(props) { | ||
super(props) | ||
this.state = { isNavOn: true } |
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.state = { isNavOn: !window.location.pathname.includes(props.href)}
src/components/PrimarySubNavItem.js
Outdated
|
||
export class PrimarySubNavItem extends Component { | ||
constructor(props) { | ||
super(props) | ||
this.state = { isSubNavOn: true } |
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.state = { isSubNavOn: !window.location.pathname.includes(props.url) }
@jcameronjeff @thetre97 |
Thanks @jess-mann - that works great. Have pushed those changes. |
Hey @thetre97 and @jess-mann! Thanks so much for the work on this. I was able to pull down the changes and run However, running
I'm not exactly sure why |
I believe it because Node doesn't have access to the typeof window !== 'undefined' ? !window.location.pathname.includes(props.href) : false |
Nice! I just checked and everything builds and looks great. Thanks again for all of this work! |
I believe It should also fix some of the currently open issues? |
Updated to use Gatsby V2.
This also fixes a number of issues, such as module imports, using sass (gatsby now directly imports the style.scss using the gatsby sass plugin) and has added unique keys (either using
index
, orpost.id
) to all.map()
methods.Have tested on my machine, and 'internally' everything works fine.
However, even though I have changed nothing on those components, the menus don't seem to stay expanded on page change anymore. Not sure what that would be?