mirror of
https://github.com/kremalicious/umami.git
synced 2024-12-24 18:26:20 +01:00
Update ProfileButton.js
set alignment base on the page dir for User profile menu
This commit is contained in:
parent
a52bfaa629
commit
aca612c833
@ -5,12 +5,14 @@ import useMessages from 'hooks/useMessages';
|
|||||||
import useUser from 'hooks/useUser';
|
import useUser from 'hooks/useUser';
|
||||||
import useConfig from 'hooks/useConfig';
|
import useConfig from 'hooks/useConfig';
|
||||||
import styles from './ProfileButton.module.css';
|
import styles from './ProfileButton.module.css';
|
||||||
|
import useLocale from 'hooks/useLocale';
|
||||||
|
|
||||||
export default function ProfileButton() {
|
export default function ProfileButton() {
|
||||||
const { formatMessage, labels } = useMessages();
|
const { formatMessage, labels } = useMessages();
|
||||||
const { user } = useUser();
|
const { user } = useUser();
|
||||||
const { cloudMode } = useConfig();
|
const { cloudMode } = useConfig();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const { dir } = useLocale();
|
||||||
|
|
||||||
const handleSelect = key => {
|
const handleSelect = key => {
|
||||||
if (key === 'profile') {
|
if (key === 'profile') {
|
||||||
@ -31,7 +33,7 @@ export default function ProfileButton() {
|
|||||||
<Icons.ChevronDown />
|
<Icons.ChevronDown />
|
||||||
</Icon>
|
</Icon>
|
||||||
</Button>
|
</Button>
|
||||||
<Popup position="bottom" alignment="end">
|
<Popup position="bottom" alignment={dir === 'rtl' ? 'start' : 'end'}>
|
||||||
<Menu variant="popup" onSelect={handleSelect} className={styles.menu}>
|
<Menu variant="popup" onSelect={handleSelect} className={styles.menu}>
|
||||||
<Item key="user" className={styles.item}>
|
<Item key="user" className={styles.item}>
|
||||||
<Text>{user.username}</Text>
|
<Text>{user.username}</Text>
|
||||||
|
Loading…
Reference in New Issue
Block a user