Skip to content

Commit

Permalink
add MUI drawer component progress
Browse files Browse the repository at this point in the history
  • Loading branch information
andracc committed Dec 13, 2024
1 parent fffdc2e commit 9a91fc8
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions src/components/AnalyticsConsent/AnalyticsConsent.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,34 @@
import { ReactElement } from "react";
import { Button } from "@mui/material";
import Drawer from "@mui/material/Drawer";
import { ReactElement, useState } from "react";

interface ConsentProps {
onChangeConsent: (consentVal: boolean) => void;
}

export function AnalyticsConsent(props: ConsentProps): ReactElement {

const [responded, setResponded] = useState(false);
const acceptAnalytics = (): void => {

setResponded(true);
props.onChangeConsent(true);
};
const rejectAnalytics = (): void => {

setResponded(false);
props.onChangeConsent(false);
};


return (
<div>
<button onClick={acceptAnalytics}>Accept</button>
<button onClick={rejectAnalytics}>Reject</button>
<Drawer anchor={"bottom"} open={!responded}>
MyDrawer!
<button onClick={acceptAnalytics}>Accept</button>
<button onClick={rejectAnalytics}>Reject</button>
</Drawer>

</div>
);
}

0 comments on commit 9a91fc8

Please sign in to comment.