Skip to content

Commit

Permalink
Merge pull request #17 from AI4Bharat/react-django
Browse files Browse the repository at this point in the history
People Button Stack Responsive
  • Loading branch information
Shanks0465 authored Sep 2, 2024
2 parents 6c54a76 + 8f87cdc commit a636f2c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
1 change: 1 addition & 0 deletions frontend/components/People.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ export default function PeopleSection({
{members.map((member) =>
member.team === team ? (
<Card
key={`${member.first_name}_${member.last_name}`}
first_name={member.first_name}
last_name={member.last_name}
role={member.role}
Expand Down
22 changes: 18 additions & 4 deletions frontend/src/app/people/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@
import { useEffect, useState } from "react";
import axios from "axios";
import PeopleSection from "../../../components/People";
import { Stack, HStack, Button } from "@chakra-ui/react";
import {
Stack,
HStack,
Button,
VStack,
useBreakpointValue,
Flex,
} from "@chakra-ui/react";
import { useQuery } from "react-query";
import { API_URL } from "../config";

Expand Down Expand Up @@ -85,6 +92,7 @@ export default function People() {
const [members, setMembers] = useState([]);
const [section, setSection] = useState("fdr");
const { isLoading, error, data } = useQuery("fetchMembers", fetchMembers);
const direction = useBreakpointValue({ base: "column", md: "row" });

useEffect(() => {
if (error || isLoading) {
Expand All @@ -95,8 +103,14 @@ export default function People() {
}, [error, data, isLoading]);

return (
<Stack alignItems={"center"}>
<HStack p={5}>
<Stack>
<Flex
p={5}
justifyContent={"center"}
gap={2}
direction={direction}
mt={10}
>
<Button
onClick={(event) => setSection("fdr")}
value={"fdr"}
Expand Down Expand Up @@ -139,7 +153,7 @@ export default function People() {
>
Alumni
</Button>
</HStack>
</Flex>
{renderSection({ members, section })}
</Stack>
);
Expand Down

0 comments on commit a636f2c

Please sign in to comment.