Giter Club home page Giter Club logo

focus's Introduction

Focus

A minimal popup, modal, notification, overlay, drawer and dialogue window plugin.

View the Documentation for more

Development

$ git clone [email protected]:Elkfox/Focus.git

$ npm install

Focus is compiled using gulp. The src file is located in src/focus.js and built into /dist. Gulp is setup to lint the source with the airbnb style guide. Transpile the code using babel from ES6 to ES5 for best browser support. Create git semantic versioning (semver) releases, with automatic changelog creation.

Focus uses Atom conventional commit messages to automatically create a changelog so it is important that your commit messages comply to this standard: https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-atom

Commands

npm test Lint the code using the airbnb style guide and return any errors or warnings. If any changes are pushed to the master repository without first being tested the build will not pass the Travis CI tests.

npm run build Compile the code to es5 and build a minified and an unminified version to the dist directory.

npm run release [type] To use the release command correctly you first need to setup your env correctly. See Setting up your env for more info.

Running npm release without any arguments will default to releasing it as a patch which should only be used for releasing backward compatible bug fixes.

[type]

  • minor - MINOR version when you add functionality in a backwards-compatible manner
  • major - MAJOR version when you make incompatible API changes,
  • prerelease - A pre-release version indicates that the version is unstable and might not satisfy the intended compatibility requirements as denoted by its associated normal version.

Refer to https://semver.org/ for more information on release arguments

Setting up your env

To create a github release you first need to duplicate the .env-sample.json and rename it .env.json. The .env.json file should never be commited as we be adding an a github private key to it. You can create a private key by following the link in the sample env. Don't forget to remove the comment from your env.

License

The code is available under an MIT License.

focus's People

Contributors

allanarmstrong avatar cam avatar georgebutter avatar oscarstranger avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

focus's Issues

Add 'detach' flag

Add detach flag to Focus config which appends popups to the end of the document body on load.

Should be using flexbox instead

The popups are using -50% transforms to center them. This sometimes means that they, and their contents are placed on a subpixel value which causes blurriness. There are hacks to resolve this but it varies across browsers and hardware.

Seems as though flexbox is the only pure css solution to this issue.

image
image

Linked/multiple targets

One focus to control both a mobile view and a desktop view for example.

Perhaps it's best not to use Id as the default selector

Add additional config

Options to add config for:

  • applying a class to the target button
  • visible
  • use slide down/up

Adding a second close link

Hi. Thanks for the code.

I tried adding a second close link, but it doesn't work. As a work around, I used the .popup-outer on a div with a close text inside. This closed it on desktop, but not iphone.

Any advice would be much appreciated. It's the final step before I go live with this.

Thanks!

Update docs

  • Correct callback objects (targets, etc.)
  • Add data-target check to data-close events
  • Add detach flag

Targeted close events

Add data-target check to data-close events


if ((typeof(jQuery(this).data('target')) == 'undefined') || (jQuery(this).data('target') == _this.target)) {
  _this.hide();
}

Autofocus classes

In the original Reinforced popup system, we added an autofocus helper class into the JS to attach autofocus events to inputs in forms inside popups. It would be great if we could integrate this into the new Popups.js

The code went something like this:

  $('.popup-link').on('click', function(event) {
    ... other stuff here
    setTimeout(function(){
      $(popupId + ' .Autofocus').focus();
    }, 300);
  });

data-trigger events

The popups trigger event listens for all elements with [data-trigger] instead of [data-trigger="popup"] which can disable other unrelated functions that might want to use the data-trigger attribute (such as: data-trigger="toggle" or data=trigger="my-unrelated-trigger")

The trigger line should be updated as follows:
jQuery(document).on('click', '[data-trigger]', function(event) {
jQuery(document).on('click', '[data-trigger="popup"]', function(event) {

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.