Auto-capitalize photo input titles

This commit is contained in:
Sam Becker 2023-12-29 15:57:10 -05:00
parent fd85d504e8
commit d2a26dcf36
3 changed files with 7 additions and 2 deletions

View File

@ -17,6 +17,7 @@ export default function FieldSetWithStatus({
loading,
required,
readOnly,
capitalize,
type = 'text',
inputRef,
}: {
@ -31,6 +32,7 @@ export default function FieldSetWithStatus({
loading?: boolean
required?: boolean
readOnly?: boolean
capitalize?: boolean
type?: 'text' | 'email' | 'password' | 'checkbox'
inputRef?: LegacyRef<HTMLInputElement>
}) {
@ -92,7 +94,7 @@ export default function FieldSetWithStatus({
autoComplete="off"
readOnly={readOnly || pending}
className={cc(type === 'text' && 'w-full')}
autoCapitalize="off"
autoCapitalize={!capitalize ? 'off' : undefined}
/>}
</div>
);

View File

@ -143,6 +143,7 @@ export default function PhotoForm({
options,
optionsDefaultLabel,
readOnly,
capitalize,
hideIfEmpty,
hideBasedOnCamera,
loadingMessage,
@ -163,6 +164,7 @@ export default function PhotoForm({
selectOptionsDefaultLabel={optionsDefaultLabel}
required={required}
readOnly={readOnly}
capitalize={capitalize}
placeholder={loadingMessage && !formData[key]
? loadingMessage
: undefined}

View File

@ -22,6 +22,7 @@ type FormMeta = {
note?: string
required?: boolean
readOnly?: boolean
capitalize?: boolean
hideIfEmpty?: boolean
hideTemporarily?: boolean
hideBasedOnCamera?: (make?: string, mode?: string) => boolean
@ -32,7 +33,7 @@ type FormMeta = {
};
const FORM_METADATA: Record<keyof PhotoFormData, FormMeta> = {
title: { label: 'title' },
title: { label: 'title', capitalize: true },
tags: { label: 'tags', note: 'comma-separated values' },
id: { label: 'id', readOnly: true, hideIfEmpty: true },
blurData: {