Skip to content

Commit

Permalink
Change name of rails subcomponents
Browse files Browse the repository at this point in the history
  • Loading branch information
markdoeswork committed Oct 29, 2024
1 parent 6af5cf5 commit 2f43643
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

module Playbook
module PbTimeline
class DetailArea < Playbook::KitBase
class Detail < Playbook::KitBase
def classname
generate_classname("pb_timeline_item_right_block")
end
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<%= pb_rails("timeline", props: {orientation: "horizontal", show_date: true}) do %>
<%= pb_rails("timeline/item", props: { line_style: "solid"}) do |item| %>

<% item.date_area do %>
<%= pb_rails("timeline/date_area") do %>
<% item.label do %>
<%= pb_rails("timeline/label") do %>
<%= pb_rails("title", props: { text: "Any Kit Here", size: 2 }) %>
<% end %>
<% end %>

<% item.node_area do %>
<%= pb_rails("timeline/node_area", props: { icon: 'check', icon_color: 'teal' }) %>
<% item.step do %>
<%= pb_rails("timeline/step", props: { icon: 'check', icon_color: 'teal' }) %>
<% end %>

<% item.detail_area do %>
<% item.detail do %>
<%= pb_rails("title_detail", props: {
title: "Jackson Heights",
detail: "37-27 74th Street"
Expand All @@ -20,13 +20,13 @@
<% end %>
<%= pb_rails("timeline/item", props: { line_style: "dotted"}) do |item| %>

<% item.node_area do %>
<%= pb_rails("timeline/node_area") do %>
<% item.step do %>
<%= pb_rails("timeline/step") do %>
<%= pb_rails("pill", props: { text: "Any Kit" , variant: "success" }) %>
<% end %>
<% end %>

<% item.detail_area do %>
<% item.detail do %>
<%= pb_rails("title_detail", props: {
title: "Greenpoint",
detail: "81 Gate St Brooklyn"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
You can use whatever kit you want for the date area of the timeline item, the node area, and the content area at the bottom or left.
You can use whatever kit you want for the label, step, or detail sections of a timeline's event item.

Checkout the code in this example to see the children kits in action.

18 changes: 9 additions & 9 deletions playbook/app/pb_kits/playbook/pb_timeline/item.html.erb
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
<%= pb_content_tag do %>
<% if date_area %>
<%= date_area %>
<% if label %>
<%= label %>
<% else %>
<%= pb_rails("timeline/date_area", props: { date: date }) %>
<%= pb_rails("timeline/label", props: { date: date }) %>
<% end %>

<% if node_area %>
<%= node_area %>
<% if step %>
<%= step %>
<% else %>
<%= pb_rails("timeline/node_area", props: { icon: icon, icon_color: icon_color }) %>
<%= pb_rails("timeline/step", props: { icon: icon, icon_color: icon_color }) %>
<% end %>

<% if detail_area %>
<%= detail_area %>
<% if detail%>
<%= detail%>
<% else %>
<%= pb_rails("timeline/detail_area") do %>
<%= pb_rails("timeline/detail") do %>
<%= content %>
<% end %>
<% end %>
Expand Down
6 changes: 3 additions & 3 deletions playbook/app/pb_kits/playbook/pb_timeline/item.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ class Item < Playbook::KitBase
values: %w[solid dotted],
default: "solid"

renders_one :date_area
renders_one :node_area
renders_one :detail_area
renders_one :label
renders_one :step
renders_one :detail

def classname
generate_classname("pb_timeline_item_kit", line_style)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

module Playbook
module PbTimeline
class DateArea < Playbook::KitBase
class Label < Playbook::KitBase
prop :date

def classname
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

module Playbook
module PbTimeline
class NodeArea < Playbook::KitBase
class Step < Playbook::KitBase
prop :icon, type: Playbook::Props::String
prop :icon_color, type: Playbook::Props::Enum,
values: %w[default royal blue purple teal red yellow green],
Expand Down

0 comments on commit 2f43643

Please sign in to comment.