mirror of
https://github.com/GoogleChromeLabs/squoosh.git
synced 2025-11-15 18:19:47 +00:00
Download button on the outside.
This commit is contained in:
@@ -6,6 +6,7 @@ import { DownloadIcon, CopyAcrossIcon, CopyAcrossIconProps } from '../../lib/ico
|
||||
import '../custom-els/LoadingSpinner';
|
||||
import { SourceImage } from '../compress';
|
||||
import { Fileish, bind } from '../../lib/initial-util';
|
||||
import { button } from '../output/style.scss.d';
|
||||
|
||||
interface Props {
|
||||
loading: boolean;
|
||||
@@ -14,6 +15,7 @@ interface Props {
|
||||
downloadUrl?: string;
|
||||
children: ComponentChildren;
|
||||
copyDirection: CopyAcrossIconProps['copyDirection'];
|
||||
buttonPosition: keyof typeof buttonPositionClass;
|
||||
onCopyToOtherClick(): void;
|
||||
}
|
||||
|
||||
@@ -21,6 +23,12 @@ interface State {
|
||||
showLoadingState: boolean;
|
||||
}
|
||||
|
||||
const buttonPositionClass = {
|
||||
'stack-right': style.stackRight,
|
||||
'download-right': style.downloadRight,
|
||||
'download-left': style.downloadLeft,
|
||||
};
|
||||
|
||||
const loadingReactionDelay = 500;
|
||||
|
||||
export default class Results extends Component<Props, State> {
|
||||
@@ -52,11 +60,12 @@ export default class Results extends Component<Props, State> {
|
||||
}
|
||||
|
||||
render(
|
||||
{ source, imageFile, downloadUrl, children, copyDirection }: Props,
|
||||
{ source, imageFile, downloadUrl, children, copyDirection, buttonPosition }: Props,
|
||||
{ showLoadingState }: State,
|
||||
) {
|
||||
|
||||
return (
|
||||
<div class={style.results}>
|
||||
<div class={`${style.results} ${buttonPositionClass[buttonPosition]}`}>
|
||||
<div class={style.resultData}>
|
||||
{(children as ComponentChild[])[0]
|
||||
? <div class={style.resultTitle}>{children}</div>
|
||||
|
||||
Reference in New Issue
Block a user