railwind 0.1.22 → 0.1.23

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f6cf837cdb5f28533bc63a94cb9f7514b5a823783dcdc34f94e55584dbe3d110
4
- data.tar.gz: 90cc46565b4091fd9172fb367c690a7aecbc56dac3e283297e90f4544d2aa888
3
+ metadata.gz: db5ccd80f2a24cec982ac3275e008927303e0e2b36c3cda6bc196ff59605b3de
4
+ data.tar.gz: 831847785839c6944f4ac0cf1f3f56a0d7e94552b6455defbfcc67c455e13cc7
5
5
  SHA512:
6
- metadata.gz: 42e5379eac7632028eab000f4719ca841654cefa8e909aabd42d248f59a0e77339dcac551a69386db838e52a3bc862e1126403e01aba18f150f2e68f61e0b59b
7
- data.tar.gz: 22b23867c36cbcc4d7a1fb3afa6799674aceb4f9977716063e5003e9fc9b107f62d0a2a7c96d6ff6fd14696d32288a9f794aea5df64501b8cef4dc0131b695e7
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
+
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Railwind
4
- VERSION = "0.1.22"
4
+ VERSION = "0.1.23"
5
5
  end
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.22
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