mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-12 15:52:39 +02:00
refactor: better typing + remove unnecessary eslint-disable (#5335)
* Initial work Signed-off-by: Josh-Cena <sidachen2003@gmail.com> * Fix a few errors Signed-off-by: Josh-Cena <sidachen2003@gmail.com> * Restore default value Signed-off-by: Josh-Cena <sidachen2003@gmail.com> * Update docs Signed-off-by: Josh-Cena <sidachen2003@gmail.com> * Use custom route config Signed-off-by: Josh-Cena <sidachen2003@gmail.com> * Address a few suggestions Signed-off-by: Josh-Cena <sidachen2003@gmail.com> * Revert logo change Signed-off-by: Josh-Cena <sidachen2003@gmail.com> * Restore key Signed-off-by: Josh-Cena <sidachen2003@gmail.com> * Oops Signed-off-by: Josh-Cena <sidachen2003@gmail.com> * Remove use of any Signed-off-by: Josh-Cena <sidachen2003@gmail.com> * Remove eslint-disable Signed-off-by: Josh-Cena <sidachen2003@gmail.com> * Put type reference back Signed-off-by: Josh-Cena <sidachen2003@gmail.com> * Remove Signed-off-by: Josh-Cena <sidachen2003@gmail.com>
This commit is contained in:
parent
0c0c14120e
commit
ee6ebc4877
30 changed files with 127 additions and 122 deletions
|
@ -120,7 +120,7 @@ function useCollapseAnimation({
|
|||
|
||||
el.style.willChange = 'height';
|
||||
|
||||
function startAnimation(): () => void {
|
||||
function startAnimation() {
|
||||
const animationFrame = requestAnimationFrame(() => {
|
||||
// When collapsing
|
||||
if (collapsed) {
|
||||
|
@ -182,6 +182,7 @@ function CollapsibleBase({
|
|||
disableSSRStyle,
|
||||
}: CollapsibleBaseProps) {
|
||||
// any because TS is a pain for HTML element refs, see https://twitter.com/sebastienlorber/status/1412784677795110914
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const collapsibleRef = useRef<any>(null);
|
||||
|
||||
useCollapseAnimation({collapsibleRef, collapsed, animation});
|
||||
|
@ -191,7 +192,7 @@ function CollapsibleBase({
|
|||
// @ts-expect-error: see https://twitter.com/sebastienlorber/status/1412784677795110914
|
||||
ref={collapsibleRef}
|
||||
style={disableSSRStyle ? undefined : getSSRStyle(collapsed)}
|
||||
onTransitionEnd={(e) => {
|
||||
onTransitionEnd={(e: React.TransitionEvent) => {
|
||||
if (e.propertyName !== 'height') {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
||||
|
||||
export const useTitleFormatter = (title?: string | undefined): string => {
|
||||
const {siteConfig = {}} = useDocusaurusContext();
|
||||
const {title: siteTitle, titleDelimiter = '|'} = siteConfig;
|
||||
const {siteConfig} = useDocusaurusContext();
|
||||
const {title: siteTitle, titleDelimiter} = siteConfig;
|
||||
return title && title.trim().length
|
||||
? `${title.trim()} ${titleDelimiter} ${siteTitle}`
|
||||
: siteTitle;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue