Skip to content
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

Refactor BlockListItem component to use custom hook and functional component #5615

Closed
geriux opened this issue Mar 30, 2023 · 0 comments · Fixed by WordPress/gutenberg#49765
Assignees

Comments

@geriux
Copy link
Contributor

geriux commented Mar 30, 2023

The BlockListItem component is currently using a class component and the ReadableContentView component to handle the max width of the canvas and provide alignment styles. We want to refactor this component to use a custom hook (depending on #5614) and a functional component instead.

The proposed changes are:

  • Replace the usage of ReadableContentView with a custom hook that will handle the max width of the canvas and provide alignment styles. The hook will return just the styles and should leverage the useWindowDimensions hook.
  • Calculate the getMarginHorizontal in the same custom hook that will be created from ReadableContentView to improve performance, then we would just have one View that will have all of this data.
  • Refactor the BlockListItem component to be a functional component instead of a class component.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant