From e57722caa095e828ff26aa884b05109060a3c302 Mon Sep 17 00:00:00 2001 From: Aleksandr Gumroian Date: Fri, 8 Nov 2024 16:40:38 +0100 Subject: [PATCH] Add RebootButton and RichTable components to documentation --- src/common/RebootButton.js | 12 ++- src/common/RebootButton.md | 24 ++++++ src/common/RichTable/RichTable.js | 18 +++- src/common/RichTable/RichTable.md | 135 ++++++++++++++++++++++++++++++ styleguide.config.js | 36 ++++---- 5 files changed, 207 insertions(+), 18 deletions(-) create mode 100644 src/common/RebootButton.md create mode 100644 src/common/RichTable/RichTable.md diff --git a/src/common/RebootButton.js b/src/common/RebootButton.js index 9b9f85e..380b30d 100644 --- a/src/common/RebootButton.js +++ b/src/common/RebootButton.js @@ -16,6 +16,11 @@ import { Modal, ModalHeader, ModalBody, ModalFooter } from "../bootstrap/Modal"; import { useAlert } from "../context/alertContext/AlertContext"; import { ForisURLs } from "../utils/forisUrls"; +RebootButton.propTypes = { + /** Additional props to be passed to the button */ + props: PropTypes.object, +}; + function RebootButton(props) { const [triggered, setTriggered] = useState(false); const [modalShown, setModalShown] = useState(false); @@ -68,7 +73,12 @@ function RebootModal({ shown, setShown, onReboot }) {

{_("Are you sure you want to restart the router?")}

- + diff --git a/src/common/RebootButton.md b/src/common/RebootButton.md new file mode 100644 index 0000000..58a328a --- /dev/null +++ b/src/common/RebootButton.md @@ -0,0 +1,24 @@ +RebootButton component is a button that opens a modal dialog to confirm the +reboot of the device. + +## Usage + +```jsx +import React, { useEffect, createContext } from "react"; +import RebootButton from "./RebootButton"; +import { AlertContextProvider } from "../context/alertContext/AlertContext"; + +window.AlertContext = React.createContext(); + +const RebootButtonExample = () => { + return ( + +