Skip to content

Commit

Permalink
refactor: re-write screenshots viewing to using css only (#600)
Browse files Browse the repository at this point in the history
* refactor: re-write screenshots viewing to using css only

* refactor: change screenshot component api to more concise

* fix: fix images sizing when not loaded

* fix: fix images aspect ratio

* chore(new-ui): fix review issues
  • Loading branch information
shadowusr authored Sep 17, 2024
1 parent b20044a commit daf13ed
Show file tree
Hide file tree
Showing 51 changed files with 733 additions and 987 deletions.
8 changes: 2 additions & 6 deletions lib/static/components/modals/screenshot-accepter/body.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React, {Component, Fragment} from 'react';
import {connect} from 'react-redux';
import PropTypes from 'prop-types';
import ResizedScreenshot from '../../state/screenshot/resized';
import StateFail from '../../state/state-fail';
import {isNoRefImageError} from '../../../../common-utils';
import ViewInBrowserIcon from '../../icons/view-in-browser';
import {Screenshot} from '@/static/new-ui/components/Screenshot';

class ScreenshotAccepterBody extends Component {
static propTypes = {
Expand Down Expand Up @@ -36,11 +36,7 @@ class ScreenshotAccepterBody extends Component {
}

_renderImageBox(image) {
return (
<div className="image-box__image">
<ResizedScreenshot image={image} />
</div>
);
return <Screenshot image={image} />;
}

_renderTitle() {
Expand Down
3 changes: 3 additions & 0 deletions lib/static/components/modals/screenshot-accepter/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@
padding-left: 15px;
padding-right: 15px;
margin-bottom: 10px;
display: flex;
flex-direction: column;
height: 100%;
}

.screenshot-accepter__body .screenshot-accepter__icon_view-in-browser {
Expand Down
4 changes: 2 additions & 2 deletions lib/static/components/section/body/page-screenshot.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, {Component} from 'react';
import Details from '../../details';
import ResizedScreenshot from '../../state/screenshot/resized';
import {ImageFile} from '../../../../types';
import {Screenshot} from '@/static/new-ui/components/Screenshot';

interface PageScreenshotProps {
image: ImageFile;
Expand All @@ -11,7 +11,7 @@ export class PageScreenshot extends Component<PageScreenshotProps> {
render(): JSX.Element {
return <Details
title="Page screenshot"
content={(): JSX.Element => <ResizedScreenshot image={this.props.image}/>}
content={(): JSX.Element => <Screenshot image={this.props.image} />}
/>;
}
}
59 changes: 0 additions & 59 deletions lib/static/components/state/screenshot/diff-circle.jsx

This file was deleted.

29 changes: 0 additions & 29 deletions lib/static/components/state/screenshot/full.jsx

This file was deleted.

92 changes: 0 additions & 92 deletions lib/static/components/state/screenshot/resized.jsx

This file was deleted.

44 changes: 0 additions & 44 deletions lib/static/components/state/screenshot/with-encode-uri.jsx

This file was deleted.

116 changes: 0 additions & 116 deletions lib/static/components/state/screenshot/with-synced-scale.jsx

This file was deleted.

Loading

0 comments on commit daf13ed

Please sign in to comment.