|
1 | 1 | import { Canvas, useThree } from '@react-three/fiber'
|
2 |
| -import { useHover, createXRStore, XR } from '@react-three/xr' |
| 2 | +import { useHover, createXRStore, XR, XRLayer } from '@react-three/xr' |
3 | 3 | import { Environment } from '@react-three/drei'
|
4 | 4 | import { Container, Text, Image, Root, setPreferredColorScheme, Fullscreen } from '@react-three/uikit'
|
5 | 5 | import { Button, Slider } from '@react-three/uikit-default'
|
@@ -34,140 +34,144 @@ export function App() {
|
34 | 34 | <SwitchToXRPointerEvents />
|
35 | 35 | <XR store={store}>
|
36 | 36 | <Environment preset="city" />
|
37 |
| - <group position={[0, 1.5, -0.5]}> |
38 |
| - <Root pointerEventsType={{ deny: 'grab' }} pixelSize={0.001}> |
39 |
| - <Container width="100%" display="flex" alignItems="center" justifyContent="center"> |
| 37 | + <XRLayer |
| 38 | + dpr={4} |
| 39 | + pixelWidth={512} |
| 40 | + pixelHeight={512} |
| 41 | + pointerEventsType={{ deny: 'grab' }} |
| 42 | + position={[0, 1.5, -0.5]} |
| 43 | + > |
| 44 | + <Fullscreen> |
| 45 | + <Container |
| 46 | + dark={{ backgroundColor: 'rgb(31,41,55)' }} |
| 47 | + flexDirection="column" |
| 48 | + height="auto" |
| 49 | + width="100%" |
| 50 | + backgroundColor="rgb(255,255,255)" |
| 51 | + borderRadius={8} |
| 52 | + overflow="hidden" |
| 53 | + > |
40 | 54 | <Container
|
41 |
| - dark={{ backgroundColor: 'rgb(31,41,55)' }} |
42 |
| - width={384} |
43 |
| - flexDirection="column" |
44 |
| - height="auto" |
45 |
| - backgroundColor="rgb(255,255,255)" |
46 |
| - borderRadius={8} |
47 |
| - overflow="hidden" |
| 55 | + dark={{ backgroundColor: 'rgb(55,65,81)' }} |
| 56 | + display="flex" |
| 57 | + justifyContent="space-between" |
| 58 | + alignItems="center" |
| 59 | + borderTopLeftRadius={8} |
| 60 | + borderTopRightRadius={8} |
| 61 | + backgroundColor="rgb(243,244,246)" |
| 62 | + paddingLeft={16} |
| 63 | + paddingRight={16} |
| 64 | + paddingTop={8} |
| 65 | + paddingBottom={8} |
48 | 66 | >
|
49 |
| - <Container |
50 |
| - dark={{ backgroundColor: 'rgb(55,65,81)' }} |
51 |
| - display="flex" |
52 |
| - justifyContent="space-between" |
53 |
| - alignItems="center" |
54 |
| - borderTopLeftRadius={8} |
55 |
| - borderTopRightRadius={8} |
56 |
| - backgroundColor="rgb(243,244,246)" |
57 |
| - paddingLeft={16} |
58 |
| - paddingRight={16} |
59 |
| - paddingTop={8} |
60 |
| - paddingBottom={8} |
| 67 | + <Text |
| 68 | + fontSize={18} |
| 69 | + fontWeight={500} |
| 70 | + lineHeight={28} |
| 71 | + color="rgb(17,24,39)" |
| 72 | + dark={{ color: 'rgb(243,244,246)' }} |
| 73 | + flexDirection="column" |
61 | 74 | >
|
62 |
| - <Text |
63 |
| - fontSize={18} |
64 |
| - fontWeight={500} |
65 |
| - lineHeight={28} |
66 |
| - color="rgb(17,24,39)" |
67 |
| - dark={{ color: 'rgb(243,244,246)' }} |
68 |
| - flexDirection="column" |
69 |
| - > |
70 |
| - Music Player |
71 |
| - </Text> |
72 |
| - <Container display="flex" flexDirection="row" gapColumn={8}> |
73 |
| - <ExpandIcon color="rgb(17,24,39)" dark={{ color: 'rgb(243,244,246)' }} /> |
74 |
| - <ConstructionIcon color="rgb(17,24,39)" dark={{ color: 'rgb(243,244,246)' }} /> |
75 |
| - <MenuIcon color="rgb(17,24,39)" dark={{ color: 'rgb(243,244,246)' }} /> |
| 75 | + Music Player |
| 76 | + </Text> |
| 77 | + <Container display="flex" flexDirection="row" gapColumn={8}> |
| 78 | + <ExpandIcon color="rgb(17,24,39)" dark={{ color: 'rgb(243,244,246)' }} /> |
| 79 | + <ConstructionIcon color="rgb(17,24,39)" dark={{ color: 'rgb(243,244,246)' }} /> |
| 80 | + <MenuIcon color="rgb(17,24,39)" dark={{ color: 'rgb(243,244,246)' }} /> |
| 81 | + </Container> |
| 82 | + </Container> |
| 83 | + <Container display="flex" flexDirection="column" gapRow={16} padding={16}> |
| 84 | + <Container display="flex" alignItems="center" flexDirection="row" gapColumn={16}> |
| 85 | + <Image height={64} src="placeholder.svg" width={64} flexDirection="column"></Image> |
| 86 | + <Container flexGrow={1} flexShrink={1} flexBasis="0%" flexDirection="column" gapRow={4}> |
| 87 | + <Text |
| 88 | + fontSize={18} |
| 89 | + fontWeight={500} |
| 90 | + lineHeight={28} |
| 91 | + color="rgb(17,24,39)" |
| 92 | + dark={{ color: 'rgb(243,244,246)' }} |
| 93 | + flexDirection="column" |
| 94 | + > |
| 95 | + Blowin' in the Wind |
| 96 | + </Text> |
| 97 | + <Text |
| 98 | + fontSize={14} |
| 99 | + lineHeight={20} |
| 100 | + color="rgb(107,114,128)" |
| 101 | + dark={{ color: 'rgb(156,163,175)' }} |
| 102 | + flexDirection="column" |
| 103 | + > |
| 104 | + Bob Dylan {counter.toString()} |
| 105 | + </Text> |
76 | 106 | </Container>
|
77 | 107 | </Container>
|
78 |
| - <Container display="flex" flexDirection="column" gapRow={16} padding={16}> |
79 |
| - <Container display="flex" alignItems="center" flexDirection="row" gapColumn={16}> |
80 |
| - <Image height={64} src="placeholder.svg" width={64} flexDirection="column"></Image> |
81 |
| - <Container flexGrow={1} flexShrink={1} flexBasis="0%" flexDirection="column" gapRow={4}> |
82 |
| - <Text |
83 |
| - fontSize={18} |
84 |
| - fontWeight={500} |
85 |
| - lineHeight={28} |
86 |
| - color="rgb(17,24,39)" |
87 |
| - dark={{ color: 'rgb(243,244,246)' }} |
88 |
| - flexDirection="column" |
89 |
| - > |
90 |
| - Blowin' in the Wind |
91 |
| - </Text> |
92 |
| - <Text |
93 |
| - fontSize={14} |
94 |
| - lineHeight={20} |
95 |
| - color="rgb(107,114,128)" |
96 |
| - dark={{ color: 'rgb(156,163,175)' }} |
97 |
| - flexDirection="column" |
98 |
| - > |
99 |
| - Bob Dylan {counter.toString()} |
100 |
| - </Text> |
101 |
| - </Container> |
| 108 | + <Slider /> |
| 109 | + <Container display="flex" alignItems="center" justifyContent="space-between"> |
| 110 | + <Button size="icon" variant="ghost"> |
| 111 | + <ArrowLeftIcon color="rgb(17,24,39)" dark={{ color: 'rgb(243,244,246)' }} /> |
| 112 | + </Button> |
| 113 | + <Button onClick={() => setCounter((c) => c + 1)} size="icon" variant="ghost" padding={8}> |
| 114 | + <PlayIcon color="rgb(17,24,39)" dark={{ color: 'rgb(243,244,246)' }} /> |
| 115 | + </Button> |
| 116 | + <Button size="icon" variant="ghost"> |
| 117 | + <ArrowRightIcon color="rgb(17,24,39)" dark={{ color: 'rgb(243,244,246)' }} /> |
| 118 | + </Button> |
| 119 | + </Container> |
| 120 | + </Container> |
| 121 | + <Container padding={16} flexDirection="column"> |
| 122 | + <Text |
| 123 | + fontSize={18} |
| 124 | + fontWeight={500} |
| 125 | + lineHeight={28} |
| 126 | + color="rgb(17,24,39)" |
| 127 | + dark={{ color: 'rgb(243,244,246)' }} |
| 128 | + marginBottom={8} |
| 129 | + flexDirection="column" |
| 130 | + > |
| 131 | + Playlist |
| 132 | + </Text> |
| 133 | + <Container flexDirection="column" gapRow={8}> |
| 134 | + <Container display="flex" alignItems="center" justifyContent="space-between"> |
| 135 | + <Text |
| 136 | + fontSize={14} |
| 137 | + lineHeight={20} |
| 138 | + color="rgb(17,24,39)" |
| 139 | + dark={{ color: 'rgb(243,244,246)' }} |
| 140 | + flexDirection="column" |
| 141 | + > |
| 142 | + Like a Rolling Stone |
| 143 | + </Text> |
| 144 | + <PlayIcon color="rgb(17,24,39)" dark={{ color: 'rgb(243,244,246)' }} /> |
102 | 145 | </Container>
|
103 |
| - <Slider flexGrow={1} flexShrink={1} flexBasis="0%" /> |
104 | 146 | <Container display="flex" alignItems="center" justifyContent="space-between">
|
105 |
| - <Button size="icon" variant="ghost"> |
106 |
| - <ArrowLeftIcon color="rgb(17,24,39)" dark={{ color: 'rgb(243,244,246)' }} /> |
107 |
| - </Button> |
108 |
| - <Button onClick={() => setCounter((c) => c + 1)} size="icon" variant="ghost" padding={8}> |
109 |
| - <PlayIcon color="rgb(17,24,39)" dark={{ color: 'rgb(243,244,246)' }} /> |
110 |
| - </Button> |
111 |
| - <Button size="icon" variant="ghost"> |
112 |
| - <ArrowRightIcon color="rgb(17,24,39)" dark={{ color: 'rgb(243,244,246)' }} /> |
113 |
| - </Button> |
| 147 | + <Text |
| 148 | + fontSize={14} |
| 149 | + lineHeight={20} |
| 150 | + color="rgb(17,24,39)" |
| 151 | + dark={{ color: 'rgb(243,244,246)' }} |
| 152 | + flexDirection="column" |
| 153 | + > |
| 154 | + The Times They Are a-Changin' |
| 155 | + </Text> |
| 156 | + <PlayIcon color="rgb(17,24,39)" dark={{ color: 'rgb(243,244,246)' }} /> |
114 | 157 | </Container>
|
115 |
| - </Container> |
116 |
| - <Container padding={16} flexDirection="column"> |
117 |
| - <Text |
118 |
| - fontSize={18} |
119 |
| - fontWeight={500} |
120 |
| - lineHeight={28} |
121 |
| - color="rgb(17,24,39)" |
122 |
| - dark={{ color: 'rgb(243,244,246)' }} |
123 |
| - marginBottom={8} |
124 |
| - flexDirection="column" |
125 |
| - > |
126 |
| - Playlist |
127 |
| - </Text> |
128 |
| - <Container flexDirection="column" gapRow={8}> |
129 |
| - <Container display="flex" alignItems="center" justifyContent="space-between"> |
130 |
| - <Text |
131 |
| - fontSize={14} |
132 |
| - lineHeight={20} |
133 |
| - color="rgb(17,24,39)" |
134 |
| - dark={{ color: 'rgb(243,244,246)' }} |
135 |
| - flexDirection="column" |
136 |
| - > |
137 |
| - Like a Rolling Stone |
138 |
| - </Text> |
139 |
| - <PlayIcon color="rgb(17,24,39)" dark={{ color: 'rgb(243,244,246)' }} /> |
140 |
| - </Container> |
141 |
| - <Container display="flex" alignItems="center" justifyContent="space-between"> |
142 |
| - <Text |
143 |
| - fontSize={14} |
144 |
| - lineHeight={20} |
145 |
| - color="rgb(17,24,39)" |
146 |
| - dark={{ color: 'rgb(243,244,246)' }} |
147 |
| - flexDirection="column" |
148 |
| - > |
149 |
| - The Times They Are a-Changin' |
150 |
| - </Text> |
151 |
| - <PlayIcon color="rgb(17,24,39)" dark={{ color: 'rgb(243,244,246)' }} /> |
152 |
| - </Container> |
153 |
| - <Container display="flex" alignItems="center" justifyContent="space-between"> |
154 |
| - <Text |
155 |
| - fontSize={14} |
156 |
| - lineHeight={20} |
157 |
| - color="rgb(17,24,39)" |
158 |
| - dark={{ color: 'rgb(243,244,246)' }} |
159 |
| - flexDirection="column" |
160 |
| - > |
161 |
| - Subterranean Homesick Blues |
162 |
| - </Text> |
163 |
| - <PlayIcon color="rgb(17,24,39)" dark={{ color: 'rgb(243,244,246)' }} /> |
164 |
| - </Container> |
| 158 | + <Container display="flex" alignItems="center" justifyContent="space-between"> |
| 159 | + <Text |
| 160 | + fontSize={14} |
| 161 | + lineHeight={20} |
| 162 | + color="rgb(17,24,39)" |
| 163 | + dark={{ color: 'rgb(243,244,246)' }} |
| 164 | + flexDirection="column" |
| 165 | + > |
| 166 | + Subterranean Homesick Blues |
| 167 | + </Text> |
| 168 | + <PlayIcon color="rgb(17,24,39)" dark={{ color: 'rgb(243,244,246)' }} /> |
165 | 169 | </Container>
|
166 | 170 | </Container>
|
167 | 171 | </Container>
|
168 | 172 | </Container>
|
169 |
| - </Root> |
170 |
| - </group> |
| 173 | + </Fullscreen> |
| 174 | + </XRLayer> |
171 | 175 | </XR>
|
172 | 176 | </Canvas>
|
173 | 177 | </>
|
|
0 commit comments