MCPcopy Create free account
hub / github.com/AlexErrant/Pentive / FieldValue

Function FieldValue

app/src/components/fieldsEditor.tsx:40–101  ·  view source on GitHub ↗
(props)

Source from the content-addressed store, hash-verified

38 noteCard?: NoteCardView
39 }>
40}> = (props) => {
41 const [isDev, setDev] = createSignal(false)
42 const [isOpen, setOpen] = createSignal(true)
43 return (
44 <>
45 <div class='flex items-center justify-between'>
46 <ToggleButton.Root
47 class='focus-visible:outline-offset-1'
48 aria-label='Field Value editor toggle'
49 pressed={isOpen()}
50 onChange={setOpen}
51 >
52 <div class='flex items-center gap-2'>
53 <ChevronDown
54 class='h-3 w-3'
55 classList={{ '-rotate-90': !isOpen() }}
56 />
57 {props.field}
58 </div>
59 </ToggleButton.Root>
60 <Show when={isOpen()}>
61 <ToggleButton.Root
62 class='h-5 w-5 rounded-md focus-visible:outline-offset-1'
63 aria-label='code and wysiwyg toggle'
64 pressed={isDev()}
65 onChange={setDev}
66 >
67 {isDev() ? <Quote /> : <Code />}
68 </ToggleButton.Root>
69 </Show>
70 </div>
71 <Show when={isOpen()}>
72 <Show
73 when={isDev()}
74 fallback={
75 <FieldEditor
76 field={props.field}
77 value={props.value}
78 setNoteCard={props.setNoteCard}
79 noteId={props.noteId}
80 />
81 }
82 >
83 <FieldHtmlEditor
84 value={props.value}
85 css={props.css}
86 noteId={props.noteId}
87 setValue={(v) => {
88 props.setNoteCard(
89 'noteCard',
90 'note',
91 'fieldValues',
92 props.field,
93 v,
94 )
95 }}
96 />
97 </Show>

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected