From 063ceb215f858a8e2a5bde85d8f9ca24240894c6 Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Mon, 21 Sep 2020 15:20:41 +0900 Subject: Separate input component --- src/settings/components/form/KeymapsForm.tsx | 5 +- src/settings/components/index.tsx | 12 ++-- src/settings/components/ui/Input.tsx | 89 ---------------------------- src/settings/components/ui/Radio.tsx | 44 ++++++++++++++ src/settings/components/ui/Text.tsx | 42 +++++++++++++ src/settings/components/ui/TextArea.tsx | 42 +++++++++++++ 6 files changed, 135 insertions(+), 99 deletions(-) delete mode 100644 src/settings/components/ui/Input.tsx create mode 100644 src/settings/components/ui/Radio.tsx create mode 100644 src/settings/components/ui/Text.tsx create mode 100644 src/settings/components/ui/TextArea.tsx (limited to 'src/settings/components') diff --git a/src/settings/components/form/KeymapsForm.tsx b/src/settings/components/form/KeymapsForm.tsx index b9af0df..25578ad 100644 --- a/src/settings/components/form/KeymapsForm.tsx +++ b/src/settings/components/form/KeymapsForm.tsx @@ -1,6 +1,6 @@ import "./KeymapsForm.scss"; import React from "react"; -import Input from "../ui/Input"; +import Text from "../ui/Text"; import keymaps from "../../keymaps"; import { FormKeymaps } from "../../../shared/SettingData"; @@ -27,8 +27,7 @@ class KeymapsForm extends React.Component { {group.map(([name, label]) => { const value = values[name] || ""; return ( - { renderJsonFields(json: JSONTextSettings, error: string) { return (
- {

Configure Vim-Vixen

- { disabled={disabled} /> - { - name: string; - type: string; - error?: string; - label: string; - value: string; - onValueChange?: (name: string, value: string) => void; - onBlur?: (e: React.FocusEvent) => void; -} - -class Input extends React.Component { - renderText(props: Props) { - const inputClassName = props.error ? "input-error" : ""; - const pp = { ...props }; - delete pp.onValueChange; - return ( -
- - -
- ); - } - - renderRadio(props: Props) { - const inputClassName = props.error ? "input-error" : ""; - const pp = { ...props }; - delete pp.onValueChange; - return ( -
- -
- ); - } - - renderTextArea(props: Props) { - const inputClassName = props.error ? "input-error" : ""; - const pp = { ...props }; - delete pp.onValueChange; - return ( -
- -