Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Window improvements #344

WesSouza started this conversation in Ideas
Discussion options

The current Window could provide more components and settings to allow easily building windows. I propose some API changes:

  • Create WindowTitle (or WindowTitleText, WindowIcon and WindowControls components that can be children of WindowHeader (or WindowTitle)
  • Allow title?: React.Node, icon?: React.Node, onClose?: () => void | null, onMinimize?: () => void | null and onMaximize?: () => void | null as shorthands to Window which preconfigure the window title accordingly, and status?: React.Node which renders below the window content.
    • If the events are undefined, the icon isn't displayed, and if they are null the icon is disabled.
  • Implement moving and resizing
    • Add x?: number and y?: number for left and top initial positioning respectively
    • Add width?: number and height?: number for the initial window dimensions
    • Implement an onMove: (event: { preventDefault: () => void, { target: { rect: DOMRect } } }) => void, which moves the window but allows the event handler code to prevent that movement (e.g. stick to a frame)
    • Implement an onResize: (event: { preventDefault: () => void, { target: { rect: DOMRect } } }) => void, which resizes the window but allows the event handler code to prevent that resizing (e.g. minimum or maximum sizes)
    • Implement helpers on common that allow users to detect collisions
    • Add a windowResizeWithContent: boolean to the theme that controls if all windows should render their content when being moved or resized, or move as a floating border (Figure 1)
  • Implement the variant?: 'toolbar' (or thin) to implement toolbar windows (Figure 1)

Figure 1 (source):
Toolbar window being dragged

You must be logged in to vote

Replies: 0 comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet
1 participant

AltStyle によって変換されたページ (->オリジナル) /