Giter VIP home page Giter VIP logo

charterspacetest's Introduction

CharterSpaceTest

In this project I've walk through my implementation for the Charter Space take home assignment.

For the first task, I had to implement a NodeType to check if the node _id is an ObjectId or a String if not, throw an error.

In my implementation that you can find under src/schema/nodeDataType.ts file, I've created a z.object that can accept either an ObjectId or a String checking if the string is less than 24 characters (Valid Hex String) and the transform it to an ObjectId so we always have the same type inside _id.

For the second task, I've implemented a custom parent node that can be resized and shrinked when children are moved around the border.

For the resized part I've used the NodeResizer type from ReactFlow API adding expandParent: true property to all children node so the parent can resize accordingly.

For the shrink instead, I've used onResizeStart() and onResizeEnd() hooks to check if there are some children close to the border when the parent start to resize.

I've created a custom function to check possible collisions using useNodes() hook to see x,y position and width of all the nodes in my ReactFlowComponent.

charterspacetest's People

Contributors

ranzeb avatar dependabot[bot] avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.