From dc746cbf6f7b9c3b8da8ad3315ce42d8565c7374 Mon Sep 17 00:00:00 2001 From: Toni Dezman Date: Thu, 17 Aug 2017 16:52:26 +0200 Subject: [PATCH] a lot of styles for Settings page --- app/javascript/packs/app/constants/colors.js | 7 +++ .../packs/src/settings/components/Avatar.jsx | 11 ++++- .../src/settings/components/InputDisabled.jsx | 44 +++++++++++++----- .../src/settings/components/InputEnabled.jsx | 27 ++++++++++- .../src/settings/components/InputTimezone.jsx | 40 +++++++++++++++- .../src/settings/components/MyProfile.jsx | 9 +++- .../src/settings/components/MyStatistics.jsx | 10 +++- .../settings/components/MyStatisticsBox.jsx | 5 +- .../components/NotificationsGroup.jsx | 13 ++++-- .../components/NotificationsSwitch.jsx | 46 ++++++++++++++----- .../settings/components/SettingsAccount.jsx | 39 ++++++++++++++++ .../settings/components/SettingsLeftTab.jsx | 22 +++++++-- .../components/SettingsPreferences.jsx | 42 ++++++++++++----- .../src/settings/components/SettingsTeams.jsx | 20 ++++++++ 14 files changed, 283 insertions(+), 52 deletions(-) create mode 100644 app/javascript/packs/src/settings/components/SettingsAccount.jsx create mode 100644 app/javascript/packs/src/settings/components/SettingsTeams.jsx diff --git a/app/javascript/packs/app/constants/colors.js b/app/javascript/packs/app/constants/colors.js index d86e42085..b2538c7b3 100644 --- a/app/javascript/packs/app/constants/colors.js +++ b/app/javascript/packs/app/constants/colors.js @@ -1,6 +1,13 @@ export const MAIN_COLOR_BLUE = "#37a0d9"; +export const LIGHT_BLUE_COLOR = "#37a0d9"; export const WHITE_COLOR = "#fff"; export const BORDER_GRAY_COLOR = "#d2d2d2"; +export const DARK_GRAY_COLOR = "#7a7a7a"; +export const BORDER_LIGHT_COLOR = "#e3e3e3"; export const WILD_SAND_COLOR = "#f5f5f5"; export const MYSTIC_COLOR = "#eaeff2"; export const ICON_GREEN_COLOR = "#8fd13f"; +export const PRIMARY_GREEN_COLOR = "#8fd13f"; +export const PRIMARY_HOVER_COLOR = "#75b22b"; +export const NOTIFICATION_YES = "#5a8921"; +export const NOTIFICATION_YES_BORDER = "#4d751c"; diff --git a/app/javascript/packs/src/settings/components/Avatar.jsx b/app/javascript/packs/src/settings/components/Avatar.jsx index 530537593..39c4ff474 100644 --- a/app/javascript/packs/src/settings/components/Avatar.jsx +++ b/app/javascript/packs/src/settings/components/Avatar.jsx @@ -2,6 +2,8 @@ import React from "react"; import PropTypes, { string } from "prop-types"; import styled from "styled-components"; +import { WHITE_COLOR, DARK_GRAY_COLOR } from "../../../app/constants/colors"; + const AvatarWrapper = styled.div` width: 100px; height: 100px; @@ -9,17 +11,22 @@ const AvatarWrapper = styled.div` cursor: pointer; `; const EditAvatar = styled.span` + color: ${WHITE_COLOR}; + background-color: ${DARK_GRAY_COLOR}; position: absolute; left: 0; bottom: 0; width: 100%; - background-color: silver; + opacity: 0.7; + padding: 5px; `; const Avatar = props => default avatar - Edit Avatar + + Edit Avatar + ; Avatar.propTypes = { diff --git a/app/javascript/packs/src/settings/components/InputDisabled.jsx b/app/javascript/packs/src/settings/components/InputDisabled.jsx index 0c64ac4c8..49f20eab1 100644 --- a/app/javascript/packs/src/settings/components/InputDisabled.jsx +++ b/app/javascript/packs/src/settings/components/InputDisabled.jsx @@ -1,19 +1,41 @@ import React from "react"; import { string, func } from "prop-types"; import { FormGroup, FormControl, ControlLabel, Button } from "react-bootstrap"; +import styled from "styled-components"; + +const Wrapper = styled.div`margin-top: 19px;`; + +const MyFormControl = styled(FormControl)` + width: 150px; + display: inline; +`; + +const MyButton = styled(Button)` + border-radius: 0 50px 50px 0; + margin-top: -3px; + margin-left: -3px; +`; const InputDisabled = props => -
- - - {props.labelValue} - - - - -
; + +
+ + + {props.labelValue} + + + + + Edit + + + +
+
; InputDisabled.propTypes = { labelValue: string.isRequired, diff --git a/app/javascript/packs/src/settings/components/InputEnabled.jsx b/app/javascript/packs/src/settings/components/InputEnabled.jsx index 28f5cb848..f0cab552e 100644 --- a/app/javascript/packs/src/settings/components/InputEnabled.jsx +++ b/app/javascript/packs/src/settings/components/InputEnabled.jsx @@ -3,9 +3,29 @@ import PropTypes from "prop-types"; import styled from "styled-components"; import { FormGroup, FormControl, ControlLabel, Button } from "react-bootstrap"; +import { + BORDER_LIGHT_COLOR, + PRIMARY_GREEN_COLOR, + PRIMARY_HOVER_COLOR +} from "../../../app/constants/colors"; + const StyledInputEnabled = styled.div` - border: 1px solid black; - padding: 10px; + border: 1px solid ${BORDER_LIGHT_COLOR}; + padding: 19px; + margin: 20px 0; + + input { + margin-bottom: 15px; + } + + .btn-primary { + background-color: ${PRIMARY_GREEN_COLOR}; + border-color: ${PRIMARY_HOVER_COLOR}; + margin-right: 7px; + &:hover { + background-color: ${PRIMARY_HOVER_COLOR}; + } + } `; const ErrorMsg = styled.div`color: red;`; @@ -111,6 +131,9 @@ class InputEnabled extends Component {
{this.confirmationField()} +

+ Change {this.props.labelValue.toLowerCase()} +

{this.props.labelValue} diff --git a/app/javascript/packs/src/settings/components/InputTimezone.jsx b/app/javascript/packs/src/settings/components/InputTimezone.jsx index 3d1b918e7..3cd237def 100644 --- a/app/javascript/packs/src/settings/components/InputTimezone.jsx +++ b/app/javascript/packs/src/settings/components/InputTimezone.jsx @@ -1,9 +1,39 @@ import React, { Component } from "react"; import PropType from "prop-types"; import { Button } from "react-bootstrap"; +import styled from "styled-components"; import TimezonePicker from "react-bootstrap-timezone-picker"; import "react-bootstrap-timezone-picker/dist/react-bootstrap-timezone-picker.min.css"; +import { + BORDER_LIGHT_COLOR, + PRIMARY_GREEN_COLOR, + PRIMARY_HOVER_COLOR +} from "../../../app/constants/colors"; + +const Wrapper = styled.div` + border: 1px solid ${BORDER_LIGHT_COLOR}; + padding: 19px; + margin: 20px 0; + + input { + margin-bottom: 3px; + } + + .settings-warning { + margin-bottom: 15px; + } + + .btn-primary { + background-color: ${PRIMARY_GREEN_COLOR}; + border-color: ${PRIMARY_HOVER_COLOR}; + margin-right: 7px; + &:hover { + background-color: ${PRIMARY_HOVER_COLOR}; + } + } +`; + class InputTimezone extends Component { constructor(props) { super(props); @@ -28,7 +58,7 @@ class InputTimezone extends Component { } render() { return ( -
+

{this.props.labelValue}

@@ -40,13 +70,19 @@ class InputTimezone extends Component { onChange={this.handleChange} className="time-zone-container" /> +
+ + Time zone setting affects all time & date fields throughout + application. + +
-
+ ); } } diff --git a/app/javascript/packs/src/settings/components/MyProfile.jsx b/app/javascript/packs/src/settings/components/MyProfile.jsx index a75c2b2bd..08616cbb1 100644 --- a/app/javascript/packs/src/settings/components/MyProfile.jsx +++ b/app/javascript/packs/src/settings/components/MyProfile.jsx @@ -1,6 +1,7 @@ import React, { Component } from "react"; import { connect } from "react-redux"; import PropTypes from "prop-types"; +import styled from "styled-components"; import Avatar from "./Avatar"; import InputDisabled from "./InputDisabled"; @@ -14,6 +15,12 @@ import { changeAvatar } from "../../../shared/actions/UsersActions"; +const AvatarLabel = styled.h4` + margin-top: 15px; + font-size: 13px; + font-weight: 700; +`; + class MyProfile extends Component { constructor(props) { super(props); @@ -152,7 +159,7 @@ class MyProfile extends Component { return (

My Profile

-

Avatar

+ Avatar {avatarField} {fullNameField} {initialsField} diff --git a/app/javascript/packs/src/settings/components/MyStatistics.jsx b/app/javascript/packs/src/settings/components/MyStatistics.jsx index 10bce4a1d..22778b818 100644 --- a/app/javascript/packs/src/settings/components/MyStatistics.jsx +++ b/app/javascript/packs/src/settings/components/MyStatistics.jsx @@ -1,9 +1,15 @@ import React, { Component } from "react"; import { connect } from "react-redux"; import PropTypes from "prop-types"; +import styled from "styled-components"; import MyStatisticsBox from "./MyStatisticsBox"; +const Wrapper = styled.div` + margin-left: -15px; + width: 260px; +`; + class MyStatistics extends Component { render() { const stats = this.props.statistics; @@ -12,7 +18,7 @@ class MyStatistics extends Component { let boxes =
Loading...
; if (stats) { boxes = ( -
+ -
+ ); } diff --git a/app/javascript/packs/src/settings/components/MyStatisticsBox.jsx b/app/javascript/packs/src/settings/components/MyStatisticsBox.jsx index 08a8e0be0..60d203a57 100644 --- a/app/javascript/packs/src/settings/components/MyStatisticsBox.jsx +++ b/app/javascript/packs/src/settings/components/MyStatisticsBox.jsx @@ -2,14 +2,17 @@ import React from "react"; import styled from "styled-components"; import PropTypes from "prop-types"; +import { MAIN_COLOR_BLUE } from "../../../app/constants/colors"; + const Box = styled.div` width: 100px; height: 100px; color: #fff; - background-color: silver; + background-color: ${MAIN_COLOR_BLUE}; display: inline-block; margin: 15px; text-align: center; + border-radius: 0.25em; `; const MyStatisticsBox = props => diff --git a/app/javascript/packs/src/settings/components/NotificationsGroup.jsx b/app/javascript/packs/src/settings/components/NotificationsGroup.jsx index 494fb9a2c..a61795f61 100644 --- a/app/javascript/packs/src/settings/components/NotificationsGroup.jsx +++ b/app/javascript/packs/src/settings/components/NotificationsGroup.jsx @@ -5,6 +5,11 @@ import styled from "styled-components"; import NotificationsSwitchGroup from "./NotificationsSwitchGroup"; import { WHITE_COLOR } from "../../../app/constants/colors"; +const IconWrapper = styled.div` + margin-top: 12px; + margin-left: 7px; +`; + const Icon = styled.span` border-radius: 50%; color: ${WHITE_COLOR}; @@ -54,12 +59,14 @@ class NotificationsGroup extends Component { return (
-
+ {imgOrIcon} -
+
- {this.props.title} + + {this.props.title} +

{this.props.subtitle} diff --git a/app/javascript/packs/src/settings/components/NotificationsSwitch.jsx b/app/javascript/packs/src/settings/components/NotificationsSwitch.jsx index 2fa7e6bdd..6d60139b0 100644 --- a/app/javascript/packs/src/settings/components/NotificationsSwitch.jsx +++ b/app/javascript/packs/src/settings/components/NotificationsSwitch.jsx @@ -1,5 +1,27 @@ import React, { Component } from "react"; import PropTypes from "prop-types"; +import styled from "styled-components"; + +import { + WHITE_COLOR, + NOTIFICATION_YES, + NOTIFICATION_YES_BORDER +} from "../../../app/constants/colors"; + +const Wrapper = styled.div`margin-top: 13px;`; + +const LeftButton = styled.button`border-radius: 50px 0 0 50px;`; +const RightButton = styled.button` + border-radius: 0 50px 50px 0; + &.btn-primary { + color: ${WHITE_COLOR}; + border-color: ${NOTIFICATION_YES_BORDER}; + background-color: ${NOTIFICATION_YES}; + &:hover { + background-color: ${NOTIFICATION_YES_BORDER}; + } + } +`; class NotificationsSwitch extends Component { constructor(props) { @@ -20,52 +42,52 @@ class NotificationsSwitch extends Component { if (this.props.isSwitchOn) { switchBtn = (

- - +
); } else { switchBtn = (
- - +
); } return ( -
-
+ +
{this.props.title}
-
+
{switchBtn}
-
+
); } } diff --git a/app/javascript/packs/src/settings/components/SettingsAccount.jsx b/app/javascript/packs/src/settings/components/SettingsAccount.jsx new file mode 100644 index 000000000..c37e116d8 --- /dev/null +++ b/app/javascript/packs/src/settings/components/SettingsAccount.jsx @@ -0,0 +1,39 @@ +import React, { Component } from "react"; +import { Route, Switch } from "react-router-dom"; +import styled from "styled-components"; + +import SettingsLeftTab from "./SettingsLeftTab"; +import SettingsProfile from "./SettingsProfile"; +import SettingsPreferences from "./SettingsPreferences"; + +import { BORDER_LIGHT_COLOR } from "../../../app/constants/colors"; + +const Wrapper = styled.div` + background: white; + box-sizing: border-box; + border: 1px solid ${BORDER_LIGHT_COLOR}; + border-top: none; + margin: 0; + padding: 16px 0 50px 0; +`; + +class SettingsAccount extends Component { + render() { + return ( + +
+ +
+ + + + +
+ ); + } +} + +export default SettingsAccount; diff --git a/app/javascript/packs/src/settings/components/SettingsLeftTab.jsx b/app/javascript/packs/src/settings/components/SettingsLeftTab.jsx index a993e4e3b..5a5eae424 100644 --- a/app/javascript/packs/src/settings/components/SettingsLeftTab.jsx +++ b/app/javascript/packs/src/settings/components/SettingsLeftTab.jsx @@ -1,12 +1,26 @@ import React, { Component } from "react"; import { Nav, NavItem } from "react-bootstrap"; import { LinkContainer } from "react-router-bootstrap"; +import styled from "styled-components"; import { SETTINGS_ACCOUNT_PROFILE, SETTINGS_ACCOUNT_PREFERENCES } from "../../../app/routes"; +import { + MAIN_COLOR_BLUE, + LIGHT_BLUE_COLOR +} from "../../../app/constants/colors"; + +const MyLinkContainer = styled(LinkContainer)` + &.active { + a { + background-color: ${LIGHT_BLUE_COLOR} !important; + } + } +`; + class SettingsAccountLeftTab extends Component { constructor(props) { super(props); @@ -18,12 +32,12 @@ class SettingsAccountLeftTab extends Component { render() { return ( ); } diff --git a/app/javascript/packs/src/settings/components/SettingsPreferences.jsx b/app/javascript/packs/src/settings/components/SettingsPreferences.jsx index 6f6d7fd72..313ac50cd 100644 --- a/app/javascript/packs/src/settings/components/SettingsPreferences.jsx +++ b/app/javascript/packs/src/settings/components/SettingsPreferences.jsx @@ -1,21 +1,35 @@ import React, { Component } from "react"; import { connect } from "react-redux"; import PropTypes from "prop-types"; +import styled from "styled-components"; import InputDisabled from "./InputDisabled"; import InputTimezone from "./InputTimezone"; import { changeTimezone } from "../../../shared/actions/UsersActions"; import NotificationsGroup from "./NotificationsGroup"; + import { ASSIGNMENT_NOTIFICATION, RECENT_NOTIFICATION, SYSTEM_NOTIFICATION } from "./constants"; + import { MAIN_COLOR_BLUE, - ICON_GREEN_COLOR + ICON_GREEN_COLOR, + BORDER_LIGHT_COLOR } from "../../../app/constants/colors"; +const WrapperInputDisabled = styled.div` + margin: 20px 0; + padding-bottom: 15px; + border-bottom: 1px solid ${BORDER_LIGHT_COLOR}; + + .settings-warning { + margin-top: -5px; + } +`; + class SettingsPreferences extends Component { constructor(props) { super(props); @@ -45,22 +59,26 @@ class SettingsPreferences extends Component { ); } else { timezoneField = ( - this.toggleIsEditable(isTimeZoneEditable)} - /> + + this.toggleIsEditable(isTimeZoneEditable)} + /> +
+ + Time zone setting affects all time & date fields throughout + application. + +
+
); } return ( -
+
{timezoneField} - - Time zone setting affects all time & date fields throughout - application. -

Notifications

+ +

Settings Teams

+
; + +export default SettingsTeams;