|
| 1 | +import Image from 'next/image'; |
1 | 2 | import styled from 'styled-components'; |
| 3 | +import { useSite } from '@/components/common/Site'; |
2 | 4 |
|
3 | 5 | const HardwareLockupWrap = styled.div` |
4 | 6 | display: flex; |
5 | 7 | align-items: flex-start; |
6 | 8 | justify-content: center; |
7 | 9 | position: relative; |
8 | | - margin-top: 100px; |
| 10 | + aspect-ratio: 1204/736; |
| 11 | + width: auto; |
9 | 12 | @supports ((-webkit-mask-image:url("")) or (mask-image:url(""))) { |
10 | 13 | mask-size: contain; |
11 | 14 | mask-position: center; |
12 | 15 | mask-repeat: no-repeat; |
13 | 16 | mask-image: url(/m1_laptop_hw_shape_mask_large.png); |
14 | 17 | } |
15 | | -
|
16 | 18 | @media (-webkit-min-device-pixel-ratio: 1.5), (min-resolution: 144dpi), only screen and (-webkit-min-device-pixel-ratio: 1.5), only screen and (min-resolution: 1.5dppx) { |
17 | 19 | @supports ((-webkit-mask-image:url("")) or (mask-image:url(""))) { |
18 | 20 | mask-image: url(/m1_laptop_hw_shape_mask_large_2x.png); |
19 | 21 | } |
20 | 22 | } |
21 | 23 | ` |
22 | | - |
23 | | -const HardwareImage = styled.picture` |
| 24 | +const HardwareImage = styled.div` |
24 | 25 | display: block; |
25 | | - width: var(--p-width); |
26 | | - height: var(--p-height); |
27 | | - --p-width: 1204px; |
28 | | - --p-height: 736px; |
| 26 | + aspect-ratio: 1204/736; |
29 | 27 | ` |
30 | | - |
31 | | -const HardwareLockupFigure = styled.figure` |
32 | | - position: absolute; |
33 | | - top: 17px; |
34 | | -` |
35 | | - |
36 | 28 | const HardwareLockupMedia = styled.div` |
37 | 29 | display: block; |
38 | | - width: var(--p-width); |
39 | | - height: var(--p-height); |
40 | | - --p-width: 984px; |
41 | | - --p-height: 636px; |
42 | | -
|
| 30 | + aspect-ratio: 984/636; |
| 31 | + position: absolute; |
| 32 | + top: 2.3%; |
| 33 | + left: 9.3%; |
| 34 | + right: 9.3%; |
43 | 35 | @supports ((-webkit-mask-image:url("")) or (mask-image:url(""))) { |
44 | 36 | mask-size: contain; |
45 | 37 | mask-position: center; |
46 | 38 | mask-repeat: no-repeat; |
47 | 39 | mask-image: url(/m1_laptop_hw_mask_large.png); |
48 | 40 | } |
49 | | -
|
50 | 41 | @media (-webkit-min-device-pixel-ratio: 1.5), (min-resolution: 144dpi), only screen and (-webkit-min-device-pixel-ratio: 1.5), only screen and (min-resolution: 1.5dppx) { |
51 | 42 | @supports ((-webkit-mask-image:url("")) or (mask-image:url(""))) { |
52 | 43 | mask-image: url(/m1_laptop_hw_mask_large_2x.png); |
53 | 44 | } |
54 | 45 | } |
55 | 46 | ` |
56 | 47 |
|
57 | | -const FallbackImage = styled.picture` |
58 | | - display: block; |
59 | | - width: var(--p-width); |
60 | | - height: var(--p-height); |
61 | | - --p-width: 984px; |
62 | | - --p-height: 636px; |
63 | | -` |
64 | | - |
65 | 48 | const HardwareLockup = (props) => { |
| 49 | + const { colorScheme = "light" } = useSite(); |
| 50 | + |
66 | 51 | return ( |
67 | 52 | <HardwareLockupWrap {...props}> |
68 | 53 | <HardwareImage> |
69 | | - <source srcSet="/m1_laptop_hw_dark_small.jpg, /m1_laptop_hw_dark_small_2x.jpg 2x" media="(max-width:734px)" /> |
70 | | - <source srcSet="/m1_laptop_hw_dark_medium.jpg, /m1_laptop_hw_dark_medium_2x.jpg 2x" media="(max-width:1068px)" /> |
71 | | - <source srcSet="/m1_laptop_hw_dark_large.jpg, /m1_laptop_hw_dark_large_2x.jpg 2x" media="(min-width:0px)" /> |
72 | | - <img src="/m1_laptop_hw_dark_large.jpg" alt="hardware image" /> |
| 54 | + <Image src={`/m1_laptop_hw_${colorScheme}_large_2x.jpg`} alt="hardware image" width="1204" height="736" /> |
73 | 55 | </HardwareImage> |
74 | | - <noscript> |
75 | | - <HardwareImage> |
76 | | - <source srcSet="/m1_laptop_hw_dark_small.jpg, /m1_laptop_hw_dark_small_2x.jpg 2x" media="(max-width:734px)" /> |
77 | | - <source srcSet="/m1_laptop_hw_dark_medium.jpg, /m1_laptop_hw_dark_medium_2x.jpg 2x" media="(max-width:1068px)" /> |
78 | | - <source srcSet="/m1_laptop_hw_dark_large.jpg, /m1_laptop_hw_dark_large_2x.jpg 2x" media="(min-width:0px)" /> |
79 | | - <img src="/m1_laptop_hw_dark_large.jpg" alt="hardware image" /> |
80 | | - </HardwareImage> |
81 | | - </noscript> |
82 | | - <HardwareLockupFigure> |
83 | | - <HardwareLockupMedia> |
84 | | - <FallbackImage> |
85 | | - <source srcSet="/screen_processing_small.jpg, /screen_processing_small_2x.jpg 2x" media="(max-width:734px)" /> |
86 | | - <source srcSet="/screen_processing_medium.jpg, /screen_processing_medium_2x.jpg 2x" media="(max-width:1068px)" /> |
87 | | - <source srcSet="/screen_processing_large.jpg, /screen_processing_large_2x.jpg 2x" media="(min-width:0px)" /> |
88 | | - <img src="/screen_processing_large.jpg" alt="image" /> |
89 | | - </FallbackImage> |
90 | | - <noscript> |
91 | | - <FallbackImage> |
92 | | - <source srcSet="/screen_processing_small.jpg, /screen_processing_small_2x.jpg 2x" media="(max-width:734px)" /> |
93 | | - <source srcSet="/screen_processing_medium.jpg, /screen_processing_medium_2x.jpg 2x" media="(max-width:1068px)" /> |
94 | | - <source srcSet="/screen_processing_large.jpg, /screen_processing_large_2x.jpg 2x" media="(min-width:0px)" /> |
95 | | - <img src="/screen_processing_large.jpg" alt="image" /> |
96 | | - </FallbackImage> |
97 | | - </noscript> |
98 | | - </HardwareLockupMedia> |
99 | | - </HardwareLockupFigure> |
| 56 | + <HardwareLockupMedia> |
| 57 | + <Image src={`/screen_macos_desktop_${colorScheme}_large_2x.jpg`} alt="image" width="984" height="636" /> |
| 58 | + </HardwareLockupMedia> |
100 | 59 | </HardwareLockupWrap> |
101 | 60 | ) |
102 | 61 | } |
|
0 commit comments