kanso 0.1.0 → 0.1.1
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 +4 -4
- data/README.md +12 -16
- data/app/components/kanso/notification_component.rb +9 -1
- data/lib/kanso/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: ac0633c240427e760e914ae8b29b2d8baf7ca67dbf94384e3116d014b425cacf
|
|
4
|
+
data.tar.gz: c8507a11acae941aee9513fa268b484c45361691a7f355a5bcb76a3a69669d29
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9ea4f5edf76ec98d6057f5afc2baed09063f45acbdd662e79f8a3613b0e004c12f156793f4501727394e6d333340809602f544d67df5b9b4264efb4110090cd4
|
|
7
|
+
data.tar.gz: 3d9798e11dc266d680dbc006fe7a09c09891abfe09fbdcc4add591bba41537607eed39f63ccd358787add74051f1811b06e330702c3095edee6a309fdd3e1c2c
|
data/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src=".github/assets/kansobanner.jpg" alt="Kanso Minimalist Banner" width="100%">
|
|
3
|
+
</p>
|
|
4
4
|
|
|
5
|
-
Kanso (簡素)
|
|
5
|
+
# Kanso (簡素)
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Kanso (簡素) is a Japanese design principle valuing clarity and the elimination of the non-essential. This UI component library is the embodiment of that idea: providing foundational, rigorously tested ViewComponents that act as respectful guests in your Rails application.
|
|
8
8
|
|
|
9
9
|
## Prerequisites
|
|
10
10
|
|
|
@@ -91,7 +91,7 @@ Renders a performant, inline SVG icon from the Kanso library.
|
|
|
91
91
|
|
|
92
92
|
**Available Icons:**
|
|
93
93
|
|
|
94
|
-
A complete list of all available icons can be found in the source code
|
|
94
|
+
A complete list of all available icons can be found in the source code: **[View all available icons](https://github.com/santonero/kanso/tree/main/app/assets/images/kanso/icons)**.
|
|
95
95
|
|
|
96
96
|
---
|
|
97
97
|
|
|
@@ -108,7 +108,8 @@ Renders a dismissible notification panel.
|
|
|
108
108
|
**Options:**
|
|
109
109
|
* `message:` (`String`, **required**): The notification's content.
|
|
110
110
|
* `title:` (`String`, optional): An optional title.
|
|
111
|
-
* `theme:` (`Symbol`): The style. Can be `:success`, `:error`, `:warning`, or `:info`. Defaults to `:info
|
|
111
|
+
* `theme:` (`Symbol`): The style. Can be `:success`, `:error`, `:warning`, or `:info`. Defaults to `:info`.<br>
|
|
112
|
+
*(Note: For seamless Rails integration, standard flash keys :notice and :alert are automatically mapped to :success and :error respectively).*
|
|
112
113
|
|
|
113
114
|
**Implementation Patterns:**
|
|
114
115
|
|
|
@@ -126,7 +127,7 @@ A notification is most effective when rendered dynamically into a fixed containe
|
|
|
126
127
|
|
|
127
128
|
*In a controller:*
|
|
128
129
|
```ruby
|
|
129
|
-
redirect_to @post, flash: { success: "Post was successfully
|
|
130
|
+
redirect_to @post, flash: { success: "Post was updated successfully." }
|
|
130
131
|
```
|
|
131
132
|
*In your layout (inside the container):*
|
|
132
133
|
```erb
|
|
@@ -230,22 +231,17 @@ Turbo.StreamActions.redirect = function() {
|
|
|
230
231
|
}
|
|
231
232
|
```
|
|
232
233
|
|
|
233
|
-
*Next, in your controller,
|
|
234
|
+
*Next, in your controller, respond to the `turbo_stream` format and set the flash:*
|
|
234
235
|
```ruby
|
|
235
236
|
# app/controllers/products_controller.rb
|
|
236
237
|
def create
|
|
237
238
|
@product = Product.new(product_params)
|
|
238
239
|
if @product.save
|
|
239
|
-
# Set the flash message that Turbo Drive will render on the next page.
|
|
240
|
-
flash[:success] = "Product was successfully created."
|
|
241
|
-
|
|
242
240
|
respond_to do |format|
|
|
243
|
-
format.turbo_stream
|
|
244
|
-
format.html { redirect_to @product, flash: { success: "Product was successfully created." } }
|
|
241
|
+
format.turbo_stream { flash[:success] = "Product was created successfully." }
|
|
245
242
|
end
|
|
246
243
|
else
|
|
247
|
-
|
|
248
|
-
render :new, status: :unprocessable_entity
|
|
244
|
+
render :new, status: :unprocessable_content
|
|
249
245
|
end
|
|
250
246
|
end
|
|
251
247
|
```
|
|
@@ -47,12 +47,20 @@ module Kanso
|
|
|
47
47
|
)
|
|
48
48
|
}.freeze
|
|
49
49
|
|
|
50
|
+
RAILS_FLASH_ALIASES = {
|
|
51
|
+
notice: :success,
|
|
52
|
+
alert: :error
|
|
53
|
+
}.freeze
|
|
54
|
+
|
|
50
55
|
attr_reader :title, :message, :theme_data
|
|
51
56
|
|
|
52
57
|
def initialize(message:, title: nil, theme: :info)
|
|
53
58
|
@title = title
|
|
54
59
|
@message = message
|
|
55
|
-
|
|
60
|
+
|
|
61
|
+
theme_sym = theme.to_sym
|
|
62
|
+
mapped_theme = RAILS_FLASH_ALIASES[theme_sym] || theme_sym
|
|
63
|
+
@theme_data = THEMES[mapped_theme] || THEMES[:info]
|
|
56
64
|
end
|
|
57
65
|
end
|
|
58
66
|
end
|
data/lib/kanso/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: kanso
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- santonero
|
|
@@ -186,7 +186,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
186
186
|
- !ruby/object:Gem::Version
|
|
187
187
|
version: '0'
|
|
188
188
|
requirements: []
|
|
189
|
-
rubygems_version: 4.0.
|
|
189
|
+
rubygems_version: 4.0.15
|
|
190
190
|
specification_version: 4
|
|
191
191
|
summary: An elemental UI component library for Rails, guided by the principle of simplicity.
|
|
192
192
|
test_files: []
|