Skip to content

Commit

Permalink
fix: improve mobile view compatiblity
Browse files Browse the repository at this point in the history
  • Loading branch information
devrsi0n committed Apr 17, 2024
1 parent d8f23ac commit 252b210
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ import type { ICheckToxicText, RTEValue } from '@chirpy-dev/types';
import { getTextFromRteValue } from '@chirpy-dev/utils';
import * as React from 'react';

import { Button, ButtonProps } from '../../../components/button';
import { ButtonProps } from '../../../components/button';
import { IconLoader, IconSend } from '../../../components/icons';
import { useCurrentUser } from '../../../contexts/current-user-context';
import { useNotificationContext } from '../../../contexts/notification-context';
import { useAsync } from '../../../hooks/use-async';
import { useEventListener } from '../../../hooks/use-event-listener';
import { SignInButton } from '../../sign-in-button';
import { AskNotificationPermissionPopover } from './ask-notification-permission-popover';
import { ToxicTextPopover } from './toxic-text-popover';
Expand Down Expand Up @@ -71,13 +72,17 @@ export function MainButton({
<span>Post</span>
</>
);
useEventListener(
'keydown',
(e) => {
if (isReply && e.key === 'Escape') {
onClickDismiss?.();
}
},
window,
);
return (
<div className="flex flex-row justify-end space-x-2">
{isReply && (
<Button variant="text" size="sm" onClick={onClickDismiss}>
Cancel
</Button>
)}
{isSignIn ? (
!supportNotification || didRegister || didDeny || askNextTime ? (
<ToxicTextPopover
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export function RichTextEditor(props: IRichTextEditorProps): JSX.Element {
},
}),
Placeholder.configure({
placeholder,
placeholder: `${placeholder}${isReply ? ' Esc to close' : ' '}`,
emptyEditorClass: 'rtePlaceholder',
}),
Image.configure({
Expand Down

0 comments on commit 252b210

Please sign in to comment.