fix: make article editor usable on mobile

This commit is contained in:
nstarikov 2026-08-11 12:30:10 +03:00
parent 732c90d022
commit 6574ed6213
2 changed files with 65 additions and 6 deletions

View file

@ -1843,8 +1843,8 @@ export default function App() {
</div> </div>
) : null} ) : null}
<div className="modal-panel flex max-h-[92vh] w-full max-w-[1280px] flex-col overflow-hidden rounded-lg border bg-background shadow-lg"> <div className="modal-panel flex max-h-[92vh] w-full max-w-[1280px] flex-col overflow-hidden rounded-lg border bg-background shadow-lg">
<div className="flex items-start justify-between gap-4 border-b p-5"> <div className="article-modal-header flex min-w-0 items-start justify-between gap-4 border-b p-5">
<div className="min-w-0"> <div className="article-modal-intro min-w-0 flex-1">
<div className="flex flex-wrap items-center gap-2"> <div className="flex flex-wrap items-center gap-2">
{isScheduledForFuture(selectedArticle.publishedAt) ? ( {isScheduledForFuture(selectedArticle.publishedAt) ? (
<Badge className="gap-1.5 border-sky-200 bg-sky-50 text-sky-700 hover:bg-sky-50" variant="outline"> <Badge className="gap-1.5 border-sky-200 bg-sky-50 text-sky-700 hover:bg-sky-50" variant="outline">
@ -1859,7 +1859,7 @@ export default function App() {
</div> </div>
<p className="mt-1 text-sm text-muted-foreground">Редактируйте блоки как в Medium. Для картинки выберите image-блок и нажмите кнопку случайного кадра.</p> <p className="mt-1 text-sm text-muted-foreground">Редактируйте блоки как в Medium. Для картинки выберите image-блок и нажмите кнопку случайного кадра.</p>
</div> </div>
<div className="flex shrink-0 flex-wrap justify-end gap-2"> <div className="article-modal-actions flex shrink-0 flex-wrap justify-end gap-2">
<input <input
ref={featureImageInputRef} ref={featureImageInputRef}
className="hidden" className="hidden"
@ -1886,7 +1886,7 @@ export default function App() {
</Button> </Button>
{selectedArticle.status !== "published" || isScheduledForFuture(selectedArticle.publishedAt) ? ( {selectedArticle.status !== "published" || isScheduledForFuture(selectedArticle.publishedAt) ? (
<> <>
<label className="flex h-9 items-center gap-2 rounded-md border bg-background px-3 text-xs text-muted-foreground" title="Время выхода в RSS"> <label className="article-publish-time flex h-9 items-center gap-2 rounded-md border bg-background px-3 text-xs text-muted-foreground" title="Время выхода в RSS">
<Clock3 className="size-4" /> <Clock3 className="size-4" />
<input <input
type="datetime-local" type="datetime-local"
@ -1912,8 +1912,8 @@ export default function App() {
</Button> </Button>
</div> </div>
</div> </div>
<div className="overflow-y-auto bg-zinc-50 p-4 sm:p-6"> <div className="article-modal-body overflow-y-auto bg-zinc-50 p-4 sm:p-6">
<article className="mx-auto w-full max-w-[1024px] rounded-lg border bg-white px-5 py-7 shadow-sm sm:px-8 lg:px-10"> <article className="article-modal-content mx-auto w-full max-w-[1024px] rounded-lg border bg-white px-5 py-7 shadow-sm sm:px-8 lg:px-10">
<div className="mb-6"> <div className="mb-6">
<div className="mb-2 flex items-center justify-between gap-3"> <div className="mb-2 flex items-center justify-between gap-3">
<div> <div>

View file

@ -416,6 +416,65 @@
} }
} }
@media (max-width: 640px) {
.modal-overlay {
align-items: flex-start;
padding: 0;
}
.modal-panel {
width: 100%;
height: 100dvh;
max-height: 100dvh;
border-radius: 0;
border-left: 0;
border-right: 0;
}
.article-modal-header {
flex-direction: column;
gap: 0.75rem;
padding: 0.75rem 1rem;
}
.article-modal-intro {
width: 100%;
}
.article-modal-intro > p {
max-width: 100%;
line-height: 1.35;
}
.article-modal-actions {
width: 100%;
justify-content: flex-start;
}
.article-publish-time {
flex: 1 1 100%;
width: 100%;
}
.article-publish-time input {
min-width: 0;
width: 100%;
}
.article-modal-body {
padding: 0.75rem;
}
.article-modal-content {
padding: 1rem;
}
.article-modal-content .article-editorjs .ce-block__content,
.article-modal-content .article-editorjs .ce-toolbar__content {
max-width: calc(100vw - 4rem);
}
}
@keyframes modal-overlay-in { @keyframes modal-overlay-in {
from { from {
opacity: 0; opacity: 0;