Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pistonite/celera",
"version": "0.1.4",
"version": "0.1.5",
"type": "module",
"private": true,
"description": "In-house UI framework",
Expand Down
11 changes: 9 additions & 2 deletions src/components/resize_layout.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { makeStyles, mergeClasses } from "@fluentui/react-components";
import { Children, useRef, useState, type PropsWithChildren } from "react";

import { isMobile } from "#pref";

/**
* React component. A flex-box layout of 2 children, with a draggable divider between them.
*
Expand Down Expand Up @@ -28,7 +30,10 @@ export interface ResizeLayoutOwnProps {
/** Use the natural size instead of valuePercent */
naturalSize?: boolean;

/** Optimize for touch screen */
/**
* Force enable styles for touch screen. Note that by default it is enabled
* if the device is mobile
*/
touch?: boolean;
}

Expand Down Expand Up @@ -88,8 +93,8 @@ export const ResizeLayout: React.FC<PropsWithChildren<ResizeLayoutProps>> = (inP
naturalSize,
minWidth,
minHeight,
touch,
children,
touch: propTouch,
...props
} = inProps;
const [firstChild, secondChild] = Children.toArray(children);
Expand All @@ -100,6 +105,8 @@ export const ResizeLayout: React.FC<PropsWithChildren<ResizeLayoutProps>> = (inP
// [startX, startY, startWidth, startHeight]
const [resizing, setResizing] = useState<number[] | undefined>(undefined);

const touch = propTouch || isMobile();

const startResize = (e: React.MouseEvent | React.TouchEvent) => {
if (disabled || !firstRef.current) {
return;
Expand Down
Loading