-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PLAY-1586] Timeline Sub Sub Components (#3801)
**What does this PR do?** A clear and concise description with your runway ticket url. Runway https://runway.powerhrg.com/backlog_items/PLAY-1586 In this story we let devs add children or "what ever kit they want" to the date and node area of the timeline kit The major changes to react is in the `playbook/app/pb_kits/playbook/pb_timeline/_item.tsx` and in rails i added a new pattern to be able to conditionally render fragments of content I have an alpha here powerhome/nitro-web#43266 **Screenshots:** Screenshots to visualize your addition/change ![screenshot-127_0_0_1_3000-2024_10_17-09_57_21](https://github.com/user-attachments/assets/b07c56ec-9c52-4b1b-8d36-7971e76d3de8) **How to test?** Steps to confirm the desired behavior: 1. Go to https://pr3801.playbook.beta.px.powerapp.cloud/kits/timeline/react#with-children 2. Witness greatness #### Checklist: - [x] **LABELS** Add a label: `enhancement`, `bug`, `improvement`, `new kit`, `deprecated`, or `breaking`. See [Changelog & Labels](https://github.com/powerhome/playbook/wiki/Changelog-&-Labels) for details. - [x] **DEPLOY** I have added the `milano` label to show I'm ready for a review. - [x] **TESTS** I have added test coverage to my code. --------- Co-authored-by: Jasper Furniss <[email protected]>
- Loading branch information
1 parent
50fc9f6
commit c5f4170
Showing
23 changed files
with
518 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<%= pb_content_tag do %> | ||
<%= content.presence %> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# frozen_string_literal: true | ||
|
||
module Playbook | ||
module PbTimeline | ||
class Detail < Playbook::KitBase | ||
def classname | ||
generate_classname("pb_timeline_item_right_block") | ||
end | ||
end | ||
end | ||
end |
43 changes: 43 additions & 0 deletions
43
playbook/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_children.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<%= pb_rails("timeline", props: {orientation: "horizontal", show_date: true}) do %> | ||
<%= pb_rails("timeline/item", props: { line_style: "solid"}) do |item| %> | ||
|
||
<% item.label do %> | ||
<%= pb_rails("timeline/label") do %> | ||
<%= pb_rails("title", props: { text: "Any Kit Here", size: 2 }) %> | ||
<% end %> | ||
<% end %> | ||
|
||
<% item.step do %> | ||
<%= pb_rails("timeline/step", props: { icon: 'check', icon_color: 'teal' }) %> | ||
<% end %> | ||
|
||
<% item.detail do %> | ||
<%= pb_rails("title_detail", props: { | ||
title: "Jackson Heights", | ||
detail: "37-27 74th Street" | ||
}) %> | ||
<% end %> | ||
<% end %> | ||
<%= pb_rails("timeline/item", props: { line_style: "dotted"}) do |item| %> | ||
|
||
<% item.step do %> | ||
<%= pb_rails("timeline/step") do %> | ||
<%= pb_rails("pill", props: { text: "Any Kit" , variant: "success" }) %> | ||
<% end %> | ||
<% end %> | ||
|
||
<% item.detail do %> | ||
<%= pb_rails("title_detail", props: { | ||
title: "Greenpoint", | ||
detail: "81 Gate St Brooklyn" | ||
}) %> | ||
<% end %> | ||
<% end %> | ||
|
||
<%= pb_rails("timeline/item", props: {icon: "map-marker-alt", icon_color: "purple", date: Date.today+1 }) do |item| %> | ||
<%= pb_rails("title_detail", props: { | ||
title: "Society Hill", | ||
detail: "72 E St Astoria" | ||
}) %> | ||
<% end %> | ||
<% end %> |
68 changes: 68 additions & 0 deletions
68
playbook/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_children.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import React from 'react' | ||
|
||
import Timeline from '../_timeline' | ||
import Title from '../../pb_title/_title' | ||
import Pill from '../../pb_pill/_pill' | ||
|
||
import TitleDetail from '../../pb_title_detail/_title_detail' | ||
|
||
const TimelineWithChildren = (props) => ( | ||
<div> | ||
<Timeline orientation="horizontal" | ||
showDate | ||
{...props} | ||
> | ||
<Timeline.Item lineStyle="solid" | ||
{...props} | ||
> | ||
<Timeline.Label> | ||
<Title size={2} | ||
text='Any Kit Here' | ||
/> | ||
</Timeline.Label> | ||
<Timeline.Step icon="user" | ||
iconColor="royal" | ||
/> | ||
<Timeline.Detail> | ||
<TitleDetail detail="37-27 74th Street" | ||
title="Jackson Heights" | ||
{...props} | ||
/> | ||
</Timeline.Detail> | ||
</Timeline.Item> | ||
|
||
<Timeline.Item lineStyle="dotted" | ||
{...props} | ||
> | ||
<Timeline.Step> | ||
<Pill text="Any Kit" | ||
variant="success" | ||
/> | ||
</Timeline.Step> | ||
<Timeline.Detail> | ||
<TitleDetail detail="81 Gate St Brooklyn" | ||
title="Greenpoint" | ||
{...props} | ||
/> | ||
</Timeline.Detail> | ||
</Timeline.Item> | ||
|
||
<Timeline.Item lineStyle="solid" | ||
{...props} | ||
> | ||
<Timeline.Label date={new Date(new Date().setDate(new Date().getDate() + 1))} /> | ||
<Timeline.Step icon="map-marker-alt" | ||
iconColor="purple" | ||
/> | ||
<Timeline.Detail> | ||
<TitleDetail detail="72 E St Astoria" | ||
title="Society Hill" | ||
{...props} | ||
/> | ||
</Timeline.Detail> | ||
</Timeline.Item> | ||
</Timeline> | ||
</div> | ||
) | ||
|
||
export default TimelineWithChildren |
2 changes: 2 additions & 0 deletions
2
playbook/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_children.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Any kit can be used inside of our compound components of label, step, or detail. Expand the code snippet below to see how to use these children elements. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export { default as TimelineDefault } from './_timeline_default.jsx' | ||
export { default as TimelineVertical } from './_timeline_vertical.jsx' | ||
export { default as TimelineWithDate } from './_timeline_with_date.jsx' | ||
export { default as TimelineWithChildren } from './_timeline_with_children.jsx' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,21 @@ | ||
<%= pb_content_tag do %> | ||
<% if label %> | ||
<%= label %> | ||
<% else %> | ||
<%= pb_rails("timeline/label", props: { date: date }) %> | ||
<% end %> | ||
|
||
<div class="pb_timeline_item_left_block"> | ||
<% if object.date.present? %> | ||
<%= pb_rails("date_stacked", props: { | ||
date: object.date, | ||
size: "sm", | ||
align: "center" | ||
}) %> | ||
<% end %> | ||
</div> | ||
|
||
<div class="pb_timeline_item_step"> | ||
<%= pb_rails("icon_circle", props: { | ||
icon: object.icon, | ||
variant: object.icon_color, | ||
size: "xs" | ||
}) %> | ||
<div class="pb_timeline_item_connector"></div> | ||
</div> | ||
<% if step %> | ||
<%= step %> | ||
<% else %> | ||
<%= pb_rails("timeline/step", props: { icon: icon, icon_color: icon_color }) %> | ||
<% end %> | ||
|
||
<div class="pb_timeline_item_right_block"> | ||
<%= content.presence %> | ||
</div> | ||
<% if detail%> | ||
<%= detail%> | ||
<% else %> | ||
<%= pb_rails("timeline/detail") do %> | ||
<%= content %> | ||
<% end %> | ||
<% end %> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<%= pb_content_tag do %> | ||
<% if object.date.present? %> | ||
<%= pb_rails("date_stacked", props: { | ||
date: object.date, | ||
size: "sm", | ||
align: "center" | ||
}) %> | ||
<% else %> | ||
<%= content.presence %> | ||
<% end %> | ||
<% end %> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# frozen_string_literal: true | ||
|
||
module Playbook | ||
module PbTimeline | ||
class Label < Playbook::KitBase | ||
prop :date | ||
|
||
def classname | ||
generate_classname("pb_timeline_item_left_block") | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<%= pb_content_tag do %> | ||
<% if object.icon.present? %> | ||
<%= pb_rails("icon_circle", props: { | ||
icon: object.icon, | ||
variant: object.icon_color, | ||
size: "xs" | ||
}) %> | ||
<% else %> | ||
<%= content.presence %> | ||
<% end %> | ||
<div class="pb_timeline_item_connector"></div> | ||
<% end %> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# frozen_string_literal: true | ||
|
||
module Playbook | ||
module PbTimeline | ||
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], | ||
default: "default" | ||
|
||
def classname | ||
generate_classname("pb_timeline_item_step") | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.