Giter Site home page Giter Site logo

deanmarano / ember-file-drop-zone Goto Github PK

View Code? Open in Web Editor NEW

This project forked from st-h/ember-file-drop-zone

0.0 1.0 0.0 5.61 MB

easily add a dropzone to enable file drag and drop to your ember app

License: MIT License

JavaScript 61.40% HTML 9.81% CSS 2.86% Handlebars 8.09% TypeScript 17.85%

ember-file-drop-zone's Introduction

ember-file-drop-zone

Greenkeeper badge Latest NPM release TravisCI Build Status Coverage Status Code Climate Ember Observer Score Dependencies Dev Dependencies

easily add a dropzone to enable file drag and drop to your ember app

Compatibility

  • Ember.js v3.16 or above
  • Ember CLI v2.13 or above
  • Node.js v10 or above

Since version 1.0.0 this addon makes use of glimmer components only.

Installation

ember install ember-file-drop-zone

Demo

check out the demo page

Usage

See the source code of the demo app for more complex examples

Component

<FileDropZone @onDrop={{this.addFiles}} @disabled={{this.dropZoneDisabled}} as |state|>
  {#if state.hovering}}
    hovering over the dropzone
  {{else if state.dragging}}
    dragging is active
  {{else}}
    drop your files here...
  {{/if}}
</FileDropZone>

Parameters

Paramter type default description
disabled boolean false when set to true, the dropzone is disabled and files can no longer be dropped

Events

onDrop(files)

called when files have been dropped

files an EmberArray of js file objects that were dropped

onDragEnter()

called when files are being dragged over the dropzone

onDragLeave()

called when files are no longer dragged over the dropzone

Styling

This addon does not provide any predefined styles. However, it applies appropriate css class names so that look can be modified as needed.

class description
ember-file-drop-zone Used to style the default state of the dropzone
disabled Applied when the dropzone is disabled
dragging Applied when one or more files are current being dragged over the dropzone

Please see app.css for a styling example:

.ember-file-drop-zone {
  // initial styles
}

.ember-file-drop-zone.disabled {
  // styles when disabled
}

.ember-file-drop-zone.dragging:not(.disabled) {
  // styles when files are being dragged over the window, but not over the dropzone and dropzone is not disabled
}

.ember-file-drop-zone.hovering {
  // styles when files are being dragged over the dropzone (independent of the disabled state)
}

Contributing

See the Contributing guide for details.

License

This project is licensed under the MIT License.

ember-file-drop-zone's People

Contributors

ember-tomster avatar greenkeeper[bot] avatar st-h 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.