1
1
import React from 'react' ;
2
2
import Layout from '@theme/Layout' ;
3
- import { useHistory , useLocation } from '@docusaurus/router' ;
3
+ import { useHistory , useLocation } from '@docusaurus/router' ;
4
+ import { useEffect } from 'react' ;
4
5
import { Route } from 'react-router-dom' ;
5
6
import { About } from '@site/src/components/about'
6
7
import LargePortraitCard from '@site/src/components/about/LargePortraitCard' ;
@@ -11,9 +12,23 @@ export default function LargePortraitCardPage() {
11
12
const location = useLocation ( ) ;
12
13
const history = useHistory ( ) ;
13
14
15
+ useEffect ( ( ) => {
16
+ if ( location . state ?. fromAbout ) {
17
+ window . scrollTo ( { top : location . state . scrollY ?? 0 , behavior : 'auto' } ) ;
18
+ }
19
+ } , [ ] ) ;
20
+
14
21
function handleClose ( ) {
22
+ const scrollY = location . state ?. scrollY ;
23
+
15
24
if ( location . state ?. fromAbout ) {
16
25
history . push ( '/about' ) ;
26
+
27
+ setTimeout ( ( ) => {
28
+ if ( scrollY !== undefined ) {
29
+ window . scrollTo ( { top : scrollY , behavior : 'auto' } ) ;
30
+ }
31
+ } , 0 ) ;
17
32
} else {
18
33
history . goBack ( ) ;
19
34
}
@@ -25,8 +40,11 @@ export default function LargePortraitCardPage() {
25
40
path = "/about/:completeName"
26
41
render = { ( { history, match } ) => {
27
42
const { completeName } = match . params ;
43
+ console . log ( 'name:' , completeName )
28
44
const teamMembers = getTeamByPersonName ( completeName ) ;
29
- const person = teamMembers . find ( person => person . completeName . replace ( / \s + / g, '' ) === completeName ) ;
45
+ console . log ( 'members:' , teamMembers )
46
+ const person = teamMembers . find ( ( person ) => person . completeName . replace ( / \s + / g, '' ) . normalize ( "NFD" ) . replace ( / [ \u0300 - \u036f ] / g, '' ) === completeName ) ;
47
+ console . log ( 'Person:' , person )
30
48
if ( ! person ) return null ;
31
49
32
50
return (
0 commit comments