Skip to content

Based on a slack chat from datphotogurl. #1868

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions pages/team.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { s3 } from 'common/constants/urls';
import Content from 'components/Content/Content';
import FlatCard from 'components/Cards/FlatCard/FlatCard';
import styles from 'styles/team.module.css';
import Script from "next/script";

const boardMembers = [
{
Expand Down Expand Up @@ -65,6 +66,51 @@ const boardMembers = [

export default function Team() {
return (
<>
<Script strategy="afterInteractive">
{`
function setMaxHeightByRow() {
const elements = document.querySelectorAll('div.team_teamMembers__lbhpy article');
const rows = new Map();

elements.forEach(e => {
const flexCol = e.querySelector('.flex-col');
if (flexCol) {
flexCol.style.marginTop = '0';
flexCol.style.height = 'auto';
flexCol.style.minHeight = '0';
}
});

elements.forEach(e => {
let top = e.offsetTop;
if (!rows.has(top)) rows.set(top, []);
rows.get(top).push(e);
});

rows.forEach(rowElements => {
let maxHeight = Math.max(...rowElements.map(e => e.getBoundingClientRect().height));

let topDistance = rowElements.length < 2 ? rowElements[0].querySelector('.flex-col').offsetTop : Math.max(rowElements[0].querySelector('.flex-col').offsetTop, rowElements[1].querySelector('.flex-col').offsetTop);

rowElements.forEach(e => {
const flexCol = e.querySelector(".flex-col");
let diff = Math.abs(topDistance - flexCol.offsetTop);
if (flexCol) {
if (diff > 0) {
flexCol.style.marginTop = \`\${diff}px\`;
}
flexCol.style.minHeight = \`\${maxHeight}px\`;
flexCol.style.height = \`\${maxHeight}px\`;
}
});
});
}

setMaxHeightByRow();
window.addEventListener("resize", setMaxHeightByRow);
`}
</Script>
<div className={styles.Team}>
<Head title="Team" />

Expand Down Expand Up @@ -121,5 +167,6 @@ export default function Team() {
]}
/>
</div>
</>
);
}