Skip to content

Commit

Permalink
Accept, deny callbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
willemliufdmg committed Sep 3, 2020
1 parent 9e3c7c2 commit 5fe04b1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/components/cookieconsent/CookieConsent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ interface Props {
acceptAllLabel?: string;
denyAllLabel?: string;
description?: JSX.Element | String;
onAcceptAll?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
onClose?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
onDenyAll?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
opened?: boolean;
title?: JSX.Element | String;
}
Expand All @@ -40,18 +42,20 @@ function CookieConsent(props: Props) {
VendorNames['vimeo'],
VendorNames['youtube'],
]);
props?.onAcceptAll?.(e);
props?.onClose?.(e);
},
[props.onClose]
[props.onClose, props.onAcceptAll]
);

const handleDenyAll = useCallback(
(e: React.MouseEvent<HTMLDivElement, MouseEvent>) => {
e.preventDefault();
CookieConsentStore.setVendorNames([]);
props?.onDenyAll?.(e);
props?.onClose?.(e);
},
[props.onClose]
[props.onClose, props.onDenyAll]
);

return (
Expand Down

0 comments on commit 5fe04b1

Please sign in to comment.