This repository was archived by the owner on Dec 28, 2023. It is now read-only.
forked from Medium/snowflake
-
Notifications
You must be signed in to change notification settings - Fork 2
Community track for the win! #11
Open
rlopes
wants to merge
19
commits into
master
Choose a base branch
from
community-track
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
92479c1
KeyboardListener unmount
034b42d
Prettier update
66513d5
Started pulling out tracks from that massive constants.js dump
53eea09
Try to stick to the not so standard code style
e42294b
Try to stick to the not so standard code style - part 2
b4a00da
Try to stick to the not so standard code style - part 3
b71a289
KeyboardListener unmount
5b11dbe
Prettier update
472c79c
Started pulling out tracks from that massive constants.js dump
9ffe9ce
Try to stick to the not so standard code style
476f129
Try to stick to the not so standard code style - part 2
474d4cc
Try to stick to the not so standard code style - part 3
e2faf07
Rebase + merging
d239215
Removing dangling commas
0bfd329
That rebase lost some of text in RECRUITING. Restored.
168d22e
Reworded some texts and added lots of examples
4cbf6b2
Temporarily adding back the changes to the Community track in constan…
ceac45d
Removed X for clarity and fixed some grammar
e811899
Tried to change the point of view in the description
rlopes File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,7 @@ | ||
{ | ||
"trailingComma": "none", | ||
"tabWidth": 2, | ||
"printWidth": 120, | ||
"semi": true, | ||
"singleQuote": false | ||
} |
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 |
---|---|---|
@@ -1,48 +1,50 @@ | ||
// @flow | ||
|
||
import React from 'react' | ||
import React from "react"; | ||
|
||
type Props = { | ||
increaseFocusedMilestoneFn: () => void, | ||
selectNextTrackFn: () => void, | ||
decreaseFocusedMilestoneFn: () => void, | ||
selectPrevTrackFn: () => void | ||
} | ||
}; | ||
|
||
class KeyboardListener extends React.Component<Props> { | ||
componentDidMount() { | ||
window.addEventListener('keydown', (e) => this.handleKeyDown(e)) // TK unlisten | ||
window.addEventListener("keydown", this.handleKeyDown); | ||
} | ||
|
||
componentWillUnmount() { | ||
window.removeEventListener("keydown", this.handleKeyDown); | ||
} | ||
|
||
handleKeyDown(e: KeyboardEvent) { | ||
if (document.activeElement && document.activeElement.tagName === 'INPUT') { | ||
if (document.activeElement && document.activeElement.tagName === "INPUT") { | ||
// Don't do shortcuts while input has focus. | ||
return | ||
return; | ||
} | ||
switch(e.code) { | ||
case 'ArrowUp': | ||
this.props.increaseFocusedMilestoneFn() | ||
e.preventDefault() | ||
break | ||
case 'ArrowRight': | ||
this.props.selectNextTrackFn() | ||
e.preventDefault() | ||
break | ||
case 'ArrowDown': | ||
this.props.decreaseFocusedMilestoneFn() | ||
e.preventDefault() | ||
break | ||
case 'ArrowLeft': | ||
this.props.selectPrevTrackFn() | ||
e.preventDefault() | ||
break | ||
switch (e.code) { | ||
case "ArrowUp": | ||
this.props.increaseFocusedMilestoneFn(); | ||
e.preventDefault(); | ||
break; | ||
case "ArrowRight": | ||
this.props.selectNextTrackFn(); | ||
e.preventDefault(); | ||
break; | ||
case "ArrowDown": | ||
this.props.decreaseFocusedMilestoneFn(); | ||
e.preventDefault(); | ||
break; | ||
case "ArrowLeft": | ||
this.props.selectPrevTrackFn(); | ||
e.preventDefault(); | ||
break; | ||
} | ||
} | ||
|
||
render() { | ||
return null | ||
return null; | ||
} | ||
|
||
} | ||
|
||
export default KeyboardListener | ||
export default KeyboardListener; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 neither consistent with the existing style nor our usual style at Vend 😉
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.
Yes I know this is the case. Since I have all my nice tooling set up to automatically format code, I tweaked that file to follow the current style in that specific Medium repo. They use different rules from us.
I am very keen though to create a PR that makes the entire repo. follow
standardjs
and no semicolons.