diff --git a/src/codecs/imagequant/options.tsx b/src/codecs/imagequant/options.tsx index 6ae1fda2..d9dc8128 100644 --- a/src/codecs/imagequant/options.tsx +++ b/src/codecs/imagequant/options.tsx @@ -5,6 +5,7 @@ import { QuantizeOptions } from './processor-meta'; import * as style from '../../components/options/style.scss'; import Expander from '../../components/expander'; import Select from '../../components/select'; +import Range from '../../components/range'; const konamiPromise = konami(); @@ -60,29 +61,31 @@ export default class QuantizerOptions extends Component { {options.zx ? null : - + value={options.maxNumColors} + onInput={this.onChange} + > + Colors: + + } - + value={options.dither} + onInput={this.onChange} + > + Dithering: + + ); } diff --git a/src/components/Options/style.scss b/src/components/Options/style.scss index d378b52b..5bd3fa9a 100644 --- a/src/components/Options/style.scss +++ b/src/components/Options/style.scss @@ -24,6 +24,10 @@ $horizontalPadding: 15px; padding: 10px $horizontalPadding; } +.option-one-cell { + padding: 10px $horizontalPadding; +} + .option-input-first, .section-enabler { cursor: pointer; diff --git a/src/components/range/index.tsx b/src/components/range/index.tsx new file mode 100644 index 00000000..4e635229 --- /dev/null +++ b/src/components/range/index.tsx @@ -0,0 +1,44 @@ +import { h, Component } from 'preact'; +import * as style from './style.scss'; +import RangeInputElement from '../../custom-els/RangeInput'; +import '../../custom-els/RangeInput'; +import { linkRef } from '../../lib/initial-util'; + +interface Props extends JSX.HTMLAttributes {} +interface State {} + +export default class Range extends Component { + rangeWc?: RangeInputElement; + + render(props: Props) { + const { + children, + ...otherProps + } = props; + + const { + value, min, max, onInput, + } = props; + + return ( + + ); + } +} diff --git a/src/components/range/style.scss b/src/components/range/style.scss new file mode 100644 index 00000000..c3bcdee1 --- /dev/null +++ b/src/components/range/style.scss @@ -0,0 +1,45 @@ +.range { + display: grid; + grid-template-columns: 1fr auto; +} + +.label-text { + color: #fff; /* TEMP */ +} + +.range-wc-container { + grid-column: 1 / 3; +} + +.range-wc { + width: 100%; +} + +.text-input { + text-align: right; + background: transparent; + color: inherit; + font: inherit; + border: none; + padding: 2px 5px; + box-sizing: border-box; + text-decoration: underline; + text-decoration-style: dotted; + width: 48px; + position: relative; + left: 5px; + + &:focus { + background: #fff; + color: #000; + } + + + // Remove the number controls + &::-webkit-outer-spin-button, + &::-webkit-inner-spin-button { + -moz-appearance: none; + -webkit-appearance: none; + margin: 0; + } +} diff --git a/src/custom-els/RangeInput/missing-types.d.ts b/src/custom-els/RangeInput/missing-types.d.ts index 41c48e40..d566207d 100644 --- a/src/custom-els/RangeInput/missing-types.d.ts +++ b/src/custom-els/RangeInput/missing-types.d.ts @@ -1,9 +1,5 @@ declare namespace JSX { - interface RangeInputAttributes extends HTMLAttributes { - reversed?: boolean; - } - interface IntrinsicElements { - 'range-input': RangeInputAttributes; + 'range-input': HTMLAttributes; } }