diff --git a/package.json b/package.json index e4f0543463..958b782ac3 100644 --- a/package.json +++ b/package.json @@ -106,7 +106,6 @@ "slate-react": "^0.18.10", "text-encoding-utf-8": "^1.0.1", "url": "^0.11.0", - "vanilla-picker": "^2.10.0", "velocity-animate": "^1.5.2", "whatwg-fetch": "^1.1.1", "zxcvbn": "^4.4.2" diff --git a/src/components/views/settings/tabs/user/GeneralUserSettingsTab.js b/src/components/views/settings/tabs/user/GeneralUserSettingsTab.js index 5ac4e84e54..6d54df0b31 100644 --- a/src/components/views/settings/tabs/user/GeneralUserSettingsTab.js +++ b/src/components/views/settings/tabs/user/GeneralUserSettingsTab.js @@ -39,8 +39,6 @@ import IdentityAuthClient from "../../../../../IdentityAuthClient"; import {abbreviateUrl} from "../../../../../utils/UrlUtils"; import { getThreepidsWithBindStatus } from '../../../../../boundThreepids'; -import Picker from 'vanilla-picker'; - export default class GeneralUserSettingsTab extends React.Component { static propTypes = { closeSettingsFn: PropTypes.func.isRequired, @@ -399,34 +397,34 @@ export default class GeneralUserSettingsTab extends React.Component { } class CustomThemeColorField extends React.Component { + constructor(props) { + super(props); + this.state = {color: ""}; + } + componentDidMount() { setTimeout(() => { - this.value = window.getComputedStyle(document.body).getPropertyValue(`--${this.props.name}`); - this._buttonRef.style.background = this.value; + const value = window.getComputedStyle(document.body).getPropertyValue(`--${this.props.name}`).trim(); + this.setState({color: value}); }, 3000); } - _onClick = (event) => { - const button = event.target; - if (button.tagName !== "BUTTON") { - console.log("target is", button); - return; - } - console.log("clicked color " + this.props.name); - const picker = new Picker({parent: button, alpha: false, color: this.value}); - picker.onChange = color => this._onColorChanged(color); - } - - _onColorChanged(color) { - const hex = color.hex.substr(0, 7); + _onColorChanged = (event) => { + const hex = event.target.value; document.body.style.setProperty(`--${this.props.name}`, hex); document.body.style.setProperty(`--${this.props.name}-0pct`, hex + "00"); document.body.style.setProperty(`--${this.props.name}-50pct`, hex + "7F"); - this._buttonRef.style.background = hex; - this.value = hex; + this.setState({color: hex}); } render() { - return (); + const id = `color-picker-${this.props.name}`; + return (