mirror of
https://github.com/GoogleChromeLabs/squoosh.git
synced 2025-11-14 01:37:26 +00:00
* wip * Commenting stuff to keep the build happy * Revealing sections * Custom select elements & more form work * Range input styles * Text fields with inputs do the right thing * Safari & Firefox fixes * Large compress select * oops * MozJPEG options updated * OptPNG options * These asserts weren't true * Generic options * WebP options * Hiding "edit" when "original image" * Download icon * Copy setting button - still not happy with this * Progress indicator * Loading icon enter/exit anim * Preventing controls going under options * Ahh so that's what was causing scrolling * Ahh so that's what was causing outlines * Simplifying range styles and fixing cross-browser * Processing custom element styles * Get precision from step by default * I don't know how or when this happened. * Don't need that many steps * Avoid having an element that covers the pinch zoom * Preventing overlap with zoom controls * Prevent ts warning * Fixing spinner position * Simplifying FileSize
43 lines
1.1 KiB
TypeScript
43 lines
1.1 KiB
TypeScript
import { h, Component } from 'preact';
|
|
import { bind } from '../../lib/initial-util';
|
|
import { inputFieldValueAsNumber } from '../../lib/util';
|
|
import { EncodeOptions } from './encoder-meta';
|
|
import Range from '../../components/range';
|
|
import * as style from '../../components/Options/style.scss';
|
|
|
|
type Props = {
|
|
options: EncodeOptions;
|
|
onChange(newOptions: EncodeOptions): void;
|
|
};
|
|
|
|
export default class OptiPNGEncoderOptions extends Component<Props, {}> {
|
|
@bind
|
|
onChange(event: Event) {
|
|
const form = (event.currentTarget as HTMLInputElement).closest('form') as HTMLFormElement;
|
|
|
|
const options: EncodeOptions = {
|
|
level: inputFieldValueAsNumber(form.level),
|
|
};
|
|
this.props.onChange(options);
|
|
}
|
|
|
|
render({ options }: Props) {
|
|
return (
|
|
<form class={style.optionsSection}>
|
|
<div class={style.optionOneCell}>
|
|
<Range
|
|
name="level"
|
|
min="0"
|
|
max="7"
|
|
step="1"
|
|
value={options.level}
|
|
onInput={this.onChange}
|
|
>
|
|
Effort:
|
|
</Range>
|
|
</div>
|
|
</form>
|
|
);
|
|
}
|
|
}
|