swedbank-pay-design-guide-jekyll-theme 1.16.2 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7d4b8957148c77b2aad1d8d9e3fc3118ae4de5bcfee5a79d78993d9d66eca82e
4
- data.tar.gz: 92452487974ff9ec8ce12ca732cbc31905e47b39a6392234b71a85031b5f8382
3
+ metadata.gz: 7af1d6da34a402277a02f21b3b4add29bc52b53a513595c54aee678b93af2e56
4
+ data.tar.gz: 59b01ae02cb720bec35b79f269591fb3472fdbdac8e5db31e82471d285721eb4
5
5
  SHA512:
6
- metadata.gz: 0ed3928b70b7646d08752754086582ade494b7a29455b29f87e95aa6bb4a3632ce4aa32aeb8a979b2e2f651eb47682373af8ea1629931460221696d0719e9bb9
7
- data.tar.gz: f8a6e1438d03028ab1ac07673edb8db98794b410b309deebea0fcdee7bcccdf1deaefdcd401bcae9ea30cb0db624e10818dd4eb949287f911a79f3d0237f8fb5
6
+ metadata.gz: 45f229b194ddc7e8e1b5fa31fb3e6fabc6441b3bc4e7ec87c78e1ab9da6eabf6d6f0d8c93cdbbf8e12060827c7f95dbbd17aeeaf798ffbed2760e9c721952c3c
7
+ data.tar.gz: a4d079b0d677f4584f722b4cc2ada4dbc517007358e26a49e7ba7c9141b3f9cb807a9df8c7c6a2c257fd9bc522fdeb960e4348f95c15746116cc26717a698c7f
@@ -2,8 +2,8 @@
2
2
 
3
3
  <div class="accordion accordion-table mb-4">
4
4
  <button type="button" class="accordion-header pt-0" aria-expanded="false" aria-controls="exp-1">
5
- <span class="mr-3 show">Show properties</span>
6
- <span class="mr-3 hide">Hide properties</span>
5
+ <span class="mr-3 show">Show fields</span>
6
+ <span class="mr-3 hide">Hide fields</span>
7
7
  </button>
8
8
  <div class="accordion-body p-0" id="exp-1">
9
9
  {{ content }}
data/_includes/tabs.html CHANGED
@@ -1,10 +1,10 @@
1
1
  <div class="tabs" id="tabs-showcase-example">
2
2
  <ul>
3
3
  <li class="full-checkout">
4
- <a id="full-checkout">Full Checkout</a>
4
+ <a href="#full-checkout" id="full-checkout">Full Checkout</a>
5
5
  </li>
6
6
  <li class="payments-only">
7
- <a id="payments-only">Payments Only</a>
7
+ <a href="#payments-only" id="payments-only">Payments Only</a>
8
8
  </li>
9
9
  </ul>
10
10
  </div>
@@ -1,7 +1,6 @@
1
1
  {% assign lead_title = page.lead_title %}
2
2
  {% assign main_title = page.main_title | default: page.title %}
3
3
  {% assign description = page.description %}
4
- {% assign estimated_read = page.estimated_read %}
5
4
  {% assign checkout_v3 = page.checkout_v3 %}
6
5
  {% capture max_width_class %}
7
6
  {% if page.card_overview %}
@@ -23,7 +22,8 @@
23
22
 
24
23
  <h1>{{ main_title }}</h1>
25
24
 
26
- {% if estimated_read %}
25
+ {% assign estimated_read = page.content | read_time | plus: 0 %}
26
+ {% if estimated_read > 0 %}
27
27
  <div class="title-header-estimated-read">
28
28
  <i class="material-icons">schedule</i>
29
29
  {{ estimated_read }} min read
@@ -60,17 +60,15 @@
60
60
  <div id="designguide">
61
61
  <div class="documentation">
62
62
  <div class="row">
