diff --git a/src/bootstrap/ThreeDotsMenu.js b/src/bootstrap/ThreeDotsMenu.js new file mode 100644 index 0000000..92bb6f7 --- /dev/null +++ b/src/bootstrap/ThreeDotsMenu.js @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2024 CZ.NIC z.s.p.o. (https://www.nic.cz/) + * + * This is free software, licensed under the GNU General Public License v3. + * See /LICENSE for more information. + */ + +import React from "react"; + +import { faEllipsisVertical } from "@fortawesome/free-solid-svg-icons"; +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; +import PropTypes from "prop-types"; + +import Button from "./Button"; + +ThreeDotsMenu.propTypes = { + /** Menu items. */ + children: PropTypes.arrayOf(PropTypes.node).isRequired, +}; + +function ThreeDotsMenu({ children }) { + return ( +
+ + +
+ ); +} + +export default ThreeDotsMenu; diff --git a/src/bootstrap/ThreeDotsMenu.md b/src/bootstrap/ThreeDotsMenu.md new file mode 100644 index 0000000..a405014 --- /dev/null +++ b/src/bootstrap/ThreeDotsMenu.md @@ -0,0 +1,40 @@ +ThreeDotsMenu Bootstrap component is a dropdown menu that appears when the user +clicks on three dots. It is used to display a list of actions that can be +performed on a particular item. + +```js +import { useState } from "react"; +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; +import { faEdit, faTrash } from "@fortawesome/free-solid-svg-icons"; + +const threeDotsMenuItems = [ + { + text: "Edit", + icon: faEdit, + onClick: () => { + alert("Edit clicked"); + }, + }, + { + text: "Delete", + icon: faTrash, + onClick: () => { + alert("Delete clicked"); + }, + }, +]; + + + {threeDotsMenuItems.map((item, index) => ( + + ))} +; +``` diff --git a/styleguide.config.js b/styleguide.config.js index 301a31a..5a4df8b 100644 --- a/styleguide.config.js +++ b/styleguide.config.js @@ -79,10 +79,7 @@ module.exports = { __dirname, "node_modules/bootstrap/dist/css/bootstrap.min.css" ), - path.join( - __dirname, - "node_modules/@fortawesome/fontawesome-free/css/all.min.css" - ), + path.join(__dirname, "node_modules/bootstrap/dist/js/bootstrap.min.js"), ], styleguideComponents: { LogoRenderer: path.join(__dirname, "docs/components/Logo"),