Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from vrm-c/layout
ui: update layout
- Loading branch information
Showing
8 changed files
with
126 additions
and
18 deletions.
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
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
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
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
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,12 @@ | ||
import { PixivIcon } from '@charcoal-ui/icons'; | ||
import PlayAlt from './PlayAlt.svg'; | ||
|
||
PixivIcon.extend({ | ||
'24/PlayAlt': PlayAlt.src, | ||
}); | ||
|
||
declare module '@charcoal-ui/icons' { | ||
export interface KnownIconType { | ||
'24/PlayAlt': unknown, | ||
} | ||
} |
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
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,27 @@ | ||
import { DependencyList, useEffect, useRef } from 'react'; | ||
|
||
export function useAnimationFrame( | ||
callback: (delta: number) => void, | ||
deps: DependencyList | ||
): void { | ||
const refPrev = useRef<number>(0); | ||
|
||
useEffect(() => { | ||
let halt = false; | ||
const update = (): void => { | ||
if (halt) { return; } | ||
|
||
const now = Date.now(); | ||
callback(0.001 * (now - refPrev.current)); | ||
refPrev.current = now; | ||
|
||
requestAnimationFrame(update); | ||
}; | ||
update(); | ||
|
||
return () => { | ||
halt = true; | ||
}; | ||
// eslint-disable-next-line react-hooks/exhaustive-deps | ||
}, [ callback, ...deps ]); | ||
} |