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:
parent
531f1f6ec9
commit
e5f2ce7cda
1 changed files with 3 additions and 3 deletions
|
@ -1,11 +1,11 @@
|
||||||
import { ComponentPropsWithoutRef } from "react"
|
import { ComponentPropsWithoutRef, ReactNode } from "react"
|
||||||
import { FestaMoment } from "../renderers/datetime"
|
import { FestaMoment } from "../renderers/datetime"
|
||||||
import { FestaMarkdownRenderer } from "../renderers/markdown"
|
import { FestaMarkdownRenderer } from "../renderers/markdown"
|
||||||
import { EditingModeBranch } from "./base"
|
import { EditingModeBranch } from "./base"
|
||||||
import style from "./inputs.module.css"
|
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 FileInputProps = ComponentPropsWithoutRef<"input"> & { value?: undefined }
|
||||||
type TextAreaProps = ComponentPropsWithoutRef<"textarea"> & { value: string }
|
type TextAreaProps = ComponentPropsWithoutRef<"textarea"> & { value: string }
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ export const EditableText = (props: TextInputProps) => {
|
||||||
}
|
}
|
||||||
view={
|
view={
|
||||||
<div className={style.editableTextView}>
|
<div className={style.editableTextView}>
|
||||||
{props.value}
|
{props.viewPrefix}{props.value}{props.viewSuffix}
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|
Loading…
Reference in a new issue