Better non-clickable implementation

## Issue
- Adding `content__non-clickable` everywhere probably isn't the right way when we move forward to separating `all.scss`.
- Not intuitive -- easier to use if it's an attribute to `ClaimPreview`.

## Change
- Consolidate to a re-usable `non-clickable` class.
- Made Wallet Send search preview non-clickable as a temporary band aid until the channel-finder is consolidated.
- `listBlocked`: something is overriding the pointer, so non-clickable isn't working. Removed for now -- doesn't really matter.
This commit is contained in:
infinite-persistence 2022-04-05 14:48:02 +08:00 committed by infinite-persistence
parent 134cef103a
commit 59a0b9d490
9 changed files with 15 additions and 15 deletions

View file

@ -57,6 +57,7 @@ type Props = {
nsfw: boolean, nsfw: boolean,
placeholder: string, placeholder: string,
type: string, type: string,
nonClickable?: boolean,
banState: { blacklisted?: boolean, filtered?: boolean, muted?: boolean, blocked?: boolean }, banState: { blacklisted?: boolean, filtered?: boolean, muted?: boolean, blocked?: boolean },
hasVisitedUri: boolean, hasVisitedUri: boolean,
blockedUris: Array<string>, blockedUris: Array<string>,
@ -81,7 +82,7 @@ type Props = {
isLivestreamActive: boolean, isLivestreamActive: boolean,
collectionId?: string, collectionId?: string,
isCollectionMine: boolean, isCollectionMine: boolean,
disableNavigation?: boolean, disableNavigation?: boolean, // DEPRECATED - use 'nonClickable'. Remove this when channel-finder is consolidated (#810)
mediaDuration?: string, mediaDuration?: string,
date?: any, date?: any,
indexInContainer?: number, // The index order of this component within 'containerId'. indexInContainer?: number, // The index order of this component within 'containerId'.
@ -117,6 +118,7 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
history, history,
wrapperElement, wrapperElement,
type, type,
nonClickable,
placeholder, placeholder,
// pending // pending
reflectingProgress, reflectingProgress,
@ -345,6 +347,7 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
'claim-preview__wrapper--small': type === 'small', 'claim-preview__wrapper--small': type === 'small',
'claim-preview__live': isLivestreamActive, 'claim-preview__live': isLivestreamActive,
'claim-preview__active': active, 'claim-preview__active': active,
'non-clickable': nonClickable,
})} })}
> >
<> <>

View file

@ -712,8 +712,8 @@ export default function ReportContent(props: Props) {
function getClaimPreview(claim: StreamClaim) { function getClaimPreview(claim: StreamClaim) {
return ( return (
<div className="section content__non-clickable"> <div className="section">
<ClaimPreview uri={claim.permanent_url} hideMenu hideActions type="small" /> <ClaimPreview uri={claim.permanent_url} hideMenu hideActions nonClickable type="small" />
</div> </div>
); );
} }

View file

@ -40,7 +40,7 @@ export default function SettingsRow(props: Props) {
className={classnames('settings-row__value', { className={classnames('settings-row__value', {
'settings-row__value--multirow': multirow, 'settings-row__value--multirow': multirow,
'settings-row__vertical-separator': useVerticalSeparator, 'settings-row__vertical-separator': useVerticalSeparator,
'content__non-clickable': disabled, 'non-clickable': disabled,
})} })}
> >
{children && children} {children && children}

View file

@ -141,6 +141,7 @@ class WalletSend extends React.PureComponent<Props> {
showNullPlaceholder showNullPlaceholder
hideMenu hideMenu
hideRepostLabel hideRepostLabel
nonClickable
/> />
</fieldset-section> </fieldset-section>
)} )}

View file

@ -156,11 +156,7 @@ export default function ModalBlockChannel(props: Props) {
} }
function getCommenterPreview(uri) { function getCommenterPreview(uri) {
return ( return <ClaimPreview uri={uri} hideMenu hideActions nonClickable type="small" />;
<div className="content__non-clickable">
<ClaimPreview uri={uri} hideMenu hideActions type="small" />
</div>
);
} }
function getActiveChannelElem() { function getActiveChannelElem() {

View file

@ -27,11 +27,7 @@ export default function ModalHideRecommendation(props: Props) {
<Modal isOpen type="card" onAborted={doHideModal}> <Modal isOpen type="card" onAborted={doHideModal}>
<Card <Card
title={__('Not interested')} title={__('Not interested')}
body={ body={<ClaimPreview uri={uri} hideMenu hideActions nonClickable type="inline" properties={false} />}
<div className="content__non-clickable">
<ClaimPreview uri={uri} hideMenu hideActions type="inline" properties={false} />
</div>
}
actions={ actions={
<> <>
<div className="section__checkbox"> <div className="section__checkbox">

View file

@ -132,7 +132,7 @@ function ListBlocked(props: Props) {
<div className="block-list--delegator" key={delegatorUri}> <div className="block-list--delegator" key={delegatorUri}>
<label>{__('Blocked on behalf of:')}</label> <label>{__('Blocked on behalf of:')}</label>
<ul className="section"> <ul className="section">
<div className="content__non-clickable"> <div>
<ClaimPreview uri={delegatorUri} hideMenu hideActions type="inline" properties={false} /> <ClaimPreview uri={delegatorUri} hideMenu hideActions type="inline" properties={false} />
{moderatorTimeoutMap[uri] && getBanInfoElem(moderatorTimeoutMap[uri])} {moderatorTimeoutMap[uri] && getBanInfoElem(moderatorTimeoutMap[uri])}
</div> </div>

View file

@ -8,6 +8,7 @@
@import 'init/base-theme'; @import 'init/base-theme';
@import 'themes/light.scss'; @import 'themes/light.scss';
@import 'themes/dark.scss'; @import 'themes/dark.scss';
@import 'common/non-clickable';
@import 'component/ads'; @import 'component/ads';
@import 'component/animation'; @import 'component/animation';
@import 'component/badge'; @import 'component/badge';

View file

@ -0,0 +1,3 @@
.non-clickable {
pointer-events: none;
}