From 91d165cab915e94aadaaf29b9e18a1f42a888f56 Mon Sep 17 00:00:00 2001 From: Jake Archibald Date: Thu, 18 Oct 2018 08:17:39 +0100 Subject: [PATCH] Custom select elements & more form work --- src/codecs/imagequant/options.tsx | 63 +++++++++++-------- src/codecs/resize/options.tsx | 11 ++-- src/components/Options/index.tsx | 43 ++++++------- src/components/Options/style.scss | 11 +++- .../Output/custom-els/TwoUp/styles.css | 2 +- src/components/expander/index.tsx | 4 +- src/components/expander/style.scss | 1 - src/components/select/index.tsx | 16 +++++ src/components/select/style.scss | 24 +++++++ 9 files changed, 119 insertions(+), 56 deletions(-) create mode 100644 src/components/select/index.tsx create mode 100644 src/components/select/style.scss diff --git a/src/codecs/imagequant/options.tsx b/src/codecs/imagequant/options.tsx index 82eb82bd..6ae1fda2 100644 --- a/src/codecs/imagequant/options.tsx +++ b/src/codecs/imagequant/options.tsx @@ -2,6 +2,9 @@ import { h, Component } from 'preact'; import { bind } from '../../lib/initial-util'; import { inputFieldValueAsNumber, konami } from '../../lib/util'; import { QuantizeOptions } from './processor-meta'; +import * as style from '../../components/options/style.scss'; +import Expander from '../../components/expander'; +import Select from '../../components/select'; const konamiPromise = konami(); @@ -28,8 +31,10 @@ export default class QuantizerOptions extends Component { const form = (event.currentTarget as HTMLInputElement).closest('form') as HTMLFormElement; const options: QuantizeOptions = { - zx: inputFieldValueAsNumber(form.zx), - maxNumColors: inputFieldValueAsNumber(form.maxNumColors), + zx: form.zx ? inputFieldValueAsNumber(form.zx) : this.props.options.zx, + maxNumColors: form.maxNumColors + ? inputFieldValueAsNumber(form.maxNumColors) + : this.props.options.maxNumColors, dither: inputFieldValueAsNumber(form.dither), }; this.props.onChange(options); @@ -37,29 +42,37 @@ export default class QuantizerOptions extends Component { render({ options }: Props, { extendedSettings }: State) { return ( -
- - -