diff --git a/src/components/App/style.scss b/src/components/App/style.scss index 3ddd59c8..f7c48425 100644 --- a/src/components/App/style.scss +++ b/src/components/App/style.scss @@ -1,7 +1,3 @@ -/* -Note: These styles are temporary. They will be replaced before going live. -*/ - .app { position: absolute; left: 0; diff --git a/src/components/Options/checkbox/index.tsx b/src/components/Options/checkbox/index.tsx new file mode 100644 index 00000000..bbb97bb4 --- /dev/null +++ b/src/components/Options/checkbox/index.tsx @@ -0,0 +1,20 @@ +import { h, Component } from 'preact'; +import * as style from './style.scss'; +import { UncheckedIcon, CheckedIcon } from '../../../lib/icons'; + +interface Props extends JSX.HTMLAttributes {} +interface State {} + +export default class Checkbox extends Component { + render(props: Props) { + return ( +
+ {props.checked + ? + : + } + +
+ ); + } +} diff --git a/src/components/Options/checkbox/style.scss b/src/components/Options/checkbox/style.scss new file mode 100644 index 00000000..48446237 --- /dev/null +++ b/src/components/Options/checkbox/style.scss @@ -0,0 +1,21 @@ +.checkbox { + display: inline-block; + position: relative; + --size: 24px; +} + +.real-checkbox { + position: absolute; + opacity: 0; + pointer-events: none; +} + +.icon { + display: block; + width: var(--size); + height: var(--size); +} + +.checked { + fill: #34B9EB; +} diff --git a/src/components/Options/index.tsx b/src/components/Options/index.tsx index 77feeeaf..4ded0c34 100644 --- a/src/components/Options/index.tsx +++ b/src/components/Options/index.tsx @@ -31,7 +31,6 @@ import { encoders, encodersSupported, EncoderSupportMap, - encoderMap, } from '../../codecs/encoders'; import { QuantizeOptions } from '../../codecs/imagequant/processor-meta'; import { ResizeOptions } from '../../codecs/resize/processor-meta'; @@ -39,6 +38,7 @@ import { PreprocessorState } from '../../codecs/preprocessors'; import FileSize from '../FileSize'; import { DownloadIcon } from '../../lib/icons'; import { SourceImage } from '../App'; +import Checkbox from './checkbox'; const encoderOptionsComponentMap = { [identity.type]: undefined, @@ -56,11 +56,6 @@ const encoderOptionsComponentMap = { [browserPDF.type]: undefined, }; -const titles = { - horizontal: ['Left Image', 'Right Image'], - vertical: ['Top Image', 'Bottom Image'], -}; - interface Props { orientation: 'horizontal' | 'vertical'; source?: SourceImage; @@ -144,74 +139,64 @@ export default class Options extends Component { const EncoderOptionComponent = encoderOptionsComponentMap[encoderState.type]; return ( -
-

- {titles[orientation][imageIndex]} - {', '} - {encoderMap[encoderState.type].label} -

+
+

Process

+ + {/* + {preprocessorState.resize.enabled && + + } + + {preprocessorState.quantizer.enabled && + + } + */} -
-
- {encoderSupportMap ? - - : - - } -
- - {encoderState.type !== 'identity' && ( -
- - {preprocessorState.resize.enabled && - - } - - {preprocessorState.quantizer.enabled && - - } -
- )} - - {EncoderOptionComponent && - + {/*
+ {encoderSupportMap ? + + : + } -
+ + + {EncoderOptionComponent && + + }
@@ -237,6 +222,7 @@ export default class Options extends Component { )}
+ */}
); } diff --git a/src/components/Options/style.scss b/src/components/Options/style.scss index 4948a06d..cfa8a80e 100644 --- a/src/components/Options/style.scss +++ b/src/components/Options/style.scss @@ -1,225 +1,30 @@ -/* -Note: These styles are temporary. They will be replaced before going live. -*/ - -.row { - padding: 5px; - margin: 0 10px; -} +$horizontalPadding: 15px; .options { - box-sizing: border-box; - padding: 0; - background: rgba(40,40,40,0.8); - box-shadow: 0 1px 3px rgba(0,0,0,0.5); - color: #eee; - overflow: auto; - z-index: 1; - opacity: 0.9; - transform-origin: 50% 140%; - transition: opacity 300ms linear; - animation: options-open 500ms cubic-bezier(.6,1.6,.6,1) forwards 1; - - &.horizontal { - border-radius: 1px 1px 5px 5px; - width: 230px; - - > .inner { - max-height: 80vh; - overflow: auto; - -webkit-overflow-scrolling: touch; - -ms-touch-action: pan-y; - touch-action: pan-y; - } - } - - &.vertical { - opacity: 1; - margin: 0 5px 10px; - border-radius: 0 0 5px 5px; - } - - &:hover, &:focus, &:focus-within { - opacity: 1; - } - - @keyframes options-open { - from { - transform: translateY(100px) scale(.8); - } - } - - .content { - max-height: calc(75vh - 100px); - overflow: auto; - touch-action: pan-y; - -webkit-overflow-scrolling: touch; - } - - .picker { - margin: 5px 15px; - - select { - display: block; - width: 100%; - box-sizing: border-box; - -webkit-appearance: none; - appearance: none; - padding: 10px 30px 10px 10px; - background: url('data:image/svg+xml,') right center no-repeat; - background-color: var(--gray-dark); - opacity: 0.9; - border: none; - font: inherit; - color: white; - transition: box-shadow 150ms ease; - - &:hover { - opacity: 1; - } - &:focus { - opacity: 1; - outline: none; - box-shadow: 0 0 0 2px var(--button-fg, #ccc); - } - } - } - - .title { - display: flex; - align-items: center; - padding: 10px 15px; - margin: 0 0 12px; - background: rgba(0,0,0,0.9); - font: inherit; - } - - label { - display: block; - padding: 5px; - margin: 0 10px; - display: flex; - flex-wrap: wrap; - - // prevent labels from wrapping below checkboxes - > span { - flex: 1; - } - - input[type=checkbox], - input[type=radio] { - flex: 0; - margin: 2px 8px 0 0; - } - - range-input { - display: block; - flex: 1 0 100%; - margin: 2px 0; - } - } - - hr { - height: 1px; - border: none; - margin: 5px 0; - box-shadow: inset 0 0.5px 0 rgba(0, 0, 0, 0.4), inset 0 -0.5px 0 rgba(255, 255, 255, 0.2); - } + color: #fff; + width: 300px; + opacity: 0.8; + font-size: 1.2rem; } -.picker { - margin: 5px 15px; - - select { - display: block; - width: 100%; - box-sizing: border-box; - -webkit-appearance: none; - appearance: none; - padding: 10px 30px 10px 10px; - background: url('data:image/svg+xml,') right center no-repeat; - background-color: var(--gray-dark); - opacity: 0.9; - border: none; - font: inherit; - color: white; - } - - hr { - height: 1px; - border: none; - margin: 5px 0; - box-shadow: inset 0 0.5px 0 rgba(0, 0, 0, 0.4), inset 0 -0.5px 0 rgba(255, 255, 255, 0.2); - } -} - -.size-details { - display: flex; - align-items: center; - padding: 5px 15px; - background: rgba(0,0,0,0.5); -} - -.download { - flex: 0; - margin: 0 0 0 auto; - background: rgba(255,255,255,0.1); - border-radius: 50%; - padding: 5px; - width: 16px; - height: 16px; - text-decoration: none; - - > svg { - width: 16px; - height: 16px; - fill: #fff; - } - - &:hover { - background-color: rgba(255,255,255,0.3); - } -} - -.size-details { - padding: 5px 15px; - background: rgba(0,0,0,0.5); -} - -.size { +.options-title { + background: rgba(0, 0, 0, 0.9); + margin: 0; + padding: 10px $horizontalPadding; font-weight: normal; + font-size: 1.4rem; + border-bottom: 1px solid #000; } -.increase, -.decrease { - font-style: italic; - filter: #{"grayscale(calc(50% - var(--size-delta, 50) * 0.5%))"}; - - &:before { - content: ' ('; - } - &:after { - content: ')'; - } +.section-enabler { + cursor: pointer; + background: rgba(0, 0, 0, 0.8); + display: grid; + grid-template-columns: auto 1fr; + grid-gap: 0.5em; + padding: 6px $horizontalPadding; } -.increase { - color: var(--negative); -} -.decrease { - color: var(--positive); -} - -.preprocessors { - padding: 5px 0; - margin: 5px 0; - box-shadow: inset 0 -.5px 0 rgba(0,0,0,0.4), 0 .5px 0 rgba(255,255,255,0.2); -} - -.toggle { - display: flex; - position: relative; - align-content: center; - font-size: 14px; - box-shadow: inset 0 -.5px 0 rgba(0,0,0,0.4), 0 .5px 0 rgba(255,255,255,0.2); +.section-enabler-label { + padding-top: 3px; } diff --git a/src/lib/icons.tsx b/src/lib/icons.tsx index 0562b8d9..2790b410 100644 --- a/src/lib/icons.tsx +++ b/src/lib/icons.tsx @@ -29,3 +29,15 @@ export const RemoveIcon = (props: JSX.HTMLAttributes) => ( ); + +export const UncheckedIcon = (props: JSX.HTMLAttributes) => ( + + + +); + +export const CheckedIcon = (props: JSX.HTMLAttributes) => ( + + + +); diff --git a/src/style/index.scss b/src/style/index.scss index a22b7362..27037998 100644 --- a/src/style/index.scss +++ b/src/style/index.scss @@ -1,7 +1,3 @@ -/* -Note: These styles are temporary. They will be replaced before going live. -*/ - @import './reset.scss'; html, body { diff --git a/src/style/reset.scss b/src/style/reset.scss index 2d60b927..c863fb75 100644 --- a/src/style/reset.scss +++ b/src/style/reset.scss @@ -1,7 +1,3 @@ -/* -Note: These styles are temporary. They will be replaced before going live. -*/ - button, a, img, input, select, textarea { -webkit-tap-highlight-color: rgba(0,0,0,0); }