-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# Overview onboarding과 웹뷰를 위한 falling 페이지 구현 --------- Co-authored-by: Jonghyeon Ko <[email protected]>
- Loading branch information
Showing
122 changed files
with
9,181 additions
and
805 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 |
---|---|---|
@@ -1,4 +1,6 @@ | ||
.vscode | ||
.eslintrc.js | ||
packlint.config.mjs | ||
node_modules | ||
node_modules | ||
esm | ||
dist |
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 |
---|---|---|
|
@@ -34,3 +34,9 @@ yarn-error.log* | |
|
||
# vercel | ||
.vercel | ||
|
||
# bundled | ||
dist | ||
esm | ||
|
||
stats.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
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,39 @@ | ||
'use client'; | ||
|
||
import { StackView, useStackBall } from '@sulsul/ui'; | ||
import { useEffect, useState } from 'react'; | ||
import { drinkImage, drinks } from '../constants/drinks'; | ||
|
||
export const Falling = () => { | ||
const [isFirstTouch, setIsFirstTouch] = useState(false); | ||
const { addBall, boxRef, canvasRef } = useStackBall(); | ||
|
||
useEffect(() => { | ||
const addItem = (event: any) => { | ||
if (!isFirstTouch) { | ||
setIsFirstTouch(true); | ||
return; | ||
} | ||
|
||
if (event.detail.data === undefined) { | ||
throw new Error('event.detail.data is undefined'); | ||
} | ||
|
||
const { image, size } = drinkImage[event.detail.data as drinks]; | ||
addBall(image, size); | ||
|
||
window.sulsulBridge.onAddBallSuccess(event.detail.data as drinks); | ||
}; | ||
window.addEventListener('addBall', addItem); | ||
|
||
return () => { | ||
window.removeEventListener('addBall', addItem); | ||
}; | ||
}, [addBall, isFirstTouch]); | ||
|
||
return ( | ||
<div style={{ width: '100%', height: '100dvh' }}> | ||
<StackView boxRef={boxRef} canvasRef={canvasRef} isTouched={isFirstTouch} /> | ||
</div> | ||
); | ||
}; |
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,24 @@ | ||
export const drinkImage = { | ||
소주: { | ||
image: '/images/bubble-soju.png', | ||
size: 80, | ||
}, | ||
맥주: { | ||
image: '/images/bubble-beer.png', | ||
size: 100, | ||
}, | ||
와인: { | ||
image: '/images/bubble-wine.png', | ||
size: 92, | ||
}, | ||
고량주: { | ||
image: '/images/bubble-goryanju.png', | ||
size: 68, | ||
}, | ||
위스키: { | ||
image: '/images/bubble-whisky.png', | ||
size: 68, | ||
}, | ||
} as const; | ||
|
||
export type drinks = keyof typeof drinkImage; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
'use client'; | ||
|
||
import { Falling } from './components/Falling'; | ||
|
||
export default function Home() { | ||
return <main>explore amplify test</main>; | ||
return <Falling />; | ||
} |
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,72 @@ | ||
import { | ||
createContext, | ||
PropsWithChildren, | ||
ReactNode, | ||
Suspense, | ||
useContext, | ||
useEffect, | ||
useState, | ||
} from 'react'; | ||
|
||
const AndroidWebviewContext = createContext<AndroidWebview | null>(null); | ||
export const AndroidWebviewProvider = (props: PropsWithChildren) => { | ||
const [androidWebview, setAndroidWebview] = useState<AndroidWebview | null>(null); | ||
useEffect(() => { | ||
if ((window as any).android) { | ||
setAndroidWebview((window as any).android); | ||
} | ||
}, []); | ||
return <AndroidWebviewContext.Provider {...props} value={androidWebview} />; | ||
}; | ||
|
||
export const AndroidWebviewGuaranteed = ({ | ||
render, | ||
fallback, | ||
}: { | ||
render: (androidWebview: AndroidWebview) => ReactNode; | ||
fallback?: ReactNode; | ||
}) => { | ||
const androidWebviewContextValue = useContext(AndroidWebviewContext); | ||
|
||
if (androidWebviewContextValue === null) { | ||
return <>{fallback}</>; | ||
} | ||
const androidWebview = androidWebviewContextValue; | ||
return <>{render(androidWebview)}</>; | ||
}; | ||
|
||
interface AndroidWebview { | ||
showToastMessage(): void; | ||
} | ||
|
||
export const useAndroidWebview = (): AndroidWebview => { | ||
const androidWebviewContextValue = useContext(AndroidWebviewContext); | ||
|
||
if (androidWebviewContextValue === null) { | ||
throw new Promise(() => {}); | ||
} | ||
|
||
return androidWebviewContextValue; | ||
}; | ||
|
||
export const Comp = () => { | ||
return ( | ||
<> | ||
hihihih jijojooj | ||
<Suspense fallback={<>loading...</>}> | ||
<AndroidWebviewUser /> | ||
</Suspense> | ||
<AndroidWebviewGuaranteed | ||
render={(webview) => <button onClick={webview.showToastMessage}>hi</button>} | ||
/> | ||
</> | ||
); | ||
}; | ||
|
||
const AndroidWebviewUser = () => { | ||
const androidWebview = useAndroidWebview(); | ||
|
||
const handleClick = () => androidWebview.showToastMessage(); | ||
|
||
return <button onClick={handleClick}></button>; | ||
}; |
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 |
---|---|---|
@@ -1,4 +1,7 @@ | ||
module.exports = { | ||
root: true, | ||
extends: ['@sulsul/eslint-config/react-ts-noimport', 'plugin:@next/next/recommended'], | ||
rules: { | ||
'react/no-unknown-property': ['error', { ignore: ['css'] }], | ||
}, | ||
}; |
This file was deleted.
Oops, something went wrong.
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,6 @@ | ||
declare namespace NodeJS { | ||
interface ProcessEnv { | ||
readonly NODE_ENV: 'development' | 'production' | 'test'; | ||
readonly NEXT_PUBLIC_DOMAIN: string; | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"allowUnicodeIdentifiers": true | ||
} |
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,7 @@ | ||
{ | ||
"$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json", | ||
"spaces": 2, | ||
"generator-cli": { | ||
"version": "6.6.0" | ||
} | ||
} |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 @@ | ||
{ | ||
"name": "sulsul", | ||
"short_name": "sulsul", | ||
"icons": [ | ||
{ | ||
"src": "/favicons/android-chrome-192x192.png", | ||
"sizes": "192x192", | ||
"type": "image/png" | ||
}, | ||
{ | ||
"src": "/favicons/android-chrome-512x512.png", | ||
"sizes": "512x512", | ||
"type": "image/png" | ||
} | ||
], | ||
"theme_color": "#ffffff", | ||
"background_color": "#ffffff", | ||
"display": "standalone" | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
This file was deleted.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.
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 @@ | ||
{ | ||
"env": { | ||
"production": { | ||
"plugins": ["@emotion"] | ||
} | ||
}, | ||
"plugins": ["@emotion"] | ||
} |
Oops, something went wrong.