import variables from 'config/variables'; import { PureComponent } from 'react'; import { toast } from 'react-toastify'; import { TextField } from '@mui/material'; import { Description, Field, Label, Textarea, Input } from '@headlessui/react'; import { MdRefresh } from 'react-icons/md'; import clsx from 'clsx'; import EventBus from 'utils/eventbus'; class Text extends PureComponent { constructor(props) { super(props); this.state = { value: localStorage.getItem(this.props.name) || '', }; } handleChange = (e) => { let { value } = e.target; // Alex wanted font to work with montserrat and Montserrat, so I made it work if (this.props.upperCaseFirst === true) { value = value.charAt(0).toUpperCase() + value.slice(1); } localStorage.setItem(this.props.name, value); this.setState({ value, }); if (this.props.element) { if (!document.querySelector(this.props.element)) { document.querySelector('.reminder-info').style.display = 'flex'; return localStorage.setItem('showReminder', true); } } EventBus.emit('refresh', this.props.category); }; resetItem = () => { this.handleChange({ target: { value: this.props.default || '', }, }); toast(variables.getMessage('toasts.reset')); }; render() { return (
{variables.getMessage('modals.main.settings.buttons.reset')}
{this.props.textarea === true ? ( <>