grungnet/src/components/SettingsButton.js

32 lines
729 B
JavaScript
Raw Normal View History

2020-04-26 04:24:05 -04:00
import React, { useState } from "react";
import { IconButton } from "theme-ui";
import SettingsIcon from "../icons/SettingsIcon";
import SettingsModal from "../modals/SettingsModal";
function SettingsButton() {
const [isSettingsModalOpen, setIsSettingsModalOpen] = useState(false);
function openModal() {
setIsSettingsModalOpen(true);
}
function closeModal() {
setIsSettingsModalOpen(false);
}
return (
<>
<IconButton
m={1}
aria-label="Settings"
title="Settings"
onClick={openModal}
>
<SettingsIcon />
</IconButton>
<SettingsModal isOpen={isSettingsModalOpen} onRequestClose={closeModal} />
</>
);
}
export default SettingsButton;