Giter VIP home page Giter VIP logo

cf-expandables's Introduction

⚠️ THIS REPO IS DEPRECATED (1/15/2016) ⚠️

Please migrate to using capital-framework.

cf-expandables

Build Status Dependency Status

Standard expandable (show/hide) component. This component can be used by itself, but it was made for Capital Framework, a new front end framework developed at the Consumer Financial Protection Bureau.

The current version number can be found in bower.json and follows Semantic Versioning 2.0. Release notes are recorded in the CHANGELOG and on the Releases page.

If you would like to take advantage of more components or if you're new to Capital Framework, we encourage you to start here.

How to use this component

Detailed instructions can be found in the Capital Framework documentation site.

Getting involved

We welcome your feedback and contributions.

Running tests

Before contributing to our codebase, please ensure all tests pass. After cloning this repository to your machine, run:

$ npm install
$ npm test

Open source licensing info

  1. TERMS
  2. LICENSE
  3. CFPB Source Code Policy

Credits and references

Docs and demo built with the excellent Topdoc.

cf-expandables's People

Contributors

anselmbradford avatar ascott1 avatar contolini avatar himedlooff avatar jimmynotjim avatar kimberlymunoz avatar scotchester avatar

Stargazers

 avatar  avatar

Watchers

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

cf-expandables's Issues

Expandable groups should use list markup

An expandable group would be semantically better as an unordered list:

<div class="expandable-group">
        <div class="expandable-group_header">...</div>
        <ul>
             <li class="expandable expandable__padded">...</li>
             <li class="expandable expandable__padded">...</li>
             ...
        </ul>
</div>

Remove font awesome dependency

Since this is the only current cf- component that requires an icon (I think), would it make sense to instead serve the + icon as an SVG with an image fallback. That would allow us the freedom to use any icon system (cf-icons, font-awesome, custom) without effecting this plugin.

What do you think?

Click Show/Hide creates animation queue

I would suggest that multiple clicks on show/hide should perform only a single toggle rather than adding an animation event to the queue. Current behavior allows multiple clicks which are then executed in sequence which could be confusing to users that double-click or click multiple times. I'll look into it.

Make Sublime snippets

http://docs.sublimetext.info/en/latest/extensibility/snippets.html

For example:

<snippet>
    <content><![CDATA[<div class="expandable expandable__padded">
    <button class="expandable_header expandable_target">
        <span class="expandable_header-left expandable_label">
            ${1:Expandable label}
        </span>
        <span class="expandable_header-right expandable_link">
            <span class="expandable_cue-open">
                Show
                <span class="cf-icon cf-icon-plus-round"></span>
            </span>
            <span class="expandable_cue-close">
                Hide
                <span class="cf-icon cf-icon-minus-round"></span>
            </span>
        </span>
    </button>
    <div class="expandable_content">
        <p>
            ${0:My expandable text}
        </p>
    </div>
</div>]]></content>
    <tabTrigger>cf_expandable</tabTrigger>
    <scope>text.html</scope>
</snippet>

We would have to update the markup example in the CSS comments to support fields like $1.

Change icons with JS instead of CSS

We could change > .expandable_target .expandable_cue-open to a JS-approach so we don't have to rely on direct descendants to fix this nested expandables issue.

Explain JS tests better

I was a little confused when running the JS tests. I got results in the command line but wasn't sure how to add new ones. Then once I read up on qUnit I was confused about why I couldn't see the tests in a browser using connect (the answer is because connect is only alive during a task).

We should explain how to add new tests and how to make connect persistent. We should also note that contributors should be running tests if they change JS.

Tweaks to animated cues

  • make it work with text in the cue
  • update the transition time to 0.15 seconds
  • make it work with btn_icon__right/left

Expandable groups should have a top-border when a header is absent

When an expandable group has a header there is a horizontal rule between the header and the expandable items. However, when a header isn't used the horizontal rule is gone:

With header:
screen shot 2015-04-03 at 12 34 00 pm

Without header:
screen shot 2015-04-03 at 12 34 10 pm

The expandable group should keep the horizontal rule at the top whether a header is present or not, so that it looks like:
screen shot 2015-04-03 at 12 36 46 pm

Better handling of missing dependencies

It's not totally clear that you need to wire up jquery.easing in order to use this. It would be nice if the README explained this OR it would be cool if the JS would not break if jquery.easing wasn't available. Maybe something like:

if jquery.easing
    slide w/ easing
else
    just do normal linear sliding that is default to jquery
    maybe throw a useful error that says jquery.easing is missing?

Show or add expand/contract button markup via JavaScript

Ideally the expandables wouldn't display the show/hide buttons at all when JS is turned off:

screen shot 2015-09-09 at 4 10 50 pm

Have them default to either display:none or not being part of the DOM at all and use the expandables JS script to change their display or add them to the DOM.

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.