mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 04:46:40 +07:00
#58 using formik at node submit form
This commit is contained in:
parent
4b542e0291
commit
b871cc2042
17 changed files with 230 additions and 423 deletions
35
src/components/editors/EditorButtons/index.tsx
Normal file
35
src/components/editors/EditorButtons/index.tsx
Normal file
|
@ -0,0 +1,35 @@
|
|||
import React, { FC } from 'react';
|
||||
import { EditorActionsPanel } from '~/components/editors/EditorActionsPanel';
|
||||
import { Group } from '~/components/containers/Group';
|
||||
import { InputText } from '~/components/input/InputText';
|
||||
import { Button } from '~/components/input/Button';
|
||||
import { Padder } from '~/components/containers/Padder';
|
||||
import { useNodeFormContext } from '~/utils/hooks/useNodeFormFormik';
|
||||
|
||||
const EditorButtons: FC = () => {
|
||||
const { values, handleChange } = useNodeFormContext();
|
||||
|
||||
return (
|
||||
<Padder style={{ position: 'relative' }}>
|
||||
<EditorActionsPanel />
|
||||
|
||||
<Group horizontal>
|
||||
<InputText
|
||||
title="Название"
|
||||
value={values.title}
|
||||
handler={handleChange('title')}
|
||||
autoFocus
|
||||
maxLength={256}
|
||||
/>
|
||||
|
||||
<Button
|
||||
title="Сохранить"
|
||||
iconRight="check"
|
||||
color={values.is_promoted ? 'primary' : 'lab'}
|
||||
/>
|
||||
</Group>
|
||||
</Padder>
|
||||
);
|
||||
};
|
||||
|
||||
export { EditorButtons };
|
Loading…
Add table
Add a link
Reference in a new issue