-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
ref: Introduce a few style improvements #94904
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,22 @@ | ||
import styled from '@emotion/styled'; | ||
|
||
import type {ViewerProps} from 'sentry/components/events/attachmentViewers/utils'; | ||
import {getAttachmentUrl} from 'sentry/components/events/attachmentViewers/utils'; | ||
import PanelItem from 'sentry/components/panels/panelItem'; | ||
|
||
type Props = Omit<ViewerProps, 'attachment'> & { | ||
attachment: ViewerProps['attachment']; | ||
onError?: React.ReactEventHandler<HTMLImageElement>; | ||
onLoad?: React.ReactEventHandler<HTMLImageElement>; | ||
}; | ||
|
||
function ImageViewer({className, onLoad, onError, ...props}: Props) { | ||
function ImageViewer({onLoad, onError, className, ...props}: Props) { | ||
return ( | ||
<Container className={className}> | ||
<img | ||
data-test-id="image-viewer" | ||
src={getAttachmentUrl(props, true)} | ||
onLoad={onLoad} | ||
onError={onError} | ||
/> | ||
</Container> | ||
<img | ||
className={className} | ||
data-test-id="image-viewer" | ||
src={getAttachmentUrl(props, true)} | ||
onLoad={onLoad} | ||
onError={onError} | ||
/> | ||
); | ||
} | ||
|
||
export default ImageViewer; | ||
|
||
const Container = styled(PanelItem)` | ||
justify-content: center; | ||
`; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,6 @@ import {css} from '@emotion/react'; | |
|
||
import type {ViewerProps} from 'sentry/components/events/attachmentViewers/utils'; | ||
import {getAttachmentUrl} from 'sentry/components/events/attachmentViewers/utils'; | ||
import PanelItem from 'sentry/components/panels/panelItem'; | ||
import {t} from 'sentry/locale'; | ||
|
||
interface WebMViewerProps | ||
|
@@ -18,21 +17,19 @@ export function VideoViewer({ | |
...props | ||
}: WebMViewerProps) { | ||
return ( | ||
<PanelItem> | ||
<video | ||
onCanPlay={onCanPlay} | ||
controls={controls} | ||
css={css` | ||
width: 100%; | ||
max-width: 100%; | ||
`} | ||
> | ||
<source | ||
src={getAttachmentUrl({attachment, ...props}, true)} | ||
type={attachment.mimetype} | ||
/> | ||
{t('Your browser does not support the video tag.')} | ||
</video> | ||
</PanelItem> | ||
<video | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here. |
||
onCanPlay={onCanPlay} | ||
controls={controls} | ||
css={css` | ||
width: 100%; | ||
max-width: 100%; | ||
`} | ||
> | ||
<source | ||
src={getAttachmentUrl({attachment, ...props}, true)} | ||
type={attachment.mimetype} | ||
/> | ||
{t('Your browser does not support the video tag.')} | ||
</video> | ||
); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -187,9 +187,10 @@ const AttachmentComponentWrapper = styled('div')` | |
& > video { | ||
max-width: 100%; | ||
max-height: calc(100vh - 300px); | ||
width: auto; | ||
width: 100%; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixing this for videos |
||
height: auto; | ||
object-fit: contain; | ||
border-radius: ${p => p.theme.borderRadius}; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it looks better with border-radius, aligning with the panel with data below it |
||
} | ||
`; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
import styled from '@emotion/styled'; | ||
|
||
import {getInlineAttachmentRenderer} from 'sentry/components/events/attachmentViewers/previewAttachmentTypes'; | ||
import PanelItem from 'sentry/components/panels/panelItem'; | ||
import type {Event} from 'sentry/types/event'; | ||
import type {IssueAttachment} from 'sentry/types/group'; | ||
import useOrganization from 'sentry/utils/useOrganization'; | ||
|
@@ -35,8 +36,7 @@ export function InlineEventAttachment({ | |
); | ||
} | ||
|
||
const AttachmentPreviewWrapper = styled('div')` | ||
const AttachmentPreviewWrapper = styled(PanelItem)` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The PanelItem should instead be used here where we are using a Panel |
||
grid-column: auto / span 3; | ||
border: none; | ||
padding: 0; | ||
justify-content: center; | ||
`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because we use
PanelItem
here, in the modal, the image contains padding and it shouldn't. This component should contain img only element and no wrappers