diff --git a/spec/__snapshots__/notificationSettings.spec.ts.snap b/spec/__snapshots__/notificationSettings.spec.ts.snap new file mode 100644 index 00000000..6ac2eac7 --- /dev/null +++ b/spec/__snapshots__/notificationSettings.spec.ts.snap @@ -0,0 +1,133 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Notification Settings should mount, unmount and render component should render the component 1`] = ` +
+
+ + Set Notification Position + +
+
+ +
+ - {this.renderScreens()} - + +
+ +
+ + +
+
+ {this.renderPositionButton('upper-left', 'Top Left')} + {this.renderPositionButton('lower-left', 'Bottom Left')}
- -
-
- {this.renderRadioButtons('upper-left', 'Top Left')} - {this.renderRadioButtons('lower-left', 'Bottom Left')} -
-
- {this.renderRadioButtons('upper-right', 'Top Right')} - {this.renderRadioButtons('lower-right', 'Bottom Right')} -
+
+ {this.renderPositionButton('upper-right', 'Top Right')} + {this.renderPositionButton('lower-right', 'Bottom Right')}
- +
+
-
- -
+
); } + /** + * Handles event when the component is mounted + */ public componentDidMount(): void { ipcRenderer.on('notification-settings-data', this.updateState); } + /** + * Handles event when the component is unmounted + */ public componentWillUnmount(): void { ipcRenderer.removeListener('notification-settings-data', this.updateState); } - /** - * Renders all 4 different notification position options - * - * @param id - * @param content - */ - private renderRadioButtons(id: startCorner, content: string): JSX.Element { - return ( -
- - -
- ); - } - - /** - * Renders the drop down list of available screen - */ - private renderScreens(): JSX.Element[] { - const { screens } = this.state; - return screens.map((screen, index) => { - return ( - - ); - }); - } - /** * Updates the selected display state * * @param event */ - private selectDisplay(event): void { + public selectDisplay(event): void { this.setState({ display: event.target.value }); } /** - * Updated the selected notification position + * Updates the selected notification position * * @param event */ - private togglePosition(event): void { + public togglePosition(event): void { this.setState({ - position: event.currentTarget.value, + position: event.target.id, }); } /** - * Sends the user selected notification settings options + * Submits the new settings to the main process */ - private submit(): void { + public submit(): void { const { position, display } = this.state; ipcRenderer.send('notification-settings-update', { position, display }); } @@ -166,13 +129,49 @@ export default class NotificationSettings extends React.Component<{}, IState> { /** * Closes the notification settings window */ - private close(): void { + public close(): void { ipcRenderer.send(apiName.symphonyApi, { cmd: apiCmds.closeWindow, windowType: 'notification-settings', }); } + /** + * Renders the position buttons + * + * @param id + * @param content + */ + private renderPositionButton(id: startCorner, content: string): JSX.Element { + const style = this.state.position === id ? `position-button position-button-selected ${id}` : `position-button ${id}`; + return ( +
+ +
+ ); + } + + /** + * Renders the drop down list of available screens + */ + private renderScreens(): JSX.Element[] { + const { screens } = this.state; + return screens.map((screen, index) => { + const screenId = screen.id; + return ( + + ); + }); + } + /** * Sets the component state * diff --git a/src/renderer/styles/notification-settings.less b/src/renderer/styles/notification-settings.less index c1ce3630..6c9efa50 100644 --- a/src/renderer/styles/notification-settings.less +++ b/src/renderer/styles/notification-settings.less @@ -30,8 +30,8 @@ body { padding: 16px; } -.header__title { - font-weight: 500; +.header-title { + font-weight: 300; font-style: normal; margin: 0 0 0 4px; font-size: 1.4rem; @@ -49,51 +49,104 @@ body { margin: 0 auto; } -.selector { - padding: 0 9px 0 16px; - cursor: pointer; - margin-left: 10px; +.display-label { + width: 304px; + height: 16px; + + font-size: 12px; + font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; + + color: #525760; } -.main { +.display-container { + margin-bottom: 20px; + margin-top: 5px; +} + +.display-selector { + padding: 0 20px 0 30px; + cursor: pointer; + + width: 304px; + height: 32px; + + border: 2px solid #7C7F86; + border-radius: 2px; + background-color: #FFFFFF; +} + +.position-label { + font-size: 12px; + font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; + width: 304px; + height: 16px; + color: #525760; +} + +.position-container { display: flex; flex-direction: row; - margin-bottom: 20px; - height: 100%; - border: 1px solid #ccc !important; - padding: 10px; - .first-set { + width: 304px; + height: 100%; + + left: 8px; + top: 102px; + + border-radius: 4px; + + margin-bottom: 20px; + margin-top: 5px; + + background: #F8F8F9; + + .button-set-left { flex-grow: 1; } - .second-set { + .button-set-right { flex-grow: 1; text-align: right; } } -.radio { +.position-button-container { line-height: 1.7; - .upper-right, .lower-right { - float: right; - margin-top: 6px; + .position-button { + width: 116px; + height: 32px; + + top: 1px; + + margin: 20px 20px 20px 20px; + + border: 2px solid #7C7F86; + border-radius: 4px; + box-sizing: border-box; + + font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; + font-size: 14px; + line-height: 20px; + align-items: center; + color: #17181B; } - .upper-left, .lower-left { + .position-button-selected { + background-color: #008EFF; + } + + .upper-left, + .lower-left { float: left; - margin-top: 6px; } -} -.radio__label { - cursor: pointer; - padding: 5px; - - input { - cursor: pointer; + .upper-right, + .lower-right { + float: right; } + } .footer { @@ -103,12 +156,28 @@ body { align-items: center; } -.buttonLayout { +.footer-button-container { margin-left: auto; display: flex; align-items: center; -} -.buttonDismiss { - margin-right: 10px; + .footer-button { + border: 2px solid #7C7F86; + border-radius: 4px; + box-sizing: border-box; + + font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; + font-size: 14px; + line-height: 20px; + align-items: center; + } + + .footer-button-ok { + margin-right: 5px; + } + + .footer-button-dismiss { + margin-right: 10px; + } + }