From e5f2ce7cda4ca007d09f8caf10919afc976924ef Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Mon, 18 Jul 2022 04:22:20 +0200 Subject: [PATCH] Add a way to add prefixes and suffixes to the view mode of EditableText --- components/generic/editable/inputs.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/generic/editable/inputs.tsx b/components/generic/editable/inputs.tsx index 709ea83..78e71c1 100644 --- a/components/generic/editable/inputs.tsx +++ b/components/generic/editable/inputs.tsx @@ -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={
- {props.value} + {props.viewPrefix}{props.value}{props.viewSuffix}
} />