63
- <div class="col-xxl-2 col-lg-3 pr-0">
64
- <div class="sidebar dg-sidebar">
65
- <nav class="sidebar-nav">
66
- <a href="/" class="sidebar-header">
67
- <img src="{{ design_guide_url }}/designguide/assets/swedbankpay-logo-v.svg"
63
+ <div id="dg-sidebar" class="sidebar dg-sidebar has-secondary-nav">
64
+ <nav class="sidebar-main-nav">
65
+ <div class="sidebar-logo">
66
+ <a href="/" class="sidebar-header">
67
+ <img src="{{ design_guide_url }}/designguide/assets/swedbankpay-logo-v.svg"
68
68
  alt="Swedbank Pay vertical logo" class="logotype-vertical logotype-lg"/>
69
- <div class="sidebar-header-text">
70
- <span>{</span>developer portal<span>}</span>
71
- </div>
72
- </a>
73
- {% if site.search.enabled == true %}
69
+ </a>
70
+ </div>
71
+ <!-- {% if site.search.enabled == true %}
74
72
  <form class="search-container mx-2 my-4 px-3 py-2 d-flex"
75
73
  method="get" action="{{ site.search.url | relative_url }}">
76
74
  <input name="q" type="text" id="tipue_search_input"
@@ -84,14 +82,12 @@
84
82
  <i class="material-icons m-0" aria-hidden="true">search</i>
85
83
  </button>
86
84
  </form>
87
- {% endif %}
85
+ {% endif %} -->
88
86
  <ul id="dx-sidebar-main-nav-ul" class="main-nav-ul">
89
87
  </ul>
90
88
  </nav>
91
89
  </div>
92
- </div>
93
-
94
- <main class="doc-view col-xxl-10 col-lg-9">
90
+ <main class="doc-view">
95
91
  {% if page.layout != 'front-page' %}
96
92
  {% include title-header.html %}
97
93
  {% endif %}
@@ -8,6 +8,7 @@
8
8
 
9
9
  .show {
10
10
  display: block;
11
+ width: 52rem;
11
12
  }
12
13
 
13
14
  .hide {
@@ -23,13 +24,24 @@
23
24
 
24
25
  .hide {
25
26
  display: block;
27
+ width: 70vw;
26
28
  }
27
29
  }
28
30
 
29
31
  .accordion-header {
32
+ align-items: center;
33
+ background-color: $apricot;
34
+ border: 1px solid rgba(153, 153, 153, 0.5);
35
+ border-radius: 2px;
36
+ max-width: 80rem;
37
+ line-height: 2rem;
38
+ padding: unset;
39
+
30
40
  &:before {
31
- bottom: 1rem;
32
- margin: auto;
41
+ position: absolute;
42
+ top: 50%;
43
+ margin-right: 0.5rem;
44
+ bottom: 50%;
33
45
  transition: .3s;
34
46
  color: $brown;
35
47
  }
data/_sass/sidebar.scss CHANGED
@@ -1,104 +1,30 @@
1
- @import 'colors.scss';
2
-
3
- .sidebar {
4
- .sidebar-nav {
5
- .sidebar-header {
6
- display: flex;
7
- flex-direction: column;
8
- align-items: center;
9
- margin-top: 2rem;
10
- text-decoration: none;
11
- color: #512b2b;
12
-
13
- img {
14
- margin-top: 1.5rem;
15
- margin-bottom: 1.25rem;
16
- }
17
-
18
- span {
19
- color: #fdc129;
20
- }
21
-
22
- .sidebar-header-text {
23
- margin-top: -0.5rem;
24
- font-size: 1.125rem;
25
- line-height: 1.5rem;
26
- color: $black;
27
- font-family: "Akkurat Mono", monospace;
28
- white-space: nowrap;
29
- }
1
+ #dg-sidebar {
2
+ &.sidebar {
3
+ .nav-ul {
4
+ list-style: none;
5
+ overflow: hidden;
6
+ padding: 0;
7
+ top: auto;
8
+ position: relative;
9
+ transition: none;
30
10
  }
11
+ }
31
12
 
32
- .search-container {
33
- box-shadow: 1px 2px 10px rgba(0, 0, 0, 0.15);
34
- border-radius: 0.125rem;
35
-
36
- &:focus-within {
37
- outline: -webkit-focus-ring-color auto 0.5px;
38
- }
39
-
40
- .search-input {
41
- color: $medium-brown;
42
- font-size: 0.875rem;
43
- border: none;
44
- padding: 0.375rem;
45
-
46
- &:focus {
47
- color: $brown;
48
- outline: none
49
- }
50
- }
51
-
52
- i {
53
- display: block;
54
- color: $brown;
55
-
56
- &:hover {
57
- color: $turquoise-link;
13
+ .main-nav-ul {
14
+ a {
15
+ &.disabled {
16
+ ~nav {
17
+ display: none;
58
18
  }
59
19
  }
60
-
61
- button {
62
- background-color: $white;
63
- border: none;
64
- cursor: pointer;
65
- }
66
-
67
20
  }
68
21
 
69
- .main-nav-ul {
70
- .nav-group {
71
- .nav-ul {
72
- .nav-subgroup {
73
- &.active {
74
- >.nav-subgroup-heading {
75
- a {
76
- color: #257886;
77
- font-weight: 700;
78
- }
79
- }
80
- }
81
-
82
- .nav-subgroup-heading {
83
- padding: 0;
84
-
85
- i {
86
- padding: 0.5rem 0;
87
- }
88
-
89
- a {
90
- color: #512b2b;
91
- padding: .5rem;
92
- font-size: 1rem;
93
- line-height: 1.5rem;
94
- text-decoration: none;
95
- width: 100%;
96
-
97
- &:hover,
98
- &:focus {
99
- color: #257886;
100
- }
101
- }
22
+ .leaf {
23
+ &.active {
24
+ > a {
25
+ &:hover {
26
+ &:after {
27
+ content: none;
102
28
  }
103
29
  }
104
30
  }
data/lib/gem_version.rb CHANGED
@@ -4,7 +4,7 @@ module Gem
4
4
  # Gem Specification
5
5
  class Specification
6
6
  def self.gem_version
7
- '1.16.2'
7
+ '2.0.0'
8
8
  end
9
9
  end
10
10
  end
data/lib/read_time.rb ADDED
@@ -0,0 +1,35 @@
1
+ # Calculates reading time based on the formula used by Medium
2
+ # https://medium.com/the-story/read-time-and-you-bc2048ab620c
3
+
4
+ # Installation: drop this into your _plugins folder
5
+ # Usage: {{ page.content | read_time }}
6
+ # Note: this requires img tags to be in the form of <img ... />. If you're
7
+ # using this on a post listing page, make sure to markdownify the post content
8
+ # first.
9
+ module ReadTimeFilter
10
+ def read_time(input)
11
+ words_per_minute = 275
12
+ # number of seconds per image to start at, default is 12s
13
+ img_time_max = 12
14
+ # time per image will decrease by 1 for every image, to a minimum
15
+ # of this time, default is 3s
16
+ img_time_min = 3
17
+
18
+ strings = input.split(/<img.* \/>/)
19
+
20
+ seconds = (strings.join(" ").split.size.to_f / (words_per_minute / 60))
21
+
22
+ # number of images minus one for correct number of iterations
23
+ (strings.size - 2).times do |i|
24
+ t = (img_time_max - i)
25
+ image_time = t > img_time_min ? t : img_time_min
26
+ seconds = seconds + image_time
27
+ end
28
+
29
+ minutes = (seconds / 60).ceil
30
+
31
+ "#{minutes} min read"
32
+ end
33
+ end
34
+
35
+ Liquid::Template.register_filter(ReadTimeFilter)
@@ -47,26 +47,42 @@ module SwedbankPay
47
47
  level = is_leaf ? -1 : page.level
48
48
  title_markup = title_markup(page, level, is_leaf)
49
49
  item_class = item_class(page, current_page, level, is_leaf)
50
- group_heading_class = group_heading_class(level)
51
-
50
+ root_class = root_class(page, current_page)
51
+ level.zero? &&
52
+ page.doc.xpath('//*[@id="dg-sidebar"]').first.set_attribute('class', root_class)
52
53
  "<li class=\"#{item_class}\">
53
- <div class=\"#{group_heading_class}\">
54
- <i class=\"material-icons\">arrow_right</i>
55
54
  #{title_markup}
56
- </div>
57
- #{sub_items_markup}
58
- </li>"
55
+ #{item_class === 'main-nav-li' || item_class === 'main-nav-li active' ? "<nav class=\"sidebar-secondary-nav\">
56
+ <header class=\"secondary-nav-header\">#{page.title.section || page.title}</header>
57
+ #{sub_items_markup}
58
+ </nav>" : sub_items_markup}
59
+ </li>"
60
+ end
61
+
62
+ def root_class(page, current_page)
63
+ active = page.active?(current_page)
64
+ active && current_page.path != '/' ? 'sidebar dg-sidebar has-secondary-nav' : 'sidebar dg-sidebar'
59
65
  end
60
66
 
61
67
  def item_class(page, current_page, level, is_leaf)
62
68
  active = page.active?(current_page, is_leaf: is_leaf)
63
69
  item_class = group_class(level)
70
+ if item_class != 'main-nav-li'
71
+ item_class += page.children.empty? ? ' group' : ' leaf'
72
+ end
73
+
64
74
  item_class += ' active' if active
65
75
  item_class
66
76
  end
67
77
 
68
78
  def group_class(level)
69
- level.zero? ? 'nav-group' : 'nav-subgroup'
79
+ if level.zero?
80
+ 'main-nav-li'
81
+ elsif level == 1
82
+ 'secondary-nav-li'
83
+ else
84
+ ''
85
+ end
70
86
  end
71
87
 
72
88
  def group_heading_class(level)
@@ -76,29 +92,35 @@ module SwedbankPay
76
92
 
77
93
  def title_markup(page, level, is_leaf)
78
94
  lead_title = lead_title(page)
79
- return "<span>#{lead_title}</span>" if level.zero?
95
+ return "<a href=\"#{page.path}\"><i class=\"material-icons-outlined\" aria-hidden=\"true\">#{page.icon}</i>#{lead_title}</a>" if level.zero? && lead_title != 'Home'
96
+ return "<a href=\"#{page.path}\">#{page.section || page.title}</a>" if lead_title != 'Home'
80
97
 
81
98
  main_title = main_title(page, is_leaf)
82
-
83
- "<a href=\"#{page.path}\">#{main_title}</a>"
99
+ home = main_title == 'Home' ? 'disabled' : ''
100
+ "<a class=\"#{home}\" href=\"#{page.path}\"><i class=\"material-icons-outlined\" aria-hidden=\"true\">#{page.icon}</i>#{main_title}</a>"
84
101
  end
85
102
 
86
103
  def sub_items_markup(page, current_page)
87
104
  headers_markup = headers_markup(page, current_page)
88
105
  child_markup = build_markup(page.children, current_page)
89
-
90
106
  return '' if headers_markup.empty? && child_markup.empty?
91
107
 
92
- "<ul class=\"nav-ul\">
93
- #{headers_markup}
94
- #{child_markup}
108
+ "<ul class=\"#{page.level.zero? ? 'secondary-nav-ul' : ''}\">
109
+ #{if page.level.positive? && page.children?
110
+ "<a href=\"#\" class=\"previous-nav\">
111
+ <i class=\"material-icons\" aria-hidden=\"true\">arrow_back_ios</i>
112
+ <span>Back to #{page.parent.title}</span>
113
+ </a>
114
+ <header>#{page.title.section || page.title}</header>"
115
+ end}
116
+ #{headers_markup}
117
+ #{child_markup}
95
118
  </ul>"
96
119
  end
97
120
 
98
121
  def headers_markup(page, current_page)
99
122
  # If there's no page headers, only return a leaf item for the page itself.
100
- main_title = page.title.nil? ? nil : page.title.main
101
- return leaf_markup(page.path, main_title, page.level) unless page.headers?
123
+ return '' unless page.headers?
102
124
 
103
125
  # If there's no children, only return the headers as leaf node items.
104
126
  return page.headers.map { |h| header_markup(page, h) }.join unless page.children?
@@ -117,7 +139,7 @@ module SwedbankPay
117
139
  end
118
140
 
119
141
  def leaf_markup(href, title, level = 0)
120
- leaf_class = level.positive? ? 'nav-leaf nav-subgroup-leaf' : 'nav-leaf'
142
+ leaf_class = level.positive? ? 'leaf' : 'nav-leaf'
121
143
  "<li class=\"#{leaf_class}\"><a href=\"#{href}\">#{title}</a></li>"
122
144
  end
123
145
 
data/lib/sidebar_page.rb CHANGED
@@ -13,7 +13,7 @@ module SwedbankPay
13
13
  class SidebarPage
14
14
  FIXNUM_MAX = ((2**((0.size * 8) - 2)) - 1)
15
15
 
16
- attr_reader :path, :title, :level, :order, :children, :name, :filename, :doc
16
+ attr_reader :path, :title, :level, :order, :children, :name, :filename, :doc, :section, :icon
17
17
  attr_accessor :headers, :sidebar_container, :number, :parent
18
18
 
19
19
  def initialize(jekyll_page)
@@ -26,10 +26,11 @@ module SwedbankPay
26
26
  @path = sidebar_path.to_s
27
27
  @parent = sidebar_path.parent
28
28
  @level = sidebar_path.level
29
- @name = sidebar_path.name
30
29
  @hide_from_sidebar = jekyll_page['hide_from_sidebar'].nil? ? false : jekyll_page['hide_from_sidebar']
31
30
  @title = SidebarPageTitle.parse(jekyll_page, self)
32
31
  @order = menu_order(jekyll_page)
32
+ @section = jekyll_page['section']
33
+ @icon = jekyll_page['sidebar_icon']
33
34
  @children = SidebarPageCollection.new(self)
34
35
  @card_overview = jekyll_page['card_overview'].nil? ? false : jekyll_page['card_overview']
35
36
  @anchor_headings = jekyll_page['anchor_headings'].nil? ? true : jekyll_page['anchor_headings']
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative 'sidebar'
4
+ require_relative 'read_time'
4
5
  require_relative 'regex_capture_filter'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: swedbank-pay-design-guide-jekyll-theme
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.16.2
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Swedbank Pay
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-10-14 00:00:00.000000000 Z
11
+ date: 2023-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -143,9 +143,6 @@ dependencies:
143
143
  requirement: !ruby/object:Gem::Requirement
144
144
  requirements:
145
145
  - - "~>"
146
- - !ruby/object:Gem::Version
147
- version: '1'
148
- - - ">="
149
146
  - !ruby/object:Gem::Version
150
147
  version: '1.11'
151
148
  type: :runtime
@@ -153,9 +150,6 @@ dependencies:
153
150
  version_requirements: !ruby/object:Gem::Requirement
154
151
  requirements:
155
152
  - - "~>"
156
- - !ruby/object:Gem::Version
157
- version: '1'
158
- - - ">="
159
153
  - !ruby/object:Gem::Version
160
154
  version: '1.11'
161
155
  - !ruby/object:Gem::Dependency
@@ -443,6 +437,7 @@ files:
443
437
  - assets/tipuesearch/tipuesearch_content.js
444
438
  - assets/tipuesearch/tipuesearch_set.js
445
439
  - lib/gem_version.rb
440
+ - lib/read_time.rb
446
441
  - lib/regex_capture_filter.rb
447
442
  - lib/safe_merge.rb
448
443
  - lib/sanitized_filename.rb