Giter VIP home page Giter VIP logo

i-must-do-react's Introduction



react  javascript  jsx  sass-scss

Content

  1. Demo
  2. Features
  3. Realizing
  4. Difficulties

Demo

i-must-do-demo-optimized

I Must Do - a Web TODO-application on React.js.

Features

Basic features:

  • viewing the task list;
  • adding, editing and deleting tasks;
  • view detailed information about a task.

Specific features:

  • searching tasks by name;
  • setting the task completion status (waiting, in progress, complete)
  • dragging the border between the task list and the view & edit form
  • counting the total number of tasks and each type of tasks separately

Realizing

In the process of creating this application, I have learned the base of React.js in practice :

I also used the JavaScript Fetch API to get tasks data from a fake json server when the application is starting.
I used SASS (SCSS) for creating the styles of react-components as a scss-modules.

Difficulties

A particular difficulty for me was the dragging the border between the task list and the view & edit form.
I realized it with Resizer-element and events onDrugStart and onDrug

function Resizer({ className, resizableElem }) {

	let startPosition, tasksWidth

	// creating an element for changing drag effect picture
	const dragImg = document.createElement('canvas');
	dragImg.classList.add('drag-img')

	// get coordinates and width values at the start of resizing
	const startResize = e => {
		e.stopPropagation()
		startPosition = e.clientX // X of resizer element
		tasksWidth = resizableElem.current.offsetWidth // current width of Resizer element
		e.dataTransfer.setDragImage(dragImg, 0, 0) // set drag image
		e.target.style.cursor = 'col-resize'
	}

	// change width when border is moving
	const resize = e => {
		resizableElem.current.style.width = `${tasksWidth + e.clientX - startPosition}px`
	}

	return (
		<div
	    className={ className }
      draggable={ true }
      onDragStart={ startResize }
      onDrag={ resize }
    />
	)
}

export default Resizer

i-must-do-react's People

Contributors

egoromanoff 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.