Profile: add "Share" button as primary action to own profile
This commit is contained in:
parent
0796dc359c
commit
ed2866a1e1
3 changed files with 31 additions and 1 deletions
|
@ -182,7 +182,7 @@ class Header extends ImmutablePureComponent {
|
||||||
menu.push({
|
menu.push({
|
||||||
text: intl.formatMessage(messages.share, { name: account.get('username') }),
|
text: intl.formatMessage(messages.share, { name: account.get('username') }),
|
||||||
action: this.handleShare,
|
action: this.handleShare,
|
||||||
icon: require('@tabler/icons/icons/share.svg'),
|
icon: require('feather-icons/dist/icons/share.svg'),
|
||||||
});
|
});
|
||||||
menu.push(null);
|
menu.push(null);
|
||||||
}
|
}
|
||||||
|
@ -489,6 +489,23 @@ class Header extends ImmutablePureComponent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
renderShareButton() {
|
||||||
|
const { intl, account, me } = this.props;
|
||||||
|
const canShare = 'share' in navigator;
|
||||||
|
|
||||||
|
if (!(account && me && account.get('id') === me && canShare)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<IconButton
|
||||||
|
src={require('feather-icons/dist/icons/share.svg')}
|
||||||
|
onClick={this.handleShare}
|
||||||
|
title={intl.formatMessage(messages.share, { name: account.get('username') })}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { account, intl, username, me, features } = this.props;
|
const { account, intl, username, me, features } = this.props;
|
||||||
const { isSmallScreen } = this.state;
|
const { isSmallScreen } = this.state;
|
||||||
|
@ -589,6 +606,7 @@ class Header extends ImmutablePureComponent {
|
||||||
|
|
||||||
<div className='account__header__extra__buttons'>
|
<div className='account__header__extra__buttons'>
|
||||||
{me && <DropdownMenuContainer items={menu} src={require('@tabler/icons/icons/dots.svg')} direction='right' />}
|
{me && <DropdownMenuContainer items={menu} src={require('@tabler/icons/icons/dots.svg')} direction='right' />}
|
||||||
|
{this.renderShareButton()}
|
||||||
{this.renderMessageButton()}
|
{this.renderMessageButton()}
|
||||||
<ActionButton account={account} />
|
<ActionButton account={account} />
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -209,6 +209,13 @@
|
||||||
.svg-icon {
|
.svg-icon {
|
||||||
width: 20px;
|
width: 20px;
|
||||||
height: 20px;
|
height: 20px;
|
||||||
|
|
||||||
|
svg {
|
||||||
|
&.feather {
|
||||||
|
// Feather icons are a little larger
|
||||||
|
transform: scale(0.9);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -606,6 +606,11 @@
|
||||||
|
|
||||||
svg {
|
svg {
|
||||||
stroke-width: 1.5;
|
stroke-width: 1.5;
|
||||||
|
|
||||||
|
&.feather {
|
||||||
|
// Feather icons are a little larger
|
||||||
|
transform: scale(0.9);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue