nfg_ui 0.9.9 → 0.9.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -2
- data/app/assets/stylesheets/nfg_ui/network_for_good/public/nfg_theme/_event.scss +8 -3
- data/app/assets/stylesheets/nfg_ui/network_for_good/public/nfg_theme/custom/_everyday_story.scss +0 -1
- data/lib/nfg_ui/components/foundations/icon.rb +52 -19
- data/lib/nfg_ui/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 91d2b591a3156c120e2d634e0a1f70bf85989f94cefd242565445297794a10e8
|
4
|
+
data.tar.gz: afc72e98c8e3379e3d7dd93b602848bcb043848b82dd79f30edc1ec417d06ce4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8549a0db880057b3e9e44be1ac6a0f5a8d20ed3f390025a281c26b5d5b0e697a380653f8db0b5e2cebaa0e752ed460ec70a83823d6f45afca9d291d18ce2bbab
|
7
|
+
data.tar.gz: 8b2f43543f01d2ba9a36ce9ccfe04a30d6d203352e2835943856ed034bfeb89ce71e55ac0b8f660b5d4ed9ea2bc23189d9a4ee720f7bc2b26bae17dbe839c7a1
|
data/README.md
CHANGED
@@ -6,7 +6,7 @@ Note: the readme documentation is a little out of date and will be updated with
|
|
6
6
|
[Jump to development / setting up the gem locally](https://github.com/network-for-good/nfg_ui/blob/master/README.md#local-development--accessing-documentation)
|
7
7
|
|
8
8
|
```ruby
|
9
|
-
gem 'nfg_ui'
|
9
|
+
gem 'nfg_ui'
|
10
10
|
```
|
11
11
|
|
12
12
|
NFG UX & UI team_ (J&K) are excited to bring you... the *Network For Good design system* gem or: `nfg_ui` gem. This bad boy is an all encompassing one-stop shop for everything front-end for Network for Good products.
|
@@ -22,7 +22,7 @@ To review the documentation for the components, get code samples and browse the
|
|
22
22
|
|
23
23
|
### Include the gem in your Gemfile
|
24
24
|
```ruby
|
25
|
-
gem 'nfg_ui'
|
25
|
+
gem 'nfg_ui'
|
26
26
|
```
|
27
27
|
|
28
28
|
### Import & Require the gem's assets
|
@@ -358,6 +358,8 @@ $ Collapsible? (Y/n):
|
|
358
358
|
|
359
359
|
31. _Add a generator to supply the bootstrap shared examples for spec writing your own components._
|
360
360
|
|
361
|
+
32. Need to integrate will_paginate rendering into the nfg_ui gem.
|
362
|
+
|
361
363
|
Component tooltip/icon auto list for backup
|
362
364
|
FOUNDATION_COMPONENT_NAMES = %i[color
|
363
365
|
icon
|
@@ -2,8 +2,7 @@
|
|
2
2
|
.event {
|
3
3
|
.jumbotron {
|
4
4
|
height: auto;
|
5
|
-
|
6
|
-
background-repeat:no-repeat;
|
5
|
+
background-repeat: no-repeat;
|
7
6
|
background-size: cover;
|
8
7
|
&:before {
|
9
8
|
position: absolute;
|
@@ -12,8 +11,14 @@
|
|
12
11
|
bottom: 0;
|
13
12
|
left: 0;
|
14
13
|
z-index: 0;
|
15
|
-
background-color: transparentize(
|
14
|
+
background-color: transparentize($black, 0.7);
|
16
15
|
content: '';
|
17
16
|
}
|
17
|
+
@include media-breakpoint-down(md) {
|
18
|
+
background-image: none !important;
|
19
|
+
&:before { display: none; }
|
20
|
+
.card { box-shadow: none; }
|
21
|
+
.card-body { padding: 0; }
|
22
|
+
}
|
18
23
|
}
|
19
24
|
}
|
@@ -23,41 +23,80 @@ module NfgUi
|
|
23
23
|
LEFT_ICON_SPACER_CSS_CLASS = 'mr-1'
|
24
24
|
RIGHT_ICON_SPACER_CSS_CLASS = 'ml-1'
|
25
25
|
|
26
|
+
# Utilize a trait or `:icon` within options.
|
27
|
+
# When setting the icon as a trait, you must pass in a string.
|
28
|
+
# If a symbol is detected, the component assumes it's a registered trait
|
29
|
+
#
|
30
|
+
# Example usage as a trait:
|
31
|
+
# = ui.nfg :icon, 'heart'
|
32
|
+
#
|
33
|
+
# Example usage as an option:
|
34
|
+
# = ui.nfg :icon, icon: 'heart'
|
35
|
+
#
|
36
|
+
# This is useful in syncing up the ability to pass in `:icon` to
|
37
|
+
# components that accept `:icon` in options and automatically render an icon.
|
38
|
+
def icon
|
39
|
+
options[:icon] || (traits.slice!(0).to_s if traits.first.is_a?(String))
|
40
|
+
end
|
41
|
+
|
42
|
+
# Outputs a Font Awesome icon using the #fa_icon method.
|
26
43
|
def render
|
27
44
|
view_context.fa_icon icon, **html_options, text: text, right: right
|
28
45
|
end
|
29
46
|
|
30
|
-
|
31
|
-
|
47
|
+
# Tap into the font_awesome_rails :right method to
|
48
|
+
# place the icon on the right side of the text.
|
49
|
+
# This also automatically adds the right side css spacer class to the icon <i> tag.
|
50
|
+
def right
|
51
|
+
options.fetch(:right, false)
|
32
52
|
end
|
33
53
|
|
54
|
+
# Tap into the font_awesome_rails :text method to
|
55
|
+
# insert text into the rendered component.
|
34
56
|
def text
|
35
57
|
options.fetch(:text, nil)
|
36
58
|
end
|
37
59
|
|
38
|
-
|
39
|
-
|
60
|
+
private
|
61
|
+
|
62
|
+
# Adds the left css spacer class when :right is false
|
63
|
+
# and when text is present
|
64
|
+
def add_left_icon_css_spacer_class?
|
65
|
+
!right && text.present?
|
40
66
|
end
|
41
67
|
|
42
|
-
|
68
|
+
# Adds the left css spacer class when :right is true
|
69
|
+
# and when text is present
|
70
|
+
def add_right_icon_css_spacer_class?
|
71
|
+
right && text.present?
|
72
|
+
end
|
73
|
+
|
74
|
+
def assistive_html_attributes
|
75
|
+
super.merge(aria: { hidden: true })
|
76
|
+
end
|
77
|
+
|
78
|
+
# Override the auto generated css class
|
79
|
+
def component_css_class
|
80
|
+
''
|
81
|
+
end
|
43
82
|
|
83
|
+
# Icons utilize "spacer" css classes to manually provide margins
|
84
|
+
# between the icon and the text.
|
44
85
|
def css_classes
|
45
|
-
return super unless update_css_classes?
|
46
86
|
[
|
47
87
|
super,
|
48
|
-
(NfgUi::Components::Foundations::Icon::LEFT_ICON_SPACER_CSS_CLASS
|
49
|
-
(NfgUi::Components::Foundations::Icon::RIGHT_ICON_SPACER_CSS_CLASS if
|
88
|
+
(NfgUi::Components::Foundations::Icon::LEFT_ICON_SPACER_CSS_CLASS if add_left_icon_css_spacer_class?),
|
89
|
+
(NfgUi::Components::Foundations::Icon::RIGHT_ICON_SPACER_CSS_CLASS if add_right_icon_css_spacer_class?)
|
50
90
|
].join(' ').squish
|
51
91
|
end
|
52
92
|
|
93
|
+
# Icons utilize text styling for css theming.
|
53
94
|
def theme_css_class_prefix
|
54
95
|
'text-'
|
55
96
|
end
|
56
97
|
|
57
|
-
|
58
|
-
|
59
|
-
end
|
60
|
-
|
98
|
+
# Icons should be body text color by default and should not
|
99
|
+
# have a theme set by default.
|
61
100
|
def default_theme
|
62
101
|
nil
|
63
102
|
end
|
@@ -66,16 +105,10 @@ module NfgUi
|
|
66
105
|
super.push(:right, :text, :icon)
|
67
106
|
end
|
68
107
|
|
108
|
+
# Icons are not thematically outlineable
|
69
109
|
def outlineable?
|
70
110
|
false
|
71
111
|
end
|
72
|
-
|
73
|
-
# Several components need to utilize the icon with a spacer css class
|
74
|
-
# where text is supplied in the #render, and not passed to the icon
|
75
|
-
# thus, icons with :right trait are allowed through
|
76
|
-
def update_css_classes?
|
77
|
-
text || right
|
78
|
-
end
|
79
112
|
end
|
80
113
|
end
|
81
114
|
end
|
data/lib/nfg_ui/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nfg_ui
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan Roehm
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2019-06-
|
12
|
+
date: 2019-06-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bootstrap
|