Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Cole Erikson
committed
Sep 17, 2020
1 parent
cd2b4a6
commit 6d0b32e
Showing
15 changed files
with
404 additions
and
132 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,37 @@ | ||
<%= content_tag(:div, | ||
id: object.id, | ||
data: object.data, | ||
class: object.classname) do %> | ||
<% if object.size == "lg" %> | ||
<%= pb_rails("title", props: { text: object.lg_date, size: 3 }) %> | ||
<% elsif object.size == "sm" %> | ||
<%= pb_rails("icon", props: { icon: "calendar", fixed_width: true }) %> | ||
<%= pb_rails("title", props: { tag: "span", text: object.sm_date, size: 4 }) %> | ||
<% else %> | ||
<%= pb_rails("title", props: { text: object.xs_date, size: 4 }) %> | ||
class: object.classname, | ||
aria: object.aria) do %> | ||
|
||
<!-- icon --> | ||
<% if object.show_icon %> | ||
<%= pb_rails("body", props: { | ||
color: "light", | ||
tag: "div", | ||
}) do %> | ||
<%= pb_rails("icon", props: { icon: "calendar-alt", fixed_width: true }) %> | ||
<% end %> | ||
<% end %> | ||
|
||
<!-- day_of_week --> | ||
<% if object.show_day_of_week %> | ||
<%= pb_rails("title", props: { tag: "div", text: object.day_of_week, size: 4 }) %> | ||
<%= pb_rails("body", props: { | ||
text: "•", | ||
color: "light", | ||
tag: "div", | ||
}) %> | ||
<% end %> | ||
<% end %> | ||
|
||
<!-- month day, year --> | ||
|
||
<%# if not current year %> | ||
<% if object.year.to_s == DateTime.now.year.to_s %> | ||
<%= pb_rails("title", props: { tag: "div", text: "#{object.month} #{object.day}", size: 4 }) %> | ||
<%# if is current year %> | ||
<% else %> | ||
<%= pb_rails("title", props: { tag: "div", text: "#{object.month} #{object.day}, #{object.year}", size: 4 }) %> | ||
<% 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 |
---|---|---|
@@ -1,2 +1,32 @@ | ||
@import "../pb_icon/icon"; | ||
@import "../pb_title/title"; | ||
|
||
[class^=pb_date_kit] { | ||
display: flex; | ||
flex-direction: row; | ||
align-items: center; | ||
> div, .pb_icon_kit_container { | ||
margin-right: 4px !important; | ||
} | ||
|
||
&[class*=_center] { | ||
display: flex; | ||
flex-direction: row; | ||
align-items: center; | ||
justify-content: center; | ||
margin-right: 4px !important; | ||
} | ||
|
||
&[class*=_right] { | ||
display: flex; | ||
flex-direction: row; | ||
align-items: center; | ||
justify-content: flex-end; | ||
margin-left: 4px !important; | ||
} | ||
&.dark { | ||
[class^=pb_title_kit] { | ||
color: $text_dk_default !important; | ||
} | ||
} | ||
} |
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
24 changes: 24 additions & 0 deletions
24
app/pb_kits/playbook/pb_date/docs/_date_alignment.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,24 @@ | ||
<%= pb_rails("date", props: { | ||
date: DateTime.now, | ||
show_icon: true, | ||
show_day_of_week: true | ||
}) %> | ||
|
||
<br><br> | ||
|
||
<%= pb_rails("date", props: { | ||
date: DateTime.now, | ||
show_icon: true, | ||
show_day_of_week: true, | ||
alignment: "center" | ||
}) %> | ||
|
||
<br><br> | ||
|
||
<%= pb_rails("date", props: { | ||
date: DateTime.now, | ||
show_icon: true, | ||
show_day_of_week: true, | ||
alignment: "right" | ||
}) %> | ||
|
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,32 @@ | ||
import React from 'react' | ||
import { Date as FormattedDate } from '../..' | ||
|
||
const DateAlignment = () => { | ||
return ( | ||
<div> | ||
<FormattedDate | ||
dayOfWeek | ||
icon | ||
value="1995-12-25" | ||
/> | ||
|
||
<br /> | ||
|
||
<FormattedDate | ||
alignment="center" | ||
dayOfWeek | ||
icon | ||
value="2020-12-25" | ||
/> | ||
|
||
<br /> | ||
|
||
<FormattedDate | ||
alignment="right" | ||
value={new Date()} | ||
/> | ||
</div> | ||
) | ||
} | ||
|
||
export default DateAlignment |
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,22 @@ | ||
<%= pb_rails("date", props: { | ||
dark: true, | ||
date: Date.today, | ||
show_icon: true, | ||
}) %> | ||
|
||
<br> | ||
|
||
<%= pb_rails("date", props: { | ||
dark: true, | ||
date: "2012-08-02T15:49:29Z", | ||
show_icon: true, | ||
}) %> | ||
|
||
<br> | ||
|
||
<%= pb_rails("date", props: { | ||
dark: true, | ||
date: "2017-12-02T15:49:29Z", | ||
show_day_of_week: true, | ||
show_icon: true, | ||
}) %> |
Oops, something went wrong.