const Header = styled.div` width: 100%; display: flex; flex-direction: row; justify-content: space-between; align-items: center; `; const Title = styled.div` font-size: 24px; line-height: 33.6px; `; const Form = styled.div` display: flex; flex-direction: column; gap: 4px; `; const Input = styled.input` width: 100%; `; const TextArea = styled.textarea` width: 100%; `; const ButtonRow = styled.div` display: flex; flex-direction: row; gap: 4px; `; const typeStr = "efiz.near/type/Post"; const type = Type.get(typeStr); State.init({"caption":"","author":"","img":"","text":""}); function composeData() { const data = { thing: { main: JSON.stringify(state), }, index: { tempeverything: JSON.stringify({ key: "main", value: { type: typeStr, }, }), }, }; return data; } return ( <> <Header> <Title>{typeStr.split("/")[2]}</Title> </Header> <Form><Input placeholder="caption" onChange={({ target }) => State.update({ "caption": target.value })} /> <Input placeholder="author" onChange={({ target }) => State.update({ "author": target.value })} /> <Input placeholder="img" onChange={({ target }) => State.update({ "img": target.value })} /> <TextArea placeholder="text" onInput={({ target }) => State.update({ "text": target.value })} /><ButtonRow> <CommitButton force data={composeData} onCommit={resetThing} > create </CommitButton> </ButtonRow> </Form> </> );