gabrielbull / react-desktop

React UI Components for macOS High Sierra and Windows 10
http://reactdesktop.js.org
MIT License
9.51k stars 461 forks source link

Add ability to disable individual titlebar controls #125

Closed davej closed 6 years ago

davej commented 6 years ago

Titlebar controls can be disabled on macOS (not sure what the status is on windows) so I added this functionality.

Usage is:

<TitleBar
  title="untitled text 5"
  controls
  isFullscreen={this.state.isFullscreen}
  onCloseClick={() => console.log('Close window')}
  onMinimizeClick={() => console.log('Minimize window')}
  onMaximizeClick={() => console.log('Mazimize window')}
  onResizeClick={() => this.setState({ isFullscreen: !this.state.isFullscreen })}
  disableClose
  disableMinimize
  disableResize
/>

And it looks like this:

image

Button styling stays disabled (i.e. doesn't change) on hover or focus. It should also be noted that this does not affect click handlers (e.g.. onCloseClick). Users can do this in their application code instead.

davej commented 6 years ago

Added disableFullscreen option which will make the resize button default to the maximize mode instead of fullscreen. Using the option key will have no effect when fullscreen is disabled.

Usage:

<TitleBar
  title="untitled text 5"
  controls
  disableFullscreen
/>

image

gabrielbull commented 6 years ago

@davej Hello dave, I am no longer maintaining this project, are you interested in being added to the project so you can merge the changes yourself?

davej commented 6 years ago

@gabrielbull Yes, sounds fine.

davej commented 6 years ago

@gabrielbull: I've done a couple of PR merges and drafted a release. Could you look at doing a release? If you want to give me publish privileges then my npm username is also davej.

gabrielbull commented 6 years ago

@davej Awesome! I've added you as a maintainer to the npm package so you can publish a new release. Amazing work!

davej commented 6 years ago

@gabrielbull Thanks 👍