(Almost the) rest of the redesign (#880)

* Load demo img

* two-up styles

* Back button

* Button size tweak

* Move back btn

* Move options and back button into a single grid

* Simpler max height

* Responsive grid

* Feed index into options

* Option heading themes

* More option styles

* Changing checkbox position

* Theme range input & use transforms

* Range input underline theme

* Checkbox color

* Add toggle

* Reorder

* Arrow revealer

* Round two-up thumb

* Don't bundle CSS urls starting #

* Results in progress

* Fix Safari bugs

* Download blobs

* Loading spinner

* Hook up download button

* Different style for original image

* Mobile design for results

* Remove demo auto-loader

* Remove redundant colors

* Sticky headings
This commit is contained in:
Jake Archibald
2020-12-09 11:47:23 +00:00
committed by GitHub
parent 12889d9d50
commit fec826b106
36 changed files with 903 additions and 497 deletions

View File

@@ -0,0 +1,22 @@
import { h, Component } from 'preact';
import * as style from './style.css';
import 'add-css:./style.css';
interface Props extends preact.JSX.HTMLAttributes {}
interface State {}
export default class Toggle extends Component<Props, State> {
render(props: Props) {
return (
<div class={style.checkbox}>
{/* @ts-ignore - TS bug https://github.com/microsoft/TypeScript/issues/16019 */}
<input class={style.realCheckbox} type="checkbox" {...props} />
<div class={style.track}>
<div class={style.thumbTrack}>
<div class={style.thumb}></div>
</div>
</div>
</div>
);
}
}

View File

@@ -0,0 +1,55 @@
.checkbox {
display: inline-block;
position: relative;
}
.track {
--thumb-size: 14px;
background: var(--black);
border-radius: 1000px;
width: 24px;
padding: 3px calc(var(--thumb-size) / 2 + 3px);
}
.thumb {
position: relative;
width: var(--thumb-size);
height: var(--thumb-size);
background: var(--less-light-gray);
border-radius: 100%;
transform: translateX(calc(var(--thumb-size) / -2));
overflow: hidden;
&::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: var(--main-theme-color);
opacity: 0;
transition: opacity 200ms ease;
}
}
.thumb-track {
transition: transform 200ms ease;
}
.real-checkbox {
top: 0;
position: absolute;
opacity: 0;
pointer-events: none;
&:checked + .track {
.thumb-track {
transform: translateX(100%);
}
.thumb::before {
opacity: 1;
}
}
}