27 lines
711 B
JavaScript
27 lines
711 B
JavaScript
// import React from "react";
|
|
import styled from "styled-components";
|
|
import useNotification from "../../hook/useNotification";
|
|
import StyledToggle from "../styled/Toggle";
|
|
import Label from "../styled/Label";
|
|
const StyledWrapper = styled.div`
|
|
display: flex;
|
|
flex-direction: column;
|
|
`;
|
|
export default function Notifications() {
|
|
const { status, enableNotification } = useNotification();
|
|
const handleEnableNotify = () => {
|
|
if (status !== "granted") {
|
|
enableNotification();
|
|
}
|
|
};
|
|
return (
|
|
<StyledWrapper>
|
|
<Label>Notification Setting:</Label>
|
|
<StyledToggle
|
|
data-checked={status == "granted"}
|
|
onClick={handleEnableNotify}
|
|
/>
|
|
</StyledWrapper>
|
|
);
|
|
}
|