-
Notifications
You must be signed in to change notification settings - Fork 22
feat: add editor forms #393
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
0593b69 to
54eaf41
Compare
|
Preview is ready. |
| type: 'string', | ||
| enum: ['events', 'blog', 'services'], | ||
| // add loadable sources here if you use it in your project | ||
| // enum: ['my-loadable-source-1', 'my-loadable-source-1'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it seems to me not very obvious how to add, can we leave an example?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, it needs a story for slider, created a ticket for it
| const Icon = editBlockControlsIcons[action]; | ||
|
|
||
| return actions[action] ? ( | ||
| <div className={b('control')} onClick={actions[action]}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we need to add key ?
| injectEditBlockProps, | ||
| } = useEditorState(rest); | ||
| const constructorProps = useMemo(() => { | ||
| return { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe () => ({ .... }) return object immediately ?
src/editor/containers/Form/Form.tsx
Outdated
| blocks: [...blocks.slice(0, index), data, ...blocks.slice(index + 1)], | ||
| }); | ||
| }} | ||
| onSelect={() => onSelect(index)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can use useCallback when we render callback in every list item. Cases for onChange and onSelect
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is the problem with useCallback, because both of this functions use index param from closure of mapping function
src/editor/containers/Form/Form.tsx
Outdated
| const blocks = content?.blocks || []; | ||
|
|
||
| return ( | ||
| <div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we can use <Fragment> in this place ?
| //getting oneOf option type from initial value | ||
| const valueType = useMemo( | ||
| () => | ||
| (props.spec?.properties && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it seems to me it is necessary to use destructurization for props, in the whole file
| const getOneOfCsutomSpecDefaultType = (spec: ObjectSpec) => | ||
| spec.viewSpec?.order?.[0] || Object.keys(spec.properties || {})[0]; | ||
|
|
||
| export const OneOfCustom: React.FC<ObjectIndependentInputProps> = (props) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's not immediately clear what kind of component, can we add some comments?
| disabled={disabled} | ||
| qa={name} | ||
| > | ||
| {options.map((option) => ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
destructurization
NikitaCG
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see in comments
No description provided.