Skip to content

Commit 6b4e53a

Browse files
Refactor media query
1 parent a23c4bf commit 6b4e53a

2 files changed

Lines changed: 12 additions & 12 deletions

File tree

src/components/Atoms/AmbientVideo/AmbientVideo.style.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
import styled, { keyframes } from 'styled-components';
22

3-
import { breakpointValues } from '../../../theme/shared/allBreakpoints';
43
import zIndex from '../../../theme/shared/zIndex';
54

6-
const mobileMaxWidth = breakpointValues.L - 1;
7-
85
// This is so that the button is initially visible, then afterwards
96
// it's only seen again on hover
107
const playPauseIntro = keyframes`
@@ -80,7 +77,8 @@ const PlayPauseIcon = styled.span`
8077

8178
const PlayPauseButton = styled.button`
8279
position: absolute;
83-
bottom: 15px;
80+
top: 15px;
81+
bottom: auto;
8482
left: 15px;
8583
width: 35px;
8684
height: 35px;
@@ -105,10 +103,11 @@ const PlayPauseButton = styled.button`
105103
106104
// Play icon needs to go to the top left on mobile
107105
// as with the hero banner, the text container can
108-
// overlap it
109-
@media (max-width: ${mobileMaxWidth}px) {
110-
top: 15px;
111-
bottom: auto;
106+
// overlap it. Here in desktop view it can come
107+
// back to the bottom.
108+
@media ${({ theme }) => theme.allBreakpoints('L')} {
109+
bottom: 15px;
110+
top: auto;
112111
}
113112
114113
@media (prefers-reduced-motion: reduce) {

src/components/Molecules/PictureOrVideo/__snapshots__/PictureOrVideo.test.js.snap

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ exports[`renders AmbientVideo when video props are provided correctly 1`] = `
4040
4141
.c6 {
4242
position: absolute;
43-
bottom: 15px;
43+
top: 15px;
44+
bottom: auto;
4445
left: 15px;
4546
width: 35px;
4647
height: 35px;
@@ -94,10 +95,10 @@ exports[`renders AmbientVideo when video props are provided correctly 1`] = `
9495
}
9596
}
9697
97-
@media (max-width:1023px) {
98+
@media (min-width:1024px) {
9899
.c6 {
99-
top: 15px;
100-
bottom: auto;
100+
bottom: 15px;
101+
top: auto;
101102
}
102103
}
103104

0 commit comments

Comments
 (0)