From: Daniel Karbach Date: Sun, 20 Aug 2023 13:01:09 +0000 (+0200) Subject: mobile header styles X-Git-Url: https://git.localhorst.tv/?a=commitdiff_plain;h=a0bca4306e882d77ba192eed889bd7ed52896dad;p=alttp.git mobile header styles --- diff --git a/resources/js/components/app/Header.js b/resources/js/components/app/Header.js index ed9af60..bd0e50b 100644 --- a/resources/js/components/app/Header.js +++ b/resources/js/components/app/Header.js @@ -1,96 +1,61 @@ import PropTypes from 'prop-types'; import React from 'react'; -import { Button, Container, Nav, Navbar } from 'react-bootstrap'; +import { Container, Nav, Navbar } from 'react-bootstrap'; import { LinkContainer } from 'react-router-bootstrap'; import { useLocation } from 'react-router-dom'; import { useTranslation } from 'react-i18next'; import LanguageSwitcher from './LanguageSwitcher'; +import User from './User'; import Icon from '../common/Icon'; -import { getAvatarUrl } from '../../helpers/User'; -import { withUser } from '../../helpers/UserContext'; -const Header = ({ doLogout, user }) => { +const Header = ({ doLogout }) => { const { pathname } = useLocation(); const { t } = useTranslation(); - return + return ALttP - - - - - - + + + + + + +
+ + + + +
+
; }; Header.propTypes = { doLogout: PropTypes.func, - user: PropTypes.shape({ - avatar: PropTypes.string, - discriminator: PropTypes.string, - id: PropTypes.string, - username: PropTypes.string, - }), }; -export default withUser(Header); +export default Header; diff --git a/resources/js/components/app/User.js b/resources/js/components/app/User.js new file mode 100644 index 0000000..6f58926 --- /dev/null +++ b/resources/js/components/app/User.js @@ -0,0 +1,58 @@ +import PropTypes from 'prop-types'; +import React from 'react'; +import { Button, Nav } from 'react-bootstrap'; +import { LinkContainer } from 'react-router-bootstrap'; +import { useTranslation } from 'react-i18next'; + +import Icon from '../common/Icon'; +import { useUser } from '../../helpers/UserContext'; +import { getAvatarUrl } from '../../helpers/User'; + +const User = ({ doLogout }) => { + const { t } = useTranslation(); + const user = useUser(); + + return user + ? <> + + + + : ; +}; + +User.propTypes = { + doLogout: PropTypes.func, +}; + +export default User; diff --git a/resources/js/components/common/Icon.js b/resources/js/components/common/Icon.js index 022de69..e1c4d46 100644 --- a/resources/js/components/common/Icon.js +++ b/resources/js/components/common/Icon.js @@ -76,6 +76,7 @@ Icon.INVERT = makePreset('InveretIcon', 'circle-half-stroke'); Icon.LANGUAGE = makePreset('LanguageIcon', 'language'); Icon.LOCKED = makePreset('LockedIcon', 'lock'); Icon.LOGOUT = makePreset('LogoutIcon', 'sign-out-alt'); +Icon.MENU = makePreset('MenuIcon', 'bars'); Icon.MICROPHONE = makePreset('MicrophoneIcon', 'microphone'); Icon.MONITOR = makePreset('MonitorIcon', 'tv'); Icon.MOUSE = makePreset('MouseIcon', 'arrow-pointer');