{"id":19957499,"url":"https://github.com/danpacho/vanilla-vercel-clone","last_synced_at":"2026-06-07T01:31:21.432Z","repository":{"id":62502142,"uuid":"558749286","full_name":"danpacho/vanilla-vercel-clone","owner":"danpacho","description":"📦 vanilla js로 vercel 페이지 일부를 클놈코딩 해봅니다!","archived":false,"fork":false,"pushed_at":"2022-11-02T09:27:59.000Z","size":1255,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-12T07:12:37.456Z","etag":null,"topics":["component-based","vanilla-javascript","vercel-clone"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/danpacho.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-10-28T07:57:15.000Z","updated_at":"2023-08-06T09:38:31.000Z","dependencies_parsed_at":"2022-11-02T12:01:55.550Z","dependency_job_id":null,"html_url":"https://github.com/danpacho/vanilla-vercel-clone","commit_stats":null,"previous_names":["danpacho/vanilla-vercel-clone"],"tags_count":0,"template":false,"template_full_name":"danpacho/vanilla-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danpacho%2Fvanilla-vercel-clone","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danpacho%2Fvanilla-vercel-clone/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danpacho%2Fvanilla-vercel-clone/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danpacho%2Fvanilla-vercel-clone/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danpacho","download_url":"https://codeload.github.com/danpacho/vanilla-vercel-clone/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241389132,"owners_count":19955106,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["component-based","vanilla-javascript","vercel-clone"],"created_at":"2024-11-13T01:38:05.293Z","updated_at":"2026-06-07T01:31:20.616Z","avatar_url":"https://github.com/danpacho.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Vercel Clone / 7일\n\n## 중점적인 고민 사항 🧐\n\n\u003e vanilla `js` \u0026 `CSS`만을 사용하면서 느껴지는 불편함 개선해보기\n\n1. 중복되는 `html` 마크업의 문제점\n2. 절차적 프로그래밍의 문제점\n3. 전역적 스타일링과 중복 `class` naming의 문제점\n4. 모든것을 허용해주는 지나치게 친절한 `js`\n\n## 해결 방법 🎁\n\n\u003e 중복과 절차형 프로그래밍 ➡️ 선언형 컴포넌트\n\n1. `Component` class\n\n**선언형** 컴포넌트\n\n```js\nconst Container = (children) =\u003e\n    new Component({\n        template: `\n            \u003cdiv class=\"${style.box}\"\u003e\n                ${children}\n            \u003c/div\u003e`,\n    }).html()\n```\n\n컴포넌트 **활용** 및 **재사용**\n\n```js\nimport { Container } from \"어디선가\"\n\nconst Section = () =\u003e\n    new Component({\n        template: `\n            \u003cdiv\u003e\n                ${Container(`\n                    \u003cbutton\u003e안녕?\u003c/button\u003e\n                `)}\n            \u003c/div\u003e\n            `,\n    }).html()\n```\n\n2. `EventListener` class\n\n컴포넌트에 **명시적으로** 이벤트 부착 및 제거\n\n```js\nconst Container = (children) =\u003e {\n    const clickHandler = (e) =\u003e {\n        console.log(e.clientX)\n    }\n\n    return new Component({\n        template: `\n            \u003cdiv class=\"${style.box}\"\u003e\n                ${children}\n            \u003c/div\u003e`,\n    })\n        .addEvent((target) =\u003e ({\n            type: \"click\",\n            handler: clickHandler,\n        }))\n        .removeEvent((target) =\u003e ({\n            type: \"click\",\n            handler: clickHandler,\n        }))\n}\n```\n\n3. `atom` state management\n\n명시적인 변수관리의 장점\n\n```js\nconst Counter = () =\u003e {\n    const [count, setCount] = atom(0)\n    const increase = () =\u003e {\n        setCount(count() + 1)\n    }\n\n    return new Component({\n        template: `\n            \u003cbutton\u003e\n                Counter is ${count()}\n            \u003c/button\u003e`,\n    })\n        .addEvent(() =\u003e ({\n            type: \"click\",\n            handler: increase,\n        }))\n        .render()\n}\n```\n\n\u003e 스타일링 ➡️ `CSS module`을 활용한 scoped `CSS`\n\n컴포넌트 파일을 컴포넌트 및 스타일로 구분하기\n\n```\n📦my-component\n ┣ 📜index.js\n ┗ 💄index.module.css\n```\n\n\u003e 지나친 자유 ➡️ `jsdoc`과 `jsconfig.json`으로 탄압\n\n든든한 무기 준비 `jsconfig.json`\n\n```json\n{\n    \"compilerOptions\": {\n        \"strict\": true,\n        \"allowJs\": true,\n        \"checkJs\": true,\n        \"noEmit\": true,\n        \"module\": \"NodeNext\",\n        \"moduleResolution\": \"NodeNext\",\n        \"typeRoots\": [\"./node_modules/@types\"],\n        \"forceConsistentCasingInFileNames\": true\n    },\n    \"include\": [\"src\"],\n    \"exclude\": [\"node_modules\", \"dist\"]\n}\n```\n\n기맥힌 `jsdoc`과 잠잠해진 `js`\n\n```js\n/**@type string */\nlet 반드시_스트링 = \"이거 반드시 글자에용\"\n\n// ❌ 가능은 하지만, 오류 매세지가 뜨는 매직\n반드시_스트링 = 1\n```\n\n## 구현사항 ✅\n\n1. 마우스 `hover`시 좌표에따라 동적으로 반응하는 카드\n2. `radial gradient`와 `blur` api를 사용한 효과\n3. 버튼 ring 회전\n4. gradient 텍스트 변형 및 전환\n\n## 구현결과 🎉\n\n![최초 로딩 페이지!](./assets/preview.png)\n\n## 좋았던 점 ✅\n\n1. 선언적이며 재사용성이 높은 함수컴포넌트 기반으로 제작해 많은 중복을 줄일 수 있었음\n2. 바닐라 js의 `DOM` api와 활용법에 대해 깊게 학습할 수 있었음\n3. **reactivness**를 구현하기 위해 사용하는 웹프레임워크들의 전략(`compile` / `reactiveness` / `v-dom \u0026 diff`)의 필요성을 느낌\n\n## 개선할 점 🔸\n\n1. **reactiveness**가 없음. state변경을 감지하고 재렌더링하는 로직이 없기에 직접 `DOM` api를 호출하거나 `CSS variable`를 사용해야한다는 단점이 있음\n\n    \u003e `Proxy`를 이용한 변수 구독과 렌더링 등의 방법\n\n2. `string`을 `HTML`로 사용하므로 `jsx`와 같은 직관성과 개발 편의성이 없음.\n\n3. `render()`호출시 `parent`가 존재하며, `event`등이 부착된 반응성이 있는 컴포넌트는 원하는 위치에 렌더링하기가 까다로움\n\n렌더링 위치 지정하기 ✅\n\n```js\nconst StaticParent = () =\u003e new Component({\n    template: \"\u003cdiv id=\"여기에-렌더링\"\u003e{...}\u003c/div\u003e\"\n})\n\nconst ReactiveComponent = () =\u003e {...}\n\n// ❌ DOM-tree에서 id요소를 탐색 불가능\nReactiveComponent.render(\"여기에-렌더링\")\n\nStaticParent.render()\n\n// ✅ DOM-tree에서 id요소를 탐색 가능\nReactiveComponent.render(\"여기에-렌더링\")\n```\n\n렌더링 직접 하기 ❌\n\n```js\nconst ReactiveComponent = () =\u003e {...}\n\nconst StaticParent = () =\u003e new Component({\n    // ❌ html 렌더링 불가\n    template: `${ReactiveComponent.render()}`\n    template: `${ReactiveComponent.html()}`\n})\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanpacho%2Fvanilla-vercel-clone","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanpacho%2Fvanilla-vercel-clone","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanpacho%2Fvanilla-vercel-clone/lists"}