-
Notifications
You must be signed in to change notification settings - Fork 6
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
feat: basic dragResize component and storybook examples #206
Conversation
import React, { createRef, useEffect, useState } from 'react'; | ||
import style from './dragResize.module.css'; | ||
|
||
export type DragResizeProps = { |
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.
can you move on top the mandatory properties, please?
src/dragResize/DragResize.tsx
Outdated
firstPaneMinSize?: number; | ||
}; | ||
|
||
const FirstPane: React.FunctionComponent<{ |
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.
I suppose that is the way:
const FirstPane:= ({
children,
width,
height,
setWidth,
setHeight,
orientation,
className,
}: FirstPaneProps) => {
and you define the FirstPaneProps ?
src/dragResize/DragResize.tsx
Outdated
const isVertical = orientation === 'vertical'; | ||
|
||
useEffect(() => { | ||
if (firstRef.current) { |
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.
why not:
if (firstRef.current && isVertical && !width) {
setWidth(firstRef.current.clientWidth);
} else if(!height) {
setHeight(firstRef.current.clientHeight);
}
Height to be applied as a percentage as opposed to in |
Component and Storybook examples of horizontal and vertical dragResize component
#169