forked from libp2p/website
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Pull in contributors data at build time #9
Merged
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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 |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
} | ||
#contributors-slide { | ||
transform: translate3d(0,0,0); /* hint to prefer gpu rending. */ | ||
animation: slide 60s ease-in-out both 2s infinite alternate; | ||
animation: slide 60s ease-in-out both 0s infinite alternate; | ||
animation-play-state: paused; | ||
} | ||
#contributors-slide.running { | ||
|
@@ -32,14 +32,12 @@ | |
transform: scale(1.2); | ||
z-index: 10; | ||
} | ||
#contributors .hex.show:hover + .hex { | ||
} | ||
#contributors .contributors-row { | ||
height: 72px; | ||
overflow:visible; | ||
} | ||
#contributors .contributors-row:hover { | ||
z-index: 100; | ||
z-index: 20; | ||
} | ||
</style> | ||
|
||
|
@@ -75,15 +73,15 @@ | |
var containerElTop = containerEl.getBoundingClientRect().top | ||
var screenHeight = window.innerHeight | ||
var pageYOffset = window.pageYOffset | ||
var inView = (pageYOffset + screenHeight) > containerElTop | ||
var inView = (pageYOffset + screenHeight + 100) > containerElTop | ||
if (inView) { | ||
renderContributors(contributors) | ||
} else { | ||
window.addEventListener('scroll', isContributorsSectionInView) | ||
} | ||
|
||
function isContributorsSectionInView () { | ||
inView = (window.pageYOffset + screenHeight) > containerElTop | ||
inView = (window.pageYOffset + screenHeight + 100) > containerElTop | ||
if (inView) { | ||
renderContributors(contributors) | ||
window.removeEventListener('scroll', isContributorsSectionInView) | ||
|
@@ -103,21 +101,24 @@ | |
} | ||
}) | ||
var nextRow = 0 | ||
function renderWithPause(itemIndex, lastRender) { | ||
var lastRender = 0 | ||
function renderWithPause(itemIndex) { | ||
if (itemIndex >= data.length) return | ||
renderContributor(data[itemIndex], function (err, el) { | ||
var nextIndex = itemIndex + 1 | ||
if (err) renderWithPause(nextIndex) | ||
rows[nextRow].appendChild(el) | ||
setTimeout(function () { | ||
el.className = 'hex show' | ||
}, 10) | ||
nextIndex = itemIndex + 1 | ||
if (nextIndex === data.length) return // All done. | ||
nextRow = (nextRow + 1) % rows.length | ||
var now = Date.now() | ||
var diff = now - lastRender | ||
var delay = loadingDelayMs - diff | ||
if (delay < 0) delay = 0 | ||
lastRender = now | ||
nextRow = (nextRow + 1) % rows.length | ||
setTimeout(function () { | ||
renderWithPause(itemIndex + 1, now) | ||
renderWithPause(itemIndex + 1) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. use |
||
}, delay) | ||
}) | ||
} | ||
|
@@ -139,6 +140,9 @@ | |
link.style.backgroundSize = 'cover' | ||
cb(null, link) | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If the image fails to load you halt the animation I think. You need an |
||
img.onerror = function (evt) { | ||
cb(evt, link) | ||
} | ||
img.src = item.photo | ||
} | ||
})() | ||
|
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.
Should this
return renderWIthPause(/* ... */)
here?