-
Notifications
You must be signed in to change notification settings - Fork 1.8k
improvement: add resizer component #1538
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
improvement: add resizer component #1538
Conversation
great! I've configured netlify actions for |
eb843f3
to
ddc160e
Compare
Yeah, I saw it. Can you review the PR @acao |
@harshithpabbati still reviewing! |
className={className} | ||
style={{ | ||
cursor: `${dir}-resize`, | ||
...style, |
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.
a) should we use style
here or _css
or sm
?
b) would it make more sense to just spread rest props instead of a style prop?
c) should we be using a different component if we want to allow theme-ui 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.
Generally, the style
attribute is good to use for dynamic styles, but it doesn't look like that's really the case here, unless dir
changes frequently. If dir
is changing based on mouse events, etc., then style
is fine to use here. For passing through style
as props, it's sort of the same thing, but I haven't looked at where that's coming from. Does that make sense?
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! ok good, just wanted to make sure we weren't baking in anything that would "break" theme-ui implementations or user extensibility
const { dir, onStart, onEnd, onUpdate, className, style, children } = props; | ||
|
||
const [isDragging, setIsDragging] = useState(false); | ||
const listenersRef = useRef<ResizeHandlerData['listenersRef']>(null); |
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.
would we want to use forwardRef
here to allow users to pass ref
? or do we only need it internally?
className={className} | ||
style={{ | ||
position: 'relative', | ||
...containerStyle, |
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.
same here, maybe shouldn't spread style props instead of just spreading props
@harshithpabbati most of my review questions are related to extensibility. so for now, I think this looks great overall for the firs tpass. as we begin to implement it in our own components, we will probably find ways we need to extend it for our purposes and for the purposes of plugin developers (this includes my comments about forwardRef, etc) |
Yeah sure, we can extend it when we begin implementing that into our components. |
This PR adds a new Resizer component. So we will be able to resize the editors. We can simply wrap the editor with resizer component like this
This above example will add a resizer option below the
main
tag and we can also pass the required styles to it.@acao can you review this