-
-
Notifications
You must be signed in to change notification settings - Fork 143
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6b96f03
commit 70486da
Showing
22 changed files
with
266 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Document</title> | ||
</head> | ||
<body style="margin: 0; overscroll-behavior: none"> | ||
<script type="module" src="./src/index.tsx"></script> | ||
<div id="root"></div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"type": "module", | ||
"dependencies": { | ||
"@preact/signals-core": "^1.5.1", | ||
"@react-three/drei": "^9.96.1", | ||
"@react-three/fiber": "^8.15.13", | ||
"@react-three/postprocessing": "^2.16.0", | ||
"@react-three/uikit": "workspace:^", | ||
"@react-three/uikit-lucide": "workspace:^", | ||
"@types/three": "^0.160.0", | ||
"r3f-perf": "^7.1.2", | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0", | ||
"three": "^0.160.0" | ||
}, | ||
"scripts": { | ||
"dev": "vite --host" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,175 @@ | ||
import { Environment, OrbitControls } from '@react-three/drei' | ||
import { Canvas, useFrame } from '@react-three/fiber' | ||
import { EffectComposer, TiltShift2 } from '@react-three/postprocessing' | ||
import { Root, Container, Text, Image, setPreferredColorScheme } from '@react-three/uikit' | ||
import { BellRing, Check, PlusCircle } from '@react-three/uikit-lucide' | ||
import { DefaultColors, colors } from '@/theme.js' | ||
import { Avatar } from '@/avatar.js' | ||
import { Button } from '@/button' | ||
import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from '@/card' | ||
import { Switch } from '@/switch' | ||
import { useMemo, useRef } from 'react' | ||
import { signal } from '@preact/signals-core' | ||
import { damp } from 'three/src/math/MathUtils.js' | ||
|
||
setPreferredColorScheme('light') | ||
|
||
export default function App() { | ||
return ( | ||
<Canvas | ||
flat | ||
camera={{ position: [0, 0, 18], fov: 35 }} | ||
style={{ height: '100dvh', touchAction: 'none' }} | ||
gl={{ localClippingEnabled: true }} | ||
> | ||
<Root pixelSize={0.01}> | ||
<DefaultColors> | ||
<CardPage /> | ||
</DefaultColors> | ||
</Root> | ||
<Environment background blur={1} preset="city" /> | ||
<OrbitControls makeDefault /> | ||
</Canvas> | ||
) | ||
} | ||
|
||
const notifications = [ | ||
{ | ||
title: 'Your call has been confirmed.', | ||
description: '1 hour ago', | ||
}, | ||
{ | ||
title: 'You have a new message!', | ||
description: '1 hour ago', | ||
}, | ||
{ | ||
title: 'Your subscription is expiring soon!', | ||
description: '2 hours ago', | ||
}, | ||
] | ||
|
||
export function CardPage() { | ||
const openRef = useRef(false) | ||
const translateY = useMemo(() => signal(-460), []) | ||
const translateZ = useMemo(() => signal(0), []) | ||
useFrame((_, delta) => { | ||
const targetTranslateY = openRef.current ? 0 : -460 | ||
const targetTranslateZ = openRef.current ? 40 : 0 | ||
translateY.value = damp(translateY.value, targetTranslateY, 10, delta) | ||
translateZ.value = damp(translateZ.value, targetTranslateZ, 10, delta) | ||
}) | ||
return ( | ||
<Root pixelSize={0.01} sizeX={4.4}> | ||
<DefaultColors> | ||
<Container | ||
onClick={(e) => { | ||
e.stopPropagation() | ||
openRef.current = !openRef.current | ||
}} | ||
cursor="pointer" | ||
zIndexOffset={1} | ||
transformTranslateZ={translateZ} | ||
> | ||
<Image borderRadiusTop={20} width="100%" src="https://picsum.photos/600/300" /> | ||
<Container | ||
backgroundColor={0xffffff} | ||
dark={{ backgroundColor: 0x0 }} | ||
flexDirection="row" | ||
padding={28} | ||
paddingTop={28 + 4} | ||
alignItems="center" | ||
justifyContent="space-between" | ||
borderRadiusBottom={20} | ||
> | ||
<Container gap={8}> | ||
<Text fontWeight="normal" fontSize={24} lineHeight={1}> | ||
VanArsdel Marketing | ||
</Text> | ||
<Text fontSize={20} fontWeight="medium" letterSpacing={-0.4} color={colors.primary}> | ||
2 activities for you | ||
</Text> | ||
</Container> | ||
<Container flexDirection="row" gap={-6}> | ||
<Avatar width={40} src="https://avatar.iran.liara.run/public/boy?username=Scot" /> | ||
<Avatar width={40} src="https://avatar.iran.liara.run/public/boy?username=Theo" /> | ||
<Avatar width={40} src="https://avatar.iran.liara.run/public/boy?username=Paul" /> | ||
</Container> | ||
</Container> | ||
</Container> | ||
<Container transformTranslateY={-40} overflow="hidden"> | ||
<Container | ||
paddingTop={40} | ||
transformTranslateY={translateY} | ||
backgroundColor={colors.secondary} | ||
borderRadius={20} | ||
> | ||
<CardHeader> | ||
<CardTitle> | ||
<Text>Notifications</Text> | ||
</CardTitle> | ||
<CardDescription> | ||
<Text>You have 3 unread messages.</Text> | ||
</CardDescription> | ||
</CardHeader> | ||
<CardContent flexDirection="column" gap={16}> | ||
<Container flexDirection="row" alignItems="center" gap={16} borderRadius={6} border={1} padding={16}> | ||
<BellRing /> | ||
<Container gap={4}> | ||
<Text fontSize={14} lineHeight={1}> | ||
Push Notifications | ||
</Text> | ||
<Text fontSize={14} lineHeight={1.43} color={colors.mutedForeground}> | ||
Send notifications to device. | ||
</Text> | ||
</Container> | ||
<Container flexGrow={1} /> | ||
<Switch /> | ||
</Container> | ||
<Container> | ||
{notifications.map((notification, index) => ( | ||
<Container | ||
key={index} | ||
marginBottom={index === notifications.length - 1 ? 0 : 16} | ||
paddingBottom={index === notifications.length - 1 ? 0 : 16} | ||
alignItems="flex-start" | ||
flexDirection="row" | ||
gap={17} | ||
> | ||
<Container | ||
height={8} | ||
width={8} | ||
transformTranslateY={4} | ||
borderRadius={1000} | ||
backgroundColor={colors.primary} | ||
/> | ||
<Container gap={4}> | ||
<Text fontSize={14} lineHeight={1}> | ||
{notification.title} | ||
</Text> | ||
<Text fontSize={14} lineHeight={1.43} color={colors.mutedForeground}> | ||
{notification.description} | ||
</Text> | ||
</Container> | ||
</Container> | ||
))} | ||
</Container> | ||
</CardContent> | ||
<CardFooter> | ||
<Button | ||
onClick={(e) => { | ||
e.stopPropagation() | ||
openRef.current = !openRef.current | ||
}} | ||
flexDirection="row" | ||
width="100%" | ||
> | ||
<Check marginRight={8} height={16} width={16} /> | ||
<Text>Mark all as read</Text> | ||
</Button> | ||
</CardFooter> | ||
</Container> | ||
</Container> | ||
</DefaultColors> | ||
</Root> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { StrictMode } from 'react' | ||
import { createRoot } from 'react-dom/client' | ||
import App from './App' | ||
|
||
createRoot(document.getElementById('root')!).render( | ||
<StrictMode> | ||
<App /> | ||
</StrictMode>, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"extends": "../../tsconfig.json", | ||
"compilerOptions": { | ||
"paths": { | ||
"@/*": ["../../packages/kits/default/*"] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { defineConfig } from 'vite' | ||
import path from 'path' | ||
import react from '@vitejs/plugin-react' | ||
|
||
// https://vitejs.dev/config/ | ||
export default defineConfig({ | ||
plugins: [react()], | ||
optimizeDeps: { | ||
include: ['@react-three/uikit-lucide', '@react-three/uikit'], | ||
}, | ||
resolve: { | ||
alias: [ | ||
{ find: '@', replacement: path.resolve(__dirname, '../../packages/kits/default') }, | ||
{ find: '@react-three/uikit', replacement: path.resolve(__dirname, '../../packages/uikit/src/index.ts') }, | ||
], | ||
}, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters