diff options
author | 2022-06-18 11:47:47 +0530 | |
---|---|---|
committer | 2022-06-18 22:16:09 +0530 | |
commit | 8c3323bc6c1743f04dee7598e186e07cd793ab7f (patch) | |
tree | 16b7421bb46cece0692b22e74ed228ad153bea48 /src/components/ui | |
parent | 6.0.0-nightly.66 [skip ci] (diff) | |
download | ferdium-app-8c3323bc6c1743f04dee7598e186e07cd793ab7f.tar.gz ferdium-app-8c3323bc6c1743f04dee7598e186e07cd793ab7f.tar.zst ferdium-app-8c3323bc6c1743f04dee7598e186e07cd793ab7f.zip |
Add ability to set the progressbar color from the Settings screen
Diffstat (limited to 'src/components/ui')
-rw-r--r-- | src/components/ui/ColorPickerInput.tsx | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/src/components/ui/ColorPickerInput.tsx b/src/components/ui/ColorPickerInput.tsx index 7cbdb295b..8a4d3129a 100644 --- a/src/components/ui/ColorPickerInput.tsx +++ b/src/components/ui/ColorPickerInput.tsx | |||
@@ -3,7 +3,6 @@ import { observer } from 'mobx-react'; | |||
3 | import { Field } from 'mobx-react-form'; | 3 | import { Field } from 'mobx-react-form'; |
4 | import classnames from 'classnames'; | 4 | import classnames from 'classnames'; |
5 | import { SliderPicker } from 'react-color'; | 5 | import { SliderPicker } from 'react-color'; |
6 | import { DEFAULT_APP_SETTINGS } from '../../config'; | ||
7 | 6 | ||
8 | interface IProps { | 7 | interface IProps { |
9 | field: Field; | 8 | field: Field; |
@@ -11,20 +10,12 @@ interface IProps { | |||
11 | focus?: boolean; | 10 | focus?: boolean; |
12 | }; | 11 | }; |
13 | 12 | ||
14 | interface IState { | 13 | class ColorPickerInput extends Component<IProps> { |
15 | background: string; | ||
16 | } | ||
17 | |||
18 | class ColorPickerInput extends Component<IProps, IState> { | ||
19 | static defaultProps = { | 14 | static defaultProps = { |
20 | className: null, | 15 | className: null, |
21 | focus: false, | 16 | focus: false, |
22 | }; | 17 | }; |
23 | 18 | ||
24 | state = { | ||
25 | background: DEFAULT_APP_SETTINGS.accentColor, | ||
26 | }; | ||
27 | |||
28 | inputElement: HTMLInputElement | null | undefined; | 19 | inputElement: HTMLInputElement | null | undefined; |
29 | 20 | ||
30 | componentDidMount() { | 21 | componentDidMount() { |
@@ -45,7 +36,6 @@ class ColorPickerInput extends Component<IProps, IState> { | |||
45 | 36 | ||
46 | handleChangeComplete = (color: { hex: string; }) => { | 37 | handleChangeComplete = (color: { hex: string; }) => { |
47 | const { field } = this.props; | 38 | const { field } = this.props; |
48 | this.setState({ background: color.hex }); | ||
49 | field.value = color.hex | 39 | field.value = color.hex |
50 | }; | 40 | }; |
51 | 41 | ||
@@ -67,7 +57,7 @@ class ColorPickerInput extends Component<IProps, IState> { | |||
67 | })} | 57 | })} |
68 | > | 58 | > |
69 | <SliderPicker | 59 | <SliderPicker |
70 | color={ this.state.background } | 60 | color={ field.value } |
71 | onChangeComplete={ this.handleChangeComplete } | 61 | onChangeComplete={ this.handleChangeComplete } |
72 | id={field.id} | 62 | id={field.id} |
73 | type={type} | 63 | type={type} |