From e1e7c2d4d86d7aeb40357add27c76a99a18350e7 Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Mon, 21 Sep 2020 21:15:46 +0900 Subject: Introduce styled-components on top of form --- .../components/form/PartialBlacklistForm.tsx | 9 +- src/settings/components/form/SearchForm.tsx | 9 +- src/settings/components/index.tsx | 96 +++++++++++++--------- src/settings/components/site.scss | 21 ----- 4 files changed, 72 insertions(+), 63 deletions(-) delete mode 100644 src/settings/components/site.scss (limited to 'src/settings') diff --git a/src/settings/components/form/PartialBlacklistForm.tsx b/src/settings/components/form/PartialBlacklistForm.tsx index 4c6bd35..dcdd00c 100644 --- a/src/settings/components/form/PartialBlacklistForm.tsx +++ b/src/settings/components/form/PartialBlacklistForm.tsx @@ -6,6 +6,11 @@ import Blacklist, { BlacklistItem } from "../../../shared/settings/Blacklist"; const Grid = styled.div``; +const GridHeader = styled.div` + display: flex; + font-weight: bold; +`; + const GridRow = styled.div` display: flex; `; @@ -48,10 +53,10 @@ class PartialBlacklistForm extends React.Component { return ( <> - + URL Keys - + {this.props.value.items.map((item, index) => { if (!item.partial) { return null; diff --git a/src/settings/components/form/SearchForm.tsx b/src/settings/components/form/SearchForm.tsx index 3ba0299..cc7061a 100644 --- a/src/settings/components/form/SearchForm.tsx +++ b/src/settings/components/form/SearchForm.tsx @@ -6,6 +6,11 @@ import { FormSearch } from "../../../shared/SettingData"; const Grid = styled.div``; +const GridHeader = styled.div` + display: flex; + font-weight: bold; +`; + const GridRow = styled.div` display: flex; `; @@ -50,11 +55,11 @@ class SearchForm extends React.Component { return ( <> - + Name URL Default - + {value.engines.map((engine, index) => { return ( diff --git a/src/settings/components/index.tsx b/src/settings/components/index.tsx index d204210..2e2ff52 100644 --- a/src/settings/components/index.tsx +++ b/src/settings/components/index.tsx @@ -1,6 +1,6 @@ -import "./site.scss"; import React from "react"; import { connect } from "react-redux"; +import styled from "styled-components"; import TextArea from "./ui/TextArea"; import Radio from "./ui/Radio"; import SearchForm from "./form/SearchForm"; @@ -19,6 +19,28 @@ import { State as AppState } from "../reducers/setting"; import Properties from "../../shared/settings/Properties"; import Blacklist from "../../shared/settings/Blacklist"; +const Container = styled.form` + padding: 2px; + font-family: system-ui; +`; + +const Fieldset = styled.fieldset` + margin: 0; + padding: 0; + border: none; + margin-top: 1rem; + + &:first-of-type { + margin-top: 1rem; + } +`; + +const Legend = styled.legend` + font-size: 1.5rem; + padding: 0.5rem 0; + font-weight: bold; +`; + const DO_YOU_WANT_TO_CONTINUE = "Some settings in JSON can be lost when migrating. " + "Do you want to continue?"; @@ -41,47 +63,47 @@ class SettingsComponent extends React.Component { renderFormFields(form: FormSettings) { return (
-
- Keybindings +
+ Keybindings -
-
- Search Engines +
+
+ Search Engines -
-
- Blacklist +
+
+ Blacklist -
-
- Partial blacklist +
+
+ Partial blacklist -
-
- Properties +
+
+ Properties -
+
); } @@ -111,30 +133,28 @@ class SettingsComponent extends React.Component { fields = this.renderJsonFields(this.props.json!, this.props.error); } return ( -
+

Configure Vim-Vixen

-
- + - - {fields} - -
+ + {fields} + ); } diff --git a/src/settings/components/site.scss b/src/settings/components/site.scss deleted file mode 100644 index e8415e8..0000000 --- a/src/settings/components/site.scss +++ /dev/null @@ -1,21 +0,0 @@ -.vimvixen-settings-form { - padding: 2px; - font-family: system-ui; - - fieldset { - margin: 0; - padding: 0; - border: none; - margin-top: 1rem; - - fieldset:first-of-type { - margin-top: 1rem; - } - - legend { - font-size: 1.5rem; - padding: .5rem 0; - font-weight: bold; - } - } -} -- cgit v1.2.3