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

feat: basic dragResize component and storybook examples #206

Closed
wants to merge 3 commits into from

Conversation

nikkialgar
Copy link
Collaborator

Component and Storybook examples of horizontal and vertical dragResize component
#169

Screenshot 2021-07-01 at 13 16 28

import React, { createRef, useEffect, useState } from 'react';
import style from './dragResize.module.css';

export type DragResizeProps = {
Copy link
Contributor

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?

firstPaneMinSize?: number;
};

const FirstPane: React.FunctionComponent<{
Copy link
Contributor

@daniele-zurico daniele-zurico Jul 1, 2021

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 ?

const isVertical = orientation === 'vertical';

useEffect(() => {
if (firstRef.current) {
Copy link
Contributor

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);
 } 

@daniele-zurico daniele-zurico added the new component new component label Jul 8, 2021
@daniele-zurico daniele-zurico linked an issue Jul 8, 2021 that may be closed by this pull request
@Ibabalola
Copy link
Contributor

Height to be applied as a percentage as opposed to in px

Base automatically changed from release/0.3 to main October 27, 2021 08:16
@daniele-zurico daniele-zurico deleted the feature/169-dragResize branch September 29, 2023 08:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new component new component
Projects
None yet
Development

Successfully merging this pull request may close these issues.

drag to resize div
3 participants