Skip to content

Commit 0108c42

Browse files
Update SmallPortraitCard and AboutPage component except for index.ts page.
1 parent 6962115 commit 0108c42

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+786
-904
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import React from 'react';
2+
import Layout from '@theme/Layout';
3+
import { useHistory, useLocation} from '@docusaurus/router';
4+
import { Route } from 'react-router-dom';
5+
import { About } from '@site/src/components/about'
6+
import LargePortraitCard from '@site/src/components/about/LargePortraitCard';
7+
import { getTeamByPersonName } from '@site/src/components/about';
8+
import styles from "@site/src/components/about/styles.module.css";
9+
10+
export default function LargePortraitCardPage() {
11+
const location = useLocation();
12+
const history = useHistory();
13+
14+
function handleClose() {
15+
if (location.state?.fromAbout) {
16+
history.push('/about');
17+
} else {
18+
history.goBack();
19+
}
20+
}
21+
return (
22+
<Layout>
23+
<About />
24+
<Route
25+
path="/about/:completeName"
26+
render={({ history, match }) => {
27+
const { completeName } = match.params;
28+
const teamMembers = getTeamByPersonName(completeName);
29+
const person = teamMembers.find(person => person.completeName.replace(/\s+/g, '') === completeName);
30+
if (!person) return null;
31+
32+
return (
33+
<div className={styles.modal_overlay} onClick={() => history.push('/about')}>
34+
<div
35+
className={styles.modal_content}
36+
onClick={(e) => e.stopPropagation()}
37+
>
38+
<button
39+
className="close-button"
40+
style={{
41+
position: "absolute",
42+
top: "10px",
43+
right: "10px",
44+
}}
45+
onClick={handleClose}
46+
/>
47+
<LargePortraitCard person={person} />
48+
</div>
49+
</div>
50+
);
51+
}}
52+
/>
53+
</Layout>
54+
)
55+
}
56+

src/components/about/SmallPortraitCard.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@ import styles from "./styles.module.css";
22
import { useHistory } from "@docusaurus/router";
33
import Avatar from "./Avatar";
44

5-
export function SmallPortraitCard({ person }) {
5+
export function SmallPortraitCard({ person}) {
66
const history = useHistory();
77

8-
function openDialog () {
9-
history.push("/about/");
10-
history.push("/about/" + person.firstName);
11-
12-
};
8+
function openDialog() {
9+
history.push({
10+
pathname: `/about/${person.completeName.replace(/\s+/g, '')}`,
11+
state: { fromAbout: true },
12+
});
13+
}
1314

1415
return (
1516
<div onClick={openDialog}>

src/components/about/SmallPortraitCardWithDialog.tsx

Lines changed: 0 additions & 46 deletions
This file was deleted.

src/components/about/SubTeam.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import styles from "./styles.module.css";
2-
import Example from "./PortraitDialog";
3-
import { SmallPortraitCardWithDialog } from "./SmallPortraitCardWithDialog";
4-
2+
import { SmallPortraitCard } from "./SmallPortraitCard";
53

64
export default function SubTeam({ subTeamName, subTeam }) {
75
return (
@@ -12,7 +10,7 @@ export default function SubTeam({ subTeamName, subTeam }) {
1210
{subTeam.map((person, index) => (
1311
<li className="cards-list" key={person.firstName}>
1412
<div className="col">
15-
<SmallPortraitCardWithDialog person={person} />
13+
<SmallPortraitCard person={person} />
1614
</div>
1715
</li>
1816
))}

0 commit comments

Comments
 (0)