railwind 0.1.22 → 0.1.23
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/lib/railwind/generators/callout_generator.rb +12 -0
- 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 +1 -1
- metadata +4 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: db5ccd80f2a24cec982ac3275e008927303e0e2b36c3cda6bc196ff59605b3de
|
4
|
+
data.tar.gz: 831847785839c6944f4ac0cf1f3f56a0d7e94552b6455defbfcc67c455e13cc7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b0884e3517c1c2f0660d6eb6687de37206b8febe2a1af957a22e11fc5e19593c5db0a473240e605facba16c1bee76f30ba504a4a4c440a6ae61c60bc26cd84f
|
7
|
+
data.tar.gz: c2cb347554d3e7c684c0be6caff7e8b555a8285ffa9d4c0c2d9bb3f4e98073a7c0e60f3f1072fecb33bc4ea8071d493ea229f11ce16a64309909d95146c61507
|
@@ -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,9 @@
|
|
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
8
|
|
9
9
|
module Railwind
|
10
10
|
class Error < StandardError; end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.23
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christian Bryant
|
@@ -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
|