fix: better subscribe button for both mobile and desktop
This commit is contained in:
parent
4efc0fbd3e
commit
f4c63f4fc3
1 changed files with 7 additions and 8 deletions
|
@ -36,27 +36,26 @@ export default function SubscribeButton(props: Props) {
|
|||
doToast,
|
||||
shrinkOnMobile = false,
|
||||
} = props;
|
||||
|
||||
const buttonRef = useRef();
|
||||
const isHovering = useHover(buttonRef);
|
||||
const isMobile = useIsMobile();
|
||||
let isHovering = useHover(buttonRef);
|
||||
isHovering = isMobile ? true : isHovering;
|
||||
|
||||
const { channelName } = parseURI(permanentUrl);
|
||||
const claimName = '@' + channelName;
|
||||
|
||||
const subscriptionHandler = isSubscribed ? doChannelUnsubscribe : doChannelSubscribe;
|
||||
const subscriptionLabel = isSubscribed ? __('Following') : __('Follow');
|
||||
const unfollowOverride = isSubscribed && isHovering && __('Unfollow');
|
||||
|
||||
const label = isMobile && shrinkOnMobile ? '' : unfollowOverride || subscriptionLabel;
|
||||
|
||||
let longestStr = __('Following');
|
||||
|
||||
if (__('Following').length < __('Unfollow').length) {
|
||||
longestStr = __('Unfollow');
|
||||
}
|
||||
|
||||
return permanentUrl ? (
|
||||
<Button
|
||||
ref={buttonRef}
|
||||
iconColor="red"
|
||||
largestLabel={isSubscribed ? longestStr : undefined}
|
||||
largestLabel={isMobile && shrinkOnMobile ? '' : subscriptionLabel}
|
||||
icon={unfollowOverride ? ICONS.UNSUBSCRIBE : ICONS.SUBSCRIBE}
|
||||
button={'alt'}
|
||||
requiresAuth={IS_WEB}
|
||||
|
|
Loading…
Add table
Reference in a new issue