Skip to content

Conversation

@gorgeousvlad
Copy link
Contributor

No description provided.

@gravity-ui-bot
Copy link
Contributor

Preview is ready.

@gorgeousvlad
Copy link
Contributor Author

Demo:
https://preview.gravity-ui.com/page-constructor/393/?path=/story/editor-beta-main--default

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'],
Copy link
Collaborator

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?

Copy link
Contributor Author

@gorgeousvlad gorgeousvlad Jun 9, 2023

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]}>
Copy link
Collaborator

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 {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe () => ({ .... }) return object immediately ?

blocks: [...blocks.slice(0, index), data, ...blocks.slice(index + 1)],
});
}}
onSelect={() => onSelect(index)}
Copy link
Collaborator

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

Copy link
Contributor Author

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

const blocks = content?.blocks || [];

return (
<div>
Copy link
Collaborator

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 &&
Copy link
Collaborator

@NikitaCG NikitaCG Jun 9, 2023

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) => {
Copy link
Collaborator

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) => (
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

destructurization

Copy link
Collaborator

@NikitaCG NikitaCG left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see in comments

NikitaCG
NikitaCG previously approved these changes Jun 13, 2023
@gorgeousvlad gorgeousvlad changed the title Add editor forms feat: add editor forms Jun 13, 2023
@gorgeousvlad gorgeousvlad merged commit 94fd2b2 into main Jun 13, 2023
@gorgeousvlad gorgeousvlad deleted the add-editor-forms branch June 13, 2023 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants