Added scroll up button in the editor
This commit is contained in:
parent
64680d815e
commit
525ca626fb
4
public/icons/up-button.svg
Normal file
4
public/icons/up-button.svg
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
<svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<rect x="1" y="1" width="26" height="26" stroke="currentColor" stroke-width="2"/>
|
||||||
|
<path d="M10 11H13V20H15V11H18L14 7L10 11Z" fill="currentColor"/>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 251 B |
|
@ -166,6 +166,7 @@
|
||||||
"Restore password": "Restore password",
|
"Restore password": "Restore password",
|
||||||
"Save draft": "Save draft",
|
"Save draft": "Save draft",
|
||||||
"Save settings": "Save settings",
|
"Save settings": "Save settings",
|
||||||
|
"Scroll up": "Scroll up",
|
||||||
"Search": "Search",
|
"Search": "Search",
|
||||||
"Search author": "Search author",
|
"Search author": "Search author",
|
||||||
"Search topic": "Search topic",
|
"Search topic": "Search topic",
|
||||||
|
|
|
@ -187,6 +187,7 @@
|
||||||
"Send": "Отправить",
|
"Send": "Отправить",
|
||||||
"Send link again": "Прислать ссылку ещё раз",
|
"Send link again": "Прислать ссылку ещё раз",
|
||||||
"Settings": "Настройки",
|
"Settings": "Настройки",
|
||||||
|
"Scroll up": "Наверх",
|
||||||
"Share": "Поделиться",
|
"Share": "Поделиться",
|
||||||
"Short opening": "Небольшое вступление, чтобы заинтересовать читателя",
|
"Short opening": "Небольшое вступление, чтобы заинтересовать читателя",
|
||||||
"Show": "Показать",
|
"Show": "Показать",
|
||||||
|
|
|
@ -13,6 +13,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.container {
|
.container {
|
||||||
|
position: relative;
|
||||||
|
|
||||||
.titleInput,
|
.titleInput,
|
||||||
.subtitleInput {
|
.subtitleInput {
|
||||||
border: 0;
|
border: 0;
|
||||||
|
@ -97,3 +99,45 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.scrollTopButton {
|
||||||
|
cursor: pointer;
|
||||||
|
left: 2rem;
|
||||||
|
position: sticky;
|
||||||
|
top: calc(100vh - 40px);
|
||||||
|
width: 2.8rem;
|
||||||
|
z-index: 2;
|
||||||
|
|
||||||
|
@include media-breakpoint-down(md) {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
@include media-breakpoint-up(xl) {
|
||||||
|
left: 4rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
.icon {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.scrollTopButtonLabel {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon {
|
||||||
|
opacity: 0.4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.scrollTopButtonLabel {
|
||||||
|
display: none;
|
||||||
|
@include font-size(1.4rem);
|
||||||
|
font-weight: bold;
|
||||||
|
left: 100%;
|
||||||
|
padding-left: 0.5em;
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
transform: translateY(-50%);
|
||||||
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@ import { translit } from '../../utils/ru2en'
|
||||||
import { Editor } from '../Editor/Editor'
|
import { Editor } from '../Editor/Editor'
|
||||||
import { Panel } from '../Editor/Panel'
|
import { Panel } from '../Editor/Panel'
|
||||||
import { useEditorContext } from '../../context/editor'
|
import { useEditorContext } from '../../context/editor'
|
||||||
|
import { Icon } from '../_shared/Icon'
|
||||||
|
|
||||||
type EditViewProps = {
|
type EditViewProps = {
|
||||||
shout: Shout
|
shout: Shout
|
||||||
|
@ -73,8 +74,20 @@ export const EditView = (props: EditViewProps) => {
|
||||||
setForm('slug', slug)
|
setForm('slug', slug)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const scrollTop = () => {
|
||||||
|
window.scrollTo({
|
||||||
|
top: 0,
|
||||||
|
behavior: 'smooth'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
<button class={styles.scrollTopButton} onClick={scrollTop}>
|
||||||
|
<Icon name="up-button" class={styles.icon} />
|
||||||
|
<span class={styles.scrollTopButtonLabel}>{t('Scroll up')}</span>
|
||||||
|
</button>
|
||||||
|
|
||||||
<div class={styles.container}>
|
<div class={styles.container}>
|
||||||
<Title>{t('Write an article')}</Title>
|
<Title>{t('Write an article')}</Title>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user