diff --git a/examples/simultaneous-cursors/README.md b/examples/simultaneous-cursors/README.md new file mode 100644 index 000000000..c07d50a5a --- /dev/null +++ b/examples/simultaneous-cursors/README.md @@ -0,0 +1,61 @@ +# Yorkie Simultaneous-Cursors Example + +

+ + Live Preview + +

+ +simultaneous-cursors + +## How to run demo + +### With Yorkie Dashboard + +Install dependencies + +```bash +$ npm install +``` + +Create an account on [Yorkie Dashboard](https://yorkie.dev/dashboard) +Create a new project and copy your public key from the dashboard +Update the `.env` file like so: + +``` +VITE_YORKIE_API_ADDR='https://api.yorkie.dev' +VITE_YORKIE_API_KEY='your_key_xxxx' +``` + +Start demo project + +```bash +$ npm run dev +``` + +### With local Yorkie server + +Install dependencies + +```bash +$ npm install +``` + +At project root, run below command to start Yorkie and Envoy proxy. + +```bash +$ docker-compose -f docker/docker-compose.yml up --build -d +``` + +Update the `.env` file like so: + +``` +VITE_YORKIE_API_ADDR='http://localhost:8080' +VITE_YORKIE_API_KEY='' +``` + +Start demo project + +```bash +$ npm run dev +``` diff --git a/examples/simultaneous-cursors/src/assets/icons/icon_cursor.svg b/examples/simultaneous-cursors/public/icons/icon_cursor.svg similarity index 100% rename from examples/simultaneous-cursors/src/assets/icons/icon_cursor.svg rename to examples/simultaneous-cursors/public/icons/icon_cursor.svg diff --git a/examples/simultaneous-cursors/src/assets/icons/icon_heart.svg b/examples/simultaneous-cursors/public/icons/icon_heart.svg similarity index 100% rename from examples/simultaneous-cursors/src/assets/icons/icon_heart.svg rename to examples/simultaneous-cursors/public/icons/icon_heart.svg diff --git a/examples/simultaneous-cursors/src/assets/icons/icon_pen.svg b/examples/simultaneous-cursors/public/icons/icon_pen.svg similarity index 100% rename from examples/simultaneous-cursors/src/assets/icons/icon_pen.svg rename to examples/simultaneous-cursors/public/icons/icon_pen.svg diff --git a/examples/simultaneous-cursors/src/assets/icons/icon_thumbs.svg b/examples/simultaneous-cursors/public/icons/icon_thumbs.svg similarity index 100% rename from examples/simultaneous-cursors/src/assets/icons/icon_thumbs.svg rename to examples/simultaneous-cursors/public/icons/icon_thumbs.svg diff --git a/examples/simultaneous-cursors/src/components/Cursor.jsx b/examples/simultaneous-cursors/src/components/Cursor.jsx index 080da8f3c..379c24eca 100644 --- a/examples/simultaneous-cursors/src/components/Cursor.jsx +++ b/examples/simultaneous-cursors/src/components/Cursor.jsx @@ -5,7 +5,7 @@ const Cursor = ({ selectedCursorShape, x, y, pointerDown }) => { return ( <> diff --git a/examples/simultaneous-cursors/src/components/CursorSelections.jsx b/examples/simultaneous-cursors/src/components/CursorSelections.jsx index cbaa933f0..9345ef51b 100644 --- a/examples/simultaneous-cursors/src/components/CursorSelections.jsx +++ b/examples/simultaneous-cursors/src/components/CursorSelections.jsx @@ -20,7 +20,7 @@ const CursorSelections = ({ handleCursorShapeSelect, clientsLength }) => { ? 'cursor-shape-selected' : 'cursor-shape-not-selected' }`} - src={`src/assets/icons/icon_${shape}.svg`} + src={`./icons/icon_${shape}.svg`} /> ))} diff --git a/examples/simultaneous-cursors/src/components/SingleAnimation.jsx b/examples/simultaneous-cursors/src/components/SingleAnimation.jsx index 79d139895..7a3c5bfb1 100644 --- a/examples/simultaneous-cursors/src/components/SingleAnimation.jsx +++ b/examples/simultaneous-cursors/src/components/SingleAnimation.jsx @@ -16,7 +16,7 @@ export default function SingleAnimation({ >
- +
diff --git a/examples/simultaneous-cursors/thumbnail.jpg b/examples/simultaneous-cursors/thumbnail.jpg new file mode 100644 index 000000000..f8dafd17d Binary files /dev/null and b/examples/simultaneous-cursors/thumbnail.jpg differ diff --git a/examples/simultaneous-cursors/vite.config.js b/examples/simultaneous-cursors/vite.config.js index 5a33944a9..a4d543a98 100644 --- a/examples/simultaneous-cursors/vite.config.js +++ b/examples/simultaneous-cursors/vite.config.js @@ -3,5 +3,6 @@ import react from '@vitejs/plugin-react' // https://vitejs.dev/config/ export default defineConfig({ + base: '', plugins: [react()], })