Publish Settings show field name (#180)

Publish Settings show field name
This commit is contained in:
Ilya Y 2023-08-16 16:11:58 +03:00 committed by GitHub
parent caac88deb7
commit 542f669a94
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 34 additions and 6 deletions

View File

@ -82,7 +82,7 @@
"Decline": "Decline", "Decline": "Decline",
"Delete": "Delete", "Delete": "Delete",
"Delete cover": "Delete cover", "Delete cover": "Delete cover",
"Description": "Description...", "Description": "Description",
"Discours": "Discours", "Discours": "Discours",
"Discours is an intellectual environment, a web space and tools that allows authors to collaborate with readers and come together to co-create publications and media projects": "Discours is an intellectual environment, a web space and tools that allows authors to collaborate with readers and come together to co-create publications and media projects", "Discours is an intellectual environment, a web space and tools that allows authors to collaborate with readers and come together to co-create publications and media projects": "Discours is an intellectual environment, a web space and tools that allows authors to collaborate with readers and come together to co-create publications and media projects",
"Discours is created with our common effort": "Discours exists because of our common effort", "Discours is created with our common effort": "Discours exists because of our common effort",

View File

@ -86,7 +86,7 @@
"Decline": "Отмена", "Decline": "Отмена",
"Delete": "Удалить", "Delete": "Удалить",
"Delete cover": "Удалить обложку", "Delete cover": "Удалить обложку",
"Description": "Описание...", "Description": "Описание",
"Discours": "Дискурс", "Discours": "Дискурс",
"Discours is an intellectual environment, a web space and tools that allows authors to collaborate with readers and come together to co-create publications and media projects": "Дискурс — это интеллектуальная среда, веб-пространство и инструменты, которые позволяют авторам сотрудничать с читателями и объединяться для совместного создания публикаций и медиапроектов", "Discours is an intellectual environment, a web space and tools that allows authors to collaborate with readers and come together to co-create publications and media projects": "Дискурс — это интеллектуальная среда, веб-пространство и инструменты, которые позволяют авторам сотрудничать с читателями и объединяться для совместного создания публикаций и медиапроектов",
"Discours is created with our common effort": "Дискурс существует благодаря нашему общему вкладу", "Discours is created with our common effort": "Дискурс существует благодаря нашему общему вкладу",

View File

@ -160,7 +160,7 @@ export const PlayerPlaylist = (props: Props) => {
<div class={styles.descriptionBlock}> <div class={styles.descriptionBlock}>
<SimplifiedEditor <SimplifiedEditor
initialContent={mi.body} initialContent={mi.body}
placeholder={t('Description')} placeholder={`${t('Description')}...`}
smallHeight={true} smallHeight={true}
onAutoSave={(value) => handleMediaItemFieldChange('body', value)} onAutoSave={(value) => handleMediaItemFieldChange('body', value)}
/> />

View File

@ -167,6 +167,7 @@ export const PublishSettings = (props: Props) => {
<GrowingTextarea <GrowingTextarea
class={styles.settingInput} class={styles.settingInput}
variant="bordered" variant="bordered"
fieldName={t('Header')}
placeholder={t('Come up with a title for your story')} placeholder={t('Come up with a title for your story')}
initialValue={settingsForm.title} initialValue={settingsForm.title}
value={(value) => setSettingsForm('title', value)} value={(value) => setSettingsForm('title', value)}
@ -176,6 +177,7 @@ export const PublishSettings = (props: Props) => {
<GrowingTextarea <GrowingTextarea
class={styles.settingInput} class={styles.settingInput}
variant="bordered" variant="bordered"
fieldName={t('Subheader')}
placeholder={t('Come up with a subtitle for your story')} placeholder={t('Come up with a subtitle for your story')}
initialValue={settingsForm.subtitle} initialValue={settingsForm.subtitle}
value={(value) => setSettingsForm('subtitle', value)} value={(value) => setSettingsForm('subtitle', value)}
@ -185,6 +187,7 @@ export const PublishSettings = (props: Props) => {
<GrowingTextarea <GrowingTextarea
class={styles.settingInput} class={styles.settingInput}
variant="bordered" variant="bordered"
fieldName={t('Description')}
placeholder={t('Write a short introduction')} placeholder={t('Write a short introduction')}
initialValue={`${settingsForm.lead}`} initialValue={`${settingsForm.lead}`}
value={(value) => setSettingsForm('lead', value)} value={(value) => setSettingsForm('lead', value)}

View File

@ -2,6 +2,7 @@
display: block; display: block;
width: 100%; width: 100%;
position: relative; position: relative;
transition: 0.3s ease-in-out;
&.bordered { &.bordered {
box-sizing: border-box; box-sizing: border-box;
@ -11,6 +12,19 @@
background: var(--white-500, #fff); background: var(--white-500, #fff);
} }
&.hasFieldName {
padding-top: 24px;
}
.fieldName {
@include font-size(1.2rem);
position: absolute;
top: 6px;
left: 12px;
color: var(--black-400);
}
.growWrap { .growWrap {
display: grid; display: grid;
width: 100%; width: 100%;

View File

@ -10,6 +10,7 @@ type Props = {
maxLength?: number maxLength?: number
allowEnterKey: boolean allowEnterKey: boolean
variant?: 'bordered' variant?: 'bordered'
fieldName?: string
} }
export const GrowingTextarea = (props: Props) => { export const GrowingTextarea = (props: Props) => {
@ -30,7 +31,15 @@ export const GrowingTextarea = (props: Props) => {
} }
return ( return (
<div class={clsx(styles.GrowingTextarea, { [styles.bordered]: props.variant === 'bordered' })}> <div
class={clsx(styles.GrowingTextarea, {
[styles.bordered]: props.variant === 'bordered',
[styles.hasFieldName]: props.fieldName && value().length > 0
})}
>
<Show when={props.fieldName && value().length > 0}>
<div class={styles.fieldName}>{props.fieldName}</div>
</Show>
<div class={clsx(styles.growWrap, props.class)} data-replicated-value={value()}> <div class={clsx(styles.growWrap, props.class)} data-replicated-value={value()}>
<textarea <textarea
rows={1} rows={1}

View File

@ -458,8 +458,10 @@ form {
&:-webkit-autofill, &:-webkit-autofill,
&:not(:placeholder-shown) { &:not(:placeholder-shown) {
& ~ label { & ~ label {
font-size: 80%; @include font-size(1.2rem);
transform: translateY(-1.7em) !important;
color: var(--black-400);
transform: translateY(-1.8em) !important;
} }
} }
} }