rails_app_generator 0.3.4 → 0.3.5

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: ef1f0bf022c581955784c2ecc4d00b04f540e0a8b9f58b18ab2d17276bb239df
4
- data.tar.gz: 85813cddac2bf9605a60cf023f72d2cf98b373696d1831b09ae721b3e47dd9e4
3
+ metadata.gz: 8163ec9479b6d60bf7d1f73d82d0a5d155553bd166544ff80feb1c245e1ce855
4
+ data.tar.gz: 2d45e9e75b0bb8ef09f05f7accf8c38bbb57a7d1b93c6fe681c3b4e38dbfed08
5
5
  SHA512:
6
- metadata.gz: 89d2992e46e616679ff1e8f9647a2af229d47f44b87a6290f25d225c219a77a421d3185d0269a69b65c282404432a6dd0b09e733be3a797cfbde591809cb3b44
7
- data.tar.gz: 115d98ec35bc7819a9c87b6fe886a85d016df1abefd5baa1b0876c053b9f9ced2fb0716152df7171322b4797b22497a614ae38d53577f45834d4c95e27e598fc
6
+ metadata.gz: d32f8265a920592a8c13d4130dce8f44befb2af711ebe7b3887642164c75eceb1c580654c895b555397cf9764fdc35f21bae7cb643c704778c4e1ee475155e40
7
+ data.tar.gz: 86e6a79242935878f8887dabd985ad825668fbadc5da49631e116d771d70313d1b0f8f33b36cb95d1c165c0d1afd26d1f0652f19ab2912a778571116de927b78
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [0.3.4](https://github.com/klueless-io/rails_app_generator/compare/v0.3.3...v0.3.4) (2022-10-06)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * update view_component profile ([218126a](https://github.com/klueless-io/rails_app_generator/commit/218126af5df49d1c2b4b05ad99ee8e8c97ee6fb1))
7
+
1
8
  ## [0.3.3](https://github.com/klueless-io/rails_app_generator/compare/v0.3.2...v0.3.3) (2022-10-05)
2
9
 
3
10
 
@@ -1,4 +1,4 @@
1
- <div class="divide-y divide-gray-200 rounded-lg border border-gray-200 shadow-sm">
1
+ <div class="<%= card_class %>">
2
2
  <div class="p-6">
3
3
  <h2 class="text-lg font-medium leading-6 text-gray-900"><%= card.heading %></h2>
4
4
  <p class="mt-4 text-sm text-gray-500"><%= card.description %></p>
@@ -11,9 +11,8 @@
11
11
  <div class="px-6 pt-6 pb-8">
12
12
  <h3 class="text-sm font-medium text-gray-900">What's included</h3>
13
13
  <ul role="list" class="mt-6 space-y-4">
14
- <%# Loop through items %>
15
14
  <% card.items.each do |item| %>
16
- <li class="flex space-x-3">
15
+ <li class="<flex space-x-3>">
17
16
  <svg class="h-5 w-5 flex-shrink-0 text-green-500" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
18
17
  <path fill-rule="evenodd" d="M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z" clip-rule="evenodd" />
19
18
  </svg>
@@ -5,4 +5,9 @@ class PriceCardComponent < ViewComponent::Base
5
5
  @card = card
6
6
  super
7
7
  end
8
+
9
+ def card_class
10
+ highlight = card.highlight == true ? 'border-7 border-red-500' : 'border-gray-200'
11
+ "divide-y divide-gray-200 rounded-lg border border-7 shadow-sm#{highlight}"
12
+ end
8
13
  end
@@ -1,4 +1,9 @@
1
1
  class PriceChartComponent < ViewComponent::Base
2
+
3
+ CARDS_TWO = 'mt-12 space-y-4 sm:mt-16 sm:grid sm:grid-cols-1 sm:gap-6 sm:space-y-0 lg:mx-auto lg:max-w-4xl lg:max-w-none lg:grid-cols-2'
4
+ CARDS_ODD = 'mt-12 space-y-4 sm:mt-16 sm:grid sm:grid-cols-1 sm:gap-6 sm:space-y-0 lg:mx-auto lg:max-w-4xl lg:max-w-none lg:grid-cols-3 xl:mx-0 xl:max-w-none xl:grid-cols-3'
5
+ CARDS_EVEN = 'mt-12 space-y-4 sm:mt-16 sm:grid sm:grid-cols-1 sm:gap-6 sm:space-y-0 lg:mx-auto lg:max-w-4xl lg:max-w-none lg:grid-cols-2 xl:mx-0 xl:max-w-none xl:grid-cols-4'
6
+
2
7
  def initialize(chart)
3
8
  @chart = chart
4
9
 
@@ -7,7 +12,9 @@ class PriceChartComponent < ViewComponent::Base
7
12
  end
8
13
 
9
14
  def card_list_class
10
- @chart.cards.length.odd? ? 'mt-12 space-y-4 sm:mt-16 sm:grid sm:grid-cols-3 sm:gap-6 sm:space-y-0 lg:mx-auto lg:max-w-4xl xl:mx-0 xl:max-w-none lg:grid-cols-3'
11
- : 'mt-12 space-y-4 sm:mt-16 sm:grid sm:grid-cols-2 sm:gap-6 sm:space-y-0 lg:mx-auto lg:max-w-4xl xl:mx-0 xl:max-w-none xl:grid-cols-4'
15
+ return CARDS_TWO if @chart.cards.length == 2
16
+ return CARDS_ODD if @chart.cards.length.odd?
17
+
18
+ CARDS_EVEN
12
19
  end
13
20
  end
@@ -4,17 +4,22 @@ class HomeController < ApplicationController
4
4
 
5
5
  def component
6
6
  @pricing_data1 = pricing_data_poro
7
- @pricing_data1.title = nil
7
+ @pricing_data1.title = nil # let the component set a default title
8
8
 
9
- @pricing_data2 = pricing_data_poro
10
- @pricing_data2.cards.pop() # should change to a three column layout
9
+ @pricing_data2 = pricing_data_poro(3)
10
+ @pricing_data2.cards[1].highlight = true # highlight the second card
11
+
12
+ @pricing_data3 = pricing_data_poro(2)
13
+ @pricing_data3.title = 'Only 2 Plans'
11
14
  end
12
15
 
13
16
  private
14
17
 
15
- def pricing_data_poro
18
+ def pricing_data_poro(take_cards = nil)
19
+ data = pricing_data
20
+ data[:cards] = data[:cards].take(take_cards) if take_cards
16
21
  # OpenStruct is not a good practice: But this makes the HASH and feel like a PORO model
17
- JSON.parse(pricing_data.to_json, object_class: OpenStruct)
22
+ JSON.parse(data.to_json, object_class: OpenStruct)
18
23
  end
19
24
 
20
25
  def pricing_data
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsAppGenerator
4
- VERSION = '0.3.4'
4
+ VERSION = '0.3.5'
5
5
  end
data/package-lock.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "rails_app_generator",
3
- "version": "0.3.4",
3
+ "version": "0.3.5",
4
4
  "lockfileVersion": 2,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "rails_app_generator",
9
- "version": "0.3.4",
9
+ "version": "0.3.5",
10
10
  "dependencies": {
11
11
  "daisyui": "^2.20.0"
12
12
  },
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rails_app_generator",
3
- "version": "0.3.4",
3
+ "version": "0.3.5",
4
4
  "description": "Create new Rails Application with custom opinions",
5
5
  "scripts": {
6
6
  "release": "semantic-release"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_app_generator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Cruwys
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-10-06 00:00:00.000000000 Z
11
+ date: 2022-10-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bootsnap