Commit ff1463e2 authored by isstuev's avatar isstuev

remove zoom on mobile

parent e7c8e493
import { chakra, LinkOverlay } from '@chakra-ui/react'; import { chakra, LinkOverlay } from '@chakra-ui/react';
import React from 'react'; import React from 'react';
import { mediaStyleProps } from './utils';
interface Props { interface Props {
src: string; src: string;
onLoad: () => void; onLoad: () => void;
...@@ -12,13 +14,7 @@ const NftHtml = ({ src, onLoad, onError, onClick }: Props) => { ...@@ -12,13 +14,7 @@ const NftHtml = ({ src, onLoad, onError, onClick }: Props) => {
return ( return (
<LinkOverlay <LinkOverlay
onClick={ onClick } onClick={ onClick }
cursor="pointer" { ...mediaStyleProps }
transitionProperty="transform"
transitionDuration="normal"
transitionTimingFunction="ease"
_hover={{
transform: 'scale(1.2)',
}}
> >
<chakra.iframe <chakra.iframe
src={ src } src={ src }
......
import { Image } from '@chakra-ui/react'; import { Image } from '@chakra-ui/react';
import React from 'react'; import React from 'react';
import { mediaStyleProps } from './utils';
interface Props { interface Props {
src: string; src: string;
onLoad: () => void; onLoad: () => void;
...@@ -18,13 +20,7 @@ const NftImage = ({ src, onLoad, onError, onClick }: Props) => { ...@@ -18,13 +20,7 @@ const NftImage = ({ src, onLoad, onError, onClick }: Props) => {
onError={ onError } onError={ onError }
onLoad={ onLoad } onLoad={ onLoad }
onClick={ onClick } onClick={ onClick }
transitionProperty="transform" { ...mediaStyleProps }
transitionDuration="normal"
transitionTimingFunction="ease"
cursor="pointer"
_hover={{
transform: 'scale(1.2)',
}}
/> />
); );
}; };
......
...@@ -41,18 +41,27 @@ test.describe('image', () => { ...@@ -41,18 +41,27 @@ test.describe('image', () => {
await expect(component).toHaveScreenshot(); await expect(component).toHaveScreenshot();
}); });
});
test('preview hover', async({ mount }) => { test('image preview hover', async({ mount, page }) => {
const component = await mount( const MEDIA_URL = 'https://localhost:3000/my-image.jpg';
<TestApp>
<NftMedia url={ MEDIA_URL }/>
</TestApp>,
);
await component.hover();
await expect(component).toHaveScreenshot(); await page.route(MEDIA_URL, (route) => {
return route.fulfill({
status: 200,
path: './playwright/mocks/image_long.jpg',
});
}); });
const component = await mount(
<TestApp>
<NftMedia url={ MEDIA_URL } w="250px"/>
</TestApp>,
);
await component.getByAltText('Token instance image').hover();
await expect(page).toHaveScreenshot({ clip: { x: 0, y: 0, width: 250, height: 250 } });
}); });
test('image fullscreen +@dark-mode +@mobile', async({ mount, page }) => { test('image fullscreen +@dark-mode +@mobile', async({ mount, page }) => {
...@@ -104,16 +113,4 @@ test.describe('page', () => { ...@@ -104,16 +113,4 @@ test.describe('page', () => {
await expect(component).toHaveScreenshot(); await expect(component).toHaveScreenshot();
}); });
test('preview hover', async({ mount }) => {
const component = await mount(
<TestApp>
<NftMedia url={ MEDIA_URL }/>
</TestApp>,
);
await component.hover();
await expect(component).toHaveScreenshot();
});
}); });
import { chakra } from '@chakra-ui/react'; import { chakra } from '@chakra-ui/react';
import React from 'react'; import React from 'react';
import { mediaStyleProps } from './utils';
interface Props { interface Props {
src: string; src: string;
onLoad: () => void; onLoad: () => void;
...@@ -21,13 +23,7 @@ const NftVideo = ({ src, onLoad, onError, onClick }: Props) => { ...@@ -21,13 +23,7 @@ const NftVideo = ({ src, onLoad, onError, onClick }: Props) => {
onError={ onError } onError={ onError }
borderRadius="md" borderRadius="md"
onClick={ onClick } onClick={ onClick }
transitionProperty="transform" { ...mediaStyleProps }
transitionDuration="normal"
transitionTimingFunction="ease"
cursor="pointer"
_hover={{
transform: 'scale(1.2)',
}}
/> />
); );
}; };
......
...@@ -26,3 +26,16 @@ export function getPreliminaryMediaType(url: string): MediaType | undefined { ...@@ -26,3 +26,16 @@ export function getPreliminaryMediaType(url: string): MediaType | undefined {
return 'video'; return 'video';
} }
} }
export const mediaStyleProps = {
transitionProperty: 'transform',
transitionDuration: 'normal',
transitionTimingFunction: 'ease',
cursor: 'pointer',
_hover: {
base: {},
lg: {
transform: 'scale(1.2)',
},
},
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment