railwind 0.1.22 → 0.1.24
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/railwind/generators/button_generator.rb +3 -1
- data/lib/railwind/generators/callout_generator.rb +12 -0
- data/lib/railwind/generators/templates/button/_button_component.html.erb +1 -1
- data/lib/railwind/generators/templates/callout/_callout_component.html.erb +22 -0
- data/lib/railwind/generators/templates/callout/callout_component.rb +21 -0
- data/lib/railwind/version.rb +1 -1
- data/lib/railwind.rb +2 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 68bd072f892742af3a7e2313012e976533bd3d73fc64a84705369bb1c2290a80
|
4
|
+
data.tar.gz: 00a5509d85e52917a851be910c1df081583274cf35537120f610a6c8be6a90c0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f85b2bf9b9ce851bba143c60377e017088a7eec6ebda1d41c92c566fafd9a2513adb42ecc2b83561b94a53048e911a0f9d3a3dce504785d7b30239773d6927f1
|
7
|
+
data.tar.gz: 933d488b41a43b06bfe53f79138b0c4f2c48c0d62a1b8d627152eed38368637af613952e5b4c26e162d8801fe8108dc4ad51d00e05a8ca27a24c8be9472ba805
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
|
3
|
+
module Railwind
|
4
|
+
class CalloutGenerator < Rails::Generators::Base
|
5
|
+
source_root File.expand_path('templates', __dir__)
|
6
|
+
|
7
|
+
def create_component_file
|
8
|
+
copy_file "callout/callout_component.rb", "app/components/callout_component.rb"
|
9
|
+
copy_file "callout/_callout_component.html.erb", "app/components/callout_component.html.erb"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<% base_classes = "border border border-2 rounded-lg p-4 w-full"
|
2
|
+
|
3
|
+
variant_classes =
|
4
|
+
case @variant
|
5
|
+
when "success"
|
6
|
+
"bg-green-100 border-green-500 text-green-700"
|
7
|
+
when "warning"
|
8
|
+
"bg-yellow-100 border-yellow-500 text-yellow-700"
|
9
|
+
when "danger"
|
10
|
+
"bg-red-100 border-red-500 text-red-700"
|
11
|
+
else
|
12
|
+
"bg-blue-100 border-blue-500 text-blue-700"
|
13
|
+
end
|
14
|
+
|
15
|
+
tailwind_classes = "#{base_classes} #{variant_classes}" %>
|
16
|
+
|
17
|
+
<div role="alert" class="<%= tailwind_classes %>">
|
18
|
+
|
19
|
+
<h3 class="font-semibold text-lg"><%= @title %></h3>
|
20
|
+
<p><%= @description %></p>
|
21
|
+
|
22
|
+
</div>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class CalloutComponent < ViewComponent::Base
|
4
|
+
|
5
|
+
VALID_VARIANTS = ['success', 'info', 'warning', 'danger'].freeze
|
6
|
+
|
7
|
+
def initialize(title:, description:, variant:)
|
8
|
+
@title = title
|
9
|
+
@description = description
|
10
|
+
@variant = validate_variant(variant)
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def validate_variant(variant)
|
16
|
+
raise ArgumentError, "Invalid variant" unless VALID_VARIANTS.include?(variant)
|
17
|
+
variant
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
data/lib/railwind/version.rb
CHANGED
data/lib/railwind.rb
CHANGED
@@ -2,9 +2,10 @@
|
|
2
2
|
|
3
3
|
require_relative "railwind/version"
|
4
4
|
require_relative "railwind/generators/button_generator"
|
5
|
-
require_relative "railwind/generators/callout_generator"
|
6
5
|
require_relative "railwind/generators/card_generator"
|
7
6
|
require_relative "railwind/generators/tab_generator"
|
7
|
+
require_relative "railwind/generators/callout_generator"
|
8
|
+
require_relative "railwind/generators/progress_generator"
|
8
9
|
|
9
10
|
module Railwind
|
10
11
|
class Error < StandardError; end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: railwind
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.24
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christian Bryant
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-11-
|
11
|
+
date: 2023-11-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -55,10 +55,13 @@ files:
|
|
55
55
|
- Rakefile
|
56
56
|
- lib/railwind.rb
|
57
57
|
- lib/railwind/generators/button_generator.rb
|
58
|
+
- lib/railwind/generators/callout_generator.rb
|
58
59
|
- lib/railwind/generators/card_generator.rb
|
59
60
|
- lib/railwind/generators/tab_generator.rb
|
60
61
|
- lib/railwind/generators/templates/button/_button_component.html.erb
|
61
62
|
- lib/railwind/generators/templates/button/button_component.rb
|
63
|
+
- lib/railwind/generators/templates/callout/_callout_component.html.erb
|
64
|
+
- lib/railwind/generators/templates/callout/callout_component.rb
|
62
65
|
- lib/railwind/generators/templates/card/_card_component.html.erb
|
63
66
|
- lib/railwind/generators/templates/card/card_component.rb
|
64
67
|
- lib/railwind/generators/templates/tabs/_tab_component.html.erb
|