Details
- You are creating a UI where people can split “pills”
- There will be a vertical and horizontal line following the user’s cursor. Let’s call them “split lines”
- A pill is simply a box (a
div
) that has rounded corners.
- Users will be able to draw pills by clicking and dragging from any empty part of the page.
- Each pill should have a random color assigned to it.
- The minimum size of a pill would be
40px x 40px
- The border radius of each pill should be
20px
- When a user single clicks on any part of the page, all pills that intersect the “split lines” will split along that split line.
- After a pill has been split the parts of the pill will retain their original corner radius.
- Each pill or part of a pill can be moved via dragging
- Each part of a pill can be further divided by splitting again by single clicking.
- The minimum size of a part of a pill should be
20px x 20px
- Each part of a pill should retain the original pill’s color.
- If a certain part of a pill is already too small to be split, just move the part to either side of the split line.
- Pill should have a think border so that it is easy to tell the parts apart from each other after a pill is split.
(Common) Rules
- Don’t make change to the
package.json
file provided int he starter code.
- Don’t use an extra libraries from npm.
- Don’t use SVG or Canvas; prefer to keep it only React to render HTML and CSS/Tailwind
Evaluate Yourself
- [ ] (1/6) you have the lines following the cursor
- [ ] (2/6) users are successfully being able to draw pills