bold, create page title

This commit is contained in:
bniwredyc 2023-03-13 13:26:25 +01:00
parent 64e7ec03f3
commit 293e7a06e4
4 changed files with 105 additions and 85 deletions

View File

@ -232,5 +232,6 @@
"zine": "zine", "zine": "zine",
"By time": "By time", "By time": "By time",
"New only": "New only", "New only": "New only",
"Short opening": "Short opening" "Short opening": "Short opening",
"Write an article": "Write an article"
} }

View File

@ -250,5 +250,6 @@
"zine": "журнал", "zine": "журнал",
"By time": "По порядку", "By time": "По порядку",
"New only": "Только новые", "New only": "Только новые",
"Short opening": "Небольшое вступление, чтобы заинтересовать читателя" "Short opening": "Небольшое вступление, чтобы заинтересовать читателя",
"Write an article": "Написать статью"
} }

View File

@ -2,6 +2,7 @@ import type { Editor } from '@tiptap/core'
import styles from './EditorBubbleMenu.module.scss' import styles from './EditorBubbleMenu.module.scss'
import { Icon } from '../_shared/Icon' import { Icon } from '../_shared/Icon'
import { clsx } from 'clsx' import { clsx } from 'clsx'
import { createEditorTransaction } from 'solid-tiptap'
type BubbleMenuProps = { type BubbleMenuProps = {
editor: Editor editor: Editor
@ -9,12 +10,25 @@ type BubbleMenuProps = {
} }
export const EditorBubbleMenu = (props: BubbleMenuProps) => { export const EditorBubbleMenu = (props: BubbleMenuProps) => {
const isBold = createEditorTransaction(
() => props.editor,
(editor) => editor && editor.isActive('bold')
)
return ( return (
<div ref={props.ref} class={styles.bubbleMenu}> <div ref={props.ref} class={styles.bubbleMenu}>
<button class={clsx(styles.bubbleMenuButton, styles.bubbleMenuButtonActive)}> <button class={clsx(styles.bubbleMenuButton)}>
<Icon name="editor-text-size" /> <Icon name="editor-text-size" />
</button> </button>
<button class={styles.bubbleMenuButton}> <button
class={clsx(styles.bubbleMenuButton, {
[styles.bubbleMenuButtonActive]: isBold()
})}
onClick={(e) => {
e.preventDefault()
props.editor.commands.toggleBold()
}}
>
<Icon name="editor-bold" /> <Icon name="editor-bold" />
</button> </button>
<button class={styles.bubbleMenuButton}> <button class={styles.bubbleMenuButton}>

View File

@ -3,6 +3,7 @@ import { Loading } from '../_shared/Loading'
import { useLocalize } from '../../context/localize' import { useLocalize } from '../../context/localize'
import { clsx } from 'clsx' import { clsx } from 'clsx'
import styles from './Create.module.scss' import styles from './Create.module.scss'
import { Title } from '@solidjs/meta'
const Editor = lazy(() => import('../Editor/Editor')) const Editor = lazy(() => import('../Editor/Editor'))
@ -10,6 +11,8 @@ export const CreateView = () => {
const { t } = useLocalize() const { t } = useLocalize()
return ( return (
<>
<Title>{t('Write an article')}</Title>
<Suspense fallback={<Loading />}> <Suspense fallback={<Loading />}>
<form> <form>
<div class="wide-container"> <div class="wide-container">
@ -56,9 +59,9 @@ export const CreateView = () => {
<h4>Темы</h4> <h4>Темы</h4>
<p class="description"> <p class="description">
Добавьте несколько тем, чтобы читатель знал, о&nbsp;чем ваш материал, и&nbsp;мог найти его Добавьте несколько тем, чтобы читатель знал, о&nbsp;чем ваш материал, и&nbsp;мог найти
на&nbsp;страницах интересных ему тем. Темы можно менять местами, первая тема становится его на&nbsp;страницах интересных ему тем. Темы можно менять местами, первая тема
заглавной становится заглавной
</p> </p>
<div class="pretty-form__item"> <div class="pretty-form__item">
<input type="text" name="topics" id="topics" placeholder="Темы" class="nolabel" /> <input type="text" name="topics" id="topics" placeholder="Темы" class="nolabel" />
@ -102,6 +105,7 @@ export const CreateView = () => {
</div> </div>
</form> </form>
</Suspense> </Suspense>
</>
) )
} }