shipyard-framework 0.5.80 → 0.5.81

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9ade19933d31d38a134eacb299624f84da4dbdc315db064d206d8d85eac5a6ba
4
- data.tar.gz: ed83ea94e718d7e7f4be972b63e8fb09dd1378a7143ed8ce146edd4c50883caf
3
+ metadata.gz: 84bba4d9d29150b6e1f2dd9182d0111032b8f542379c53b0737a86febdb7ee6a
4
+ data.tar.gz: abaab7f264f6c7eedb8e9de91f872347ad176b67bd5d53f9cf3e120c9f70b242
5
5
  SHA512:
6
- metadata.gz: ea22469d864e693cb57db907f96dc3a43d96e251a03157254f5f7d52955cbf5157926c43b6e573cbf047f90bbf22a5ef0be7ee1ae7750b18769a6970992b4e13
7
- data.tar.gz: 3b4ff9be2a8059ca9d214817f6ff4f72e6b62d7010508868a3504e656786ea619f4b16be2d95678c26e7ff5a598ff001f6720946f9a24d8e684d3d20923797ff
6
+ metadata.gz: 542ca4978afa92443c5e42c065b9c8e1ca883b9f6dab4c9e8d216dd00681a6ac5d5aeca0fc4333b7054de85c6d0164cf1653267814cf50a8b717b9f6dcdb3741
7
+ data.tar.gz: 0be7b4235f28af8dbb48a71fb337379a68cfb45d82f2b81772f80c565c9ad4c0fb4b3608215347cffeff4aa061f9fbdc6b2bb6fbb3cc6a905475cff1e2506e42
@@ -2,6 +2,7 @@
2
2
  //= require ./shipyard/scroll
3
3
  //= require ./shipyard/hamburger
4
4
  //= require ./shipyard/alert
5
+ //= require ./shipyard/accordion
5
6
  //= require ./shipyard/modal
6
7
  //= require ./shipyard/modal-trigger
7
8
 
@@ -10,3 +11,4 @@ var windowScroll = new Scroll(window)
10
11
  var hamburger = new Hamburger('[shipyard=hamburger]')
11
12
  var shipyardAlert = new Alert('[shipyard=alert]')
12
13
  var modalTrigger = new ModalTrigger('[modal-trigger]')
14
+ var accordion = new Accordion('[accordion]')
@@ -0,0 +1,10 @@
1
+ class Accordion extends Shipyard {
2
+ constructor (el) {
3
+ super(el)
4
+ this.on('click', this.toggle)
5
+ }
6
+
7
+ toggle (event, el) {
8
+ document.querySelector(el.getAttribute('accordion')).classList.toggle('accordion-closed')
9
+ }
10
+ }
@@ -8,7 +8,9 @@ class Shipyard {
8
8
  on (events, callback) {
9
9
  this.el.forEach((el) => {
10
10
  events.split(' ').forEach((eventName) => {
11
- el.addEventListener(eventName, callback)
11
+ el.addEventListener(eventName, (e) => {
12
+ callback(e, el)
13
+ })
12
14
  })
13
15
  })
14
16
  return this
@@ -3,8 +3,7 @@ class ModalTrigger extends Shipyard {
3
3
  super(el)
4
4
  this.on('click', () => { this.open() })
5
5
  this.el.forEach((el) => {
6
- let modalName = el.getAttribute('modal-trigger')
7
- this.modal = new Modal(`[modal=${modalName}]`)
6
+ this.modal = new Modal(`[modal=${el.getAttribute('modal-trigger')}]`)
8
7
  })
9
8
  }
10
9
 
@@ -1,6 +1,12 @@
1
1
  +component('accordion')
2
- transition: opacity 400ms ease, margin 400ms ease, padding 400ms ease, max-height 400ms ease
2
+ transition: opacity 400ms linear, margin 400ms ease-out, padding 400ms ease-out, max-height 400ms ease-out
3
3
 
4
+ // Accordion: Sizes
5
+ @each $size, $value in (xs: 500px, sm: 750px, md: 1000px, lg: 1500px, xl: 3000px)
6
+ &-#{$size}
7
+ max-height: $value
8
+
9
+ // Accordion: Closed State
4
10
  &-closed
5
11
  opacity: 0
6
12
  max-height: 0
@@ -9,8 +15,3 @@
9
15
  padding-bottom: 0
10
16
  margin-top: 0
11
17
  margin-bottom: 0
12
-
13
- &-open
14
- @each $size, $value in (xs: 500px, sm: 750px, md: 1000px, lg: 1500px, xl: 3000px)
15
- &-#{$size}
16
- max-height: $value
@@ -1,3 +1,3 @@
1
1
  module Shipyard
2
- VERSION = '0.5.80'
2
+ VERSION = '0.5.81'
3
3
  end
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- shipyard-framework (0.5.80)
4
+ shipyard-framework (0.5.81)
5
5
  actionview (~> 5.0)
6
6
  sprockets-es6 (~> 0.9.2)
7
7
 
@@ -0,0 +1,50 @@
1
+ ---
2
+ title: Accordions
3
+ description: Useful when you want to open and close large blocks of content in a more elegant way.
4
+ sizes:
5
+ -
6
+ name: xs
7
+ value: 500px
8
+ -
9
+ name: sm
10
+ value: 750px
11
+ -
12
+ name: md
13
+ value: 1000px
14
+ -
15
+ name: lg
16
+ value: 1500px
17
+ -
18
+ name: xl
19
+ value: 3000px
20
+ ---
21
+
22
+ {% include page-heading.html page=page %}
23
+
24
+ ---
25
+
26
+ <div class="box-secondary margin-bottom-lg">
27
+ <div class="box box-padding box-link padding-top-md padding-bottom-md" accordion="#accordion-example">
28
+ Click this box to see an example of the accordion transitions.
29
+ </div>
30
+ <div id="accordion-example" class="accordion accordion-xs accordion-closed box-padding rounded-bottom">
31
+ <p>Donec ullamcorper nulla non metus auctor fringilla. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur blandit tempus porttitor. Nullam id dolor id nibh ultricies vehicula ut id elit. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.</p>
32
+ <p>Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Nulla vitae elit libero, a pharetra augue. Etiam porta sem malesuada magna mollis euismod. Curabitur blandit tempus porttitor. Cras mattis consectetur purus sit amet fermentum.</p>
33
+ <p>Nullam quis risus eget urna mollis ornare vel eu leo. Nullam id dolor id nibh ultricies vehicula ut id elit. Vestibulum id ligula porta felis euismod semper. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec ullamcorper nulla non metus auctor fringilla. Etiam porta sem malesuada magna mollis euismod.</p>
34
+ <p>Vestibulum id ligula porta felis euismod semper. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Vestibulum id ligula porta felis euismod semper. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Sed posuere consectetur est at lobortis.</p>
35
+ <p>Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Maecenas sed diam eget risus varius blandit sit amet non magna. Maecenas faucibus mollis interdum. Cras mattis consectetur purus sit amet fermentum.</p>
36
+ </div>
37
+ </div>
38
+
39
+ ```css
40
+ /* Accordion base class needed for the transitions to work during the open and closed states. */
41
+ .accordion { transition: opacity 400ms ease, margin 400ms ease, padding 400ms ease, max-height 400ms ease }
42
+
43
+ /* Accordion: Open State Sizes */
44
+ {%- for size in page.sizes %}
45
+ .accordion-{{ size.name }} { max-height: {{ size.value }}; }
46
+ {%- endfor %}
47
+
48
+ /* Accordion: Closed State */
49
+ .accordion-closed { opacity: 0; max-height: 0; overflow: hidden; padding-top: 0; padding-bottom: 0; margin-top: 0; margin-bottom: 0; }
50
+ ```
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  title: Shipyard Utilities
3
3
  description: The utility classes below can be applied to any component to override or extend the base styles of the component.
4
- utilities: [Responsive, Grid, Typography, Margin & Padding, Colors, Border Radius, Position]
4
+ utilities: [Accordion, Responsive, Grid, Typography, Margin & Padding, Colors, Border Radius, Position]
5
5
  ---
6
6
 
7
7
  {% include page-heading.html page=page %}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shipyard-framework
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.80
4
+ version: 0.5.81
5
5
  platform: ruby
6
6
  authors:
7
7
  - Codeship
@@ -202,6 +202,7 @@ files:
202
202
  - assets/images/arrows/down.svg
203
203
  - assets/images/checkmark.svg
204
204
  - assets/javascripts/shipyard.es6
205
+ - assets/javascripts/shipyard/accordion.es6
205
206
  - assets/javascripts/shipyard/alert.es6
206
207
  - assets/javascripts/shipyard/core.es6
207
208
  - assets/javascripts/shipyard/hamburger.es6
@@ -347,6 +348,7 @@ files:
347
348
  - styleguide/components/tables.md
348
349
  - styleguide/components/tooltips.md
349
350
  - styleguide/index.md
351
+ - styleguide/utilities/accordion.md
350
352
  - styleguide/utilities/border-radius.md
351
353
  - styleguide/utilities/colors.md
352
354
  - styleguide/utilities/grid.md