Skip to content

Conversation

@gorgeousvlad
Copy link
Contributor

No description provided.

@gorgeousvlad gorgeousvlad requested a review from NikitaCG June 14, 2023 15:03
@gorgeousvlad gorgeousvlad changed the title Add editor mode switch fixed feat: add editor mode switch Jun 14, 2023
@gravity-ui-bot
Copy link
Contributor

Preview is ready.

$buttonIconSize: 16px;
$buttonWidth: 76px;
$buttonHeight: 40px;
$zIndex: 110;
Copy link
Collaborator

Choose a reason for hiding this comment

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

up to you, but if we use this variable one time, maybe we dont need this variable ?

onViewModeChange,
className,
}: ControlPanelProps) => {
return (
Copy link
Collaborator

Choose a reason for hiding this comment

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

return jsx immediately

if (isEditingMode) {
return {
content,
custom: addCustomDecorator(
Copy link
Collaborator

Choose a reason for hiding this comment

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

maybe refactor like this:

{
  ....
  const customProp = isEditingMode ? ... : rest.custom;
  ...
  return {content, custom: customProp};
}

@@ -0,0 +1,11 @@
import {useEffect, useRef} from 'react';

export default function usePrevious<T>(value: T) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

if we use this hook to save previous value, i think we need named this hook like usePreviousValue, because it's not obvious what the previous entity is

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

yuberdysheva
yuberdysheva previously approved these changes Jun 15, 2023
@gorgeousvlad gorgeousvlad merged commit 118a369 into main Jun 16, 2023
@gorgeousvlad gorgeousvlad deleted the add-editor-mode-switch-fixed branch June 16, 2023 10:16
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