From: Daniel Karbach Date: Sun, 20 Mar 2022 18:12:54 +0000 (+0100) Subject: generic spoiler component X-Git-Url: https://git.localhorst.tv/?a=commitdiff_plain;h=4e0ec8d1eb407632813e0e5695a7c5c1538c95df;p=alttp.git generic spoiler component --- diff --git a/resources/js/components/common/Spoiler.js b/resources/js/components/common/Spoiler.js new file mode 100644 index 0000000..c4995dc --- /dev/null +++ b/resources/js/components/common/Spoiler.js @@ -0,0 +1,19 @@ +import PropTypes from 'prop-types'; +import React, { useState } from 'react'; + +const Spoiler = ({ children }) => { + const [show, setShow] = useState(false); + + return setShow(true)} + > + {children} + ; +}; + +Spoiler.propTypes = { + children: PropTypes.node, +}; + +export default Spoiler; diff --git a/resources/sass/common.scss b/resources/sass/common.scss index 80b8b2a..6a4be9f 100644 --- a/resources/sass/common.scss +++ b/resources/sass/common.scss @@ -11,6 +11,21 @@ h1 { margin-bottom: 2rem; } +.spoiler { + border-radius: 0.5ex; + padding: 0 0.5ex; + background: $dark; + color: $light; + + &.hidden { + cursor: pointer; + + > .content { + visibility: hidden; + } + } +} + .text-discord { color: $discord; }