Files
ColdBreeze-chat-web/src/common/component/Setting/Notifications.js
T
2022-03-18 16:34:36 +08:00

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>
);
}