-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PLAY-1586] Timeline Sub Sub Components #3801
Open
markdoeswork
wants to merge
13
commits into
master
Choose a base branch
from
play/1586_date_area
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
35deeac
Add 3 sub sub kits
markdoeswork 431f699
using sub kits to re-create
markdoeswork 5cab7a9
Specificity for each part of the timeline item
markdoeswork 7e58e87
React proof of concept
markdoeswork a25d91a
Use correct html structor
markdoeswork 25ab4bb
Use correct classnames
markdoeswork cdf5372
Redo type changes
markdoeswork 1e7cd31
Write tests
markdoeswork 0a32ee1
Make and fix docs
markdoeswork e933e5a
Update react names
markdoeswork fb87793
fix doc example
markdoeswork a98afcd
Fix test
markdoeswork 6af5cf5
Merge branch 'master' into play/1586_date_area
markdoeswork File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
12 changes: 12 additions & 0 deletions
12
playbook/app/pb_kits/playbook/pb_timeline/date_area.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,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 DateArea < Playbook::KitBase | ||
prop :date | ||
|
||
def classname | ||
generate_classname("pb_timeline_item_left_block") | ||
end | ||
end | ||
end | ||
end |
3 changes: 3 additions & 0 deletions
3
playbook/app/pb_kits/playbook/pb_timeline/detail_area.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,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 DetailArea < 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.date_area do %> | ||
<%= pb_rails("timeline/date_area") 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' }) %> | ||
<% end %> | ||
|
||
<% item.detail_area 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.node_area do %> | ||
<%= pb_rails("timeline/node_area") do %> | ||
<%= pb_rails("pill", props: { text: "Any Kit" , variant: "success" }) %> | ||
<% end %> | ||
<% end %> | ||
|
||
<% item.detail_area 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 |
4 changes: 4 additions & 0 deletions
4
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,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. | ||
|
||
Checkout the code in this example to see the children kits in action. | ||
|
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 date_area %> | ||
<%= date_area %> | ||
<% else %> | ||
<%= pb_rails("timeline/date_area", 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 node_area %> | ||
<%= node_area %> | ||
<% else %> | ||
<%= pb_rails("timeline/node_area", props: { icon: icon, icon_color: icon_color }) %> | ||
<% end %> | ||
|
||
<div class="pb_timeline_item_right_block"> | ||
<%= content.presence %> | ||
</div> | ||
<% if detail_area %> | ||
<%= detail_area %> | ||
<% else %> | ||
<%= pb_rails("timeline/detail_area") 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
14 changes: 14 additions & 0 deletions
14
playbook/app/pb_kits/playbook/pb_timeline/node_area.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,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 NodeArea < 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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
specifying the
item.date_area
allows us to only update the date areayou don't have to provide the node or detail area if you don't want to.
This is needed because our node area has default functionally and it will use the icon circle kit it you dont't put anything
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After doing more research i found that github's design system uses the same pattern https://primer.style/components/action-menu/rails/alpha#examples