Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
frontend
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vicotor
frontend
Commits
ff1463e2
Commit
ff1463e2
authored
Sep 06, 2023
by
isstuev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove zoom on mobile
parent
e7c8e493
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
40 additions
and
42 deletions
+40
-42
NftHtml.tsx
ui/shared/nft/NftHtml.tsx
+3
-7
NftImage.tsx
ui/shared/nft/NftImage.tsx
+3
-7
NftMedia.pw.tsx
ui/shared/nft/NftMedia.pw.tsx
+18
-21
NftVideo.tsx
ui/shared/nft/NftVideo.tsx
+3
-7
NftMedia.pw.tsx_default_page-preview-hover-1.png
...nshots__/NftMedia.pw.tsx_default_page-preview-hover-1.png
+0
-0
utils.ts
ui/shared/nft/utils.ts
+13
-0
No files found.
ui/shared/nft/NftHtml.tsx
View file @
ff1463e2
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
}
...
...
ui/shared/nft/NftImage.tsx
View file @
ff1463e2
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)
'
,
}
}
/>
/>
);
);
};
};
...
...
ui/shared/nft/NftMedia.pw.tsx
View file @
ff1463e2
...
@@ -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
();
});
});
});
ui/shared/nft/NftVideo.tsx
View file @
ff1463e2
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)
'
,
}
}
/>
/>
);
);
};
};
...
...
ui/shared/nft/__screenshots__/NftMedia.pw.tsx_default_page-preview-hover-1.png
deleted
100644 → 0
View file @
e7c8e493
4.21 KB
ui/shared/nft/utils.ts
View file @
ff1463e2
...
@@ -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)
'
,
},
},
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment