From: Daniel Karbach Date: Sun, 20 Mar 2022 14:59:17 +0000 (+0100) Subject: clickable user boxes X-Git-Url: https://git.localhorst.tv/?a=commitdiff_plain;h=a21cc53ca73ca1690f53bc2ec3c2a1a2948d67dd;p=alttp.git clickable user boxes --- diff --git a/resources/js/components/users/Box.js b/resources/js/components/users/Box.js index 7bbc186..d7ee3af 100644 --- a/resources/js/components/users/Box.js +++ b/resources/js/components/users/Box.js @@ -1,12 +1,24 @@ import PropTypes from 'prop-types'; import React from 'react'; +import { Button } from 'react-bootstrap'; import { withTranslation } from 'react-i18next'; +import { useNavigate } from 'react-router-dom'; import { getAvatarUrl } from '../../helpers/User'; import i18n from '../../i18n'; -const Box = ({ discriminator, user }) => user ? - +const Box = ({ discriminator, user }) => { + const navigate = useNavigate(); + + if (!user) { + return {i18n.t('general.anonymous')}; + } + + return ; +}; Box.propTypes = { discriminator: PropTypes.bool, user: PropTypes.shape({ discriminator: PropTypes.string, + id: PropTypes.string, username: PropTypes.string, }), }; diff --git a/resources/sass/users.scss b/resources/sass/users.scss index 94aab1e..c6f7509 100644 --- a/resources/sass/users.scss +++ b/resources/sass/users.scss @@ -1,4 +1,8 @@ .user-box { + padding: 0; + color: inherit; + text-decoration: none; + img { max-height: 2rem; width: auto;