Local setup
git clone https://github.com/shivam-bit/share-for-notion.git
cd share-for-notion/
npm i
npm run start
Then open http://localhost:3000/
Live - share-for-notion.vercel.app
Goal :
To build a re-usable notion, share widget component with plain CSS + any JavaScript Framework.
My thought process:
-
Since plain CSS has been asked to use, I can't even use scss.
-
Since we can use any javascript framework, I will start with react.js as I haven't used it for quite a long and this assignment will act as a refresher.
Project structure
-
Then I was thinking about the project structure, which was the most confusing part. Since we need to use plain CSS, one of the other things that I assumed is that we don't need to use any design component library or extra packages for the UI in react.js.
-
I tried to follow a combination of the atomic design system and the container-view design system.
-
So I built a bunch of core components like button, popover modal etc., which I believe can be extended to any other new feature.
-
Then I built modules which are a combination of a bunch of core components and some specific logic.
-
After which, I built a layout folder. Layouts components are responsible for data layout into a specific form without any business logic.
-
Then we got containers, which are collections of modules, core components and layouts with business logic.
-
I created a share context to share states between components and prevent props drilling with minimal propeties.
CSS structure
-
I have divided the css into similar folder architecture as react so that we don't need to search for classes.
-
All shared CSS properties are declared in index.css as a variable so that we use them anywhere and have a single source of truth.
-
I have followed the CSS BEM methodology for my CSS class name.
-
I was missing scss as I could easily have used mixins and extended property.
Pending Tasks
- Unit Tests (in -progress)
- Storybook Implementation (Pending)
Issues
- Close Modal when clicking outside
- Close all popovers when the sibling popover opens up.
- Close popover when clicked outside.
- Look for performance improvement.