1
Fork 0
mirror of https://github.com/Steffo99/festa.git synced 2024-12-22 22:54:22 +00:00

Add a way to add prefixes and suffixes to the view mode of EditableText

This commit is contained in:
Steffo 2022-07-18 04:22:20 +02:00
parent 531f1f6ec9
commit e5f2ce7cda
Signed by: steffo
GPG key ID: 6965406171929D01

View file

@ -1,11 +1,11 @@
import { ComponentPropsWithoutRef } from "react"
import { ComponentPropsWithoutRef, ReactNode } from "react"
import { FestaMoment } from "../renderers/datetime"
import { FestaMarkdownRenderer } from "../renderers/markdown"
import { EditingModeBranch } from "./base"
import style from "./inputs.module.css"
type TextInputProps = ComponentPropsWithoutRef<"input"> & { value: string }
type TextInputProps = ComponentPropsWithoutRef<"input"> & { value: string, viewPrefix?: ReactNode, viewSuffix?: ReactNode }
type FileInputProps = ComponentPropsWithoutRef<"input"> & { value?: undefined }
type TextAreaProps = ComponentPropsWithoutRef<"textarea"> & { value: string }
@ -21,7 +21,7 @@ export const EditableText = (props: TextInputProps) => {
}
view={
<div className={style.editableTextView}>
{props.value}
{props.viewPrefix}{props.value}{props.viewSuffix}
</div>
}
/>