Skip to content

Commit

Permalink
[PLAY-1799] Date Dark Mode Audit (#4174)
Browse files Browse the repository at this point in the history
**What does this PR do?** A clear and concise description with your
runway ticket url.
Updates the Unstyled and Default React Doc so that dark mode prop
transposes `Title` and `Caption` components.

[Story PLAY-1799](https://runway.powerhrg.com/backlog_items/PLAY-1799)
**Screenshots:** Screenshots to visualize your addition/change
![Screenshot 2025-01-24 at 11 57
00 AM](https://github.com/user-attachments/assets/9e462765-a43b-42af-b45d-3ba31f328a6e)
![Screenshot 2025-01-24 at 11 57
18 AM](https://github.com/user-attachments/assets/581e5052-9d2b-4cae-a811-fc4f0143eb72)


**How to test?** Steps to confirm the desired behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See addition/change


#### 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.
- [ ] **TESTS** I have added test coverage to my code.
  • Loading branch information
cmhorsey authored Jan 30, 2025
1 parent 9a4932a commit e43cf01
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 10 deletions.
18 changes: 14 additions & 4 deletions playbook/app/pb_kits/playbook/pb_date/_date.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ type PbDateProps = {
alignment?: "left" | "center" | "right";
aria?: { [key: string]: string };
className?: string;
dark?: boolean;
data?: { [key: string]: string };
htmlOptions?: { [key: string]: string | number | boolean | (() => void) };
id?: string;
Expand All @@ -29,6 +30,7 @@ const PbDate = (props: PbDateProps): React.ReactElement => {
aria = {},
alignment = "left",
className,
dark = false,
data = {},
htmlOptions = {},
id,
Expand Down Expand Up @@ -56,7 +58,7 @@ const PbDate = (props: PbDateProps): React.ReactElement => {
);

return (
<div
<div
{...ariaProps}
{...dataProps}
{...htmlProps}
Expand Down Expand Up @@ -93,7 +95,9 @@ const PbDate = (props: PbDateProps): React.ReactElement => {
</>
: size == "md" || size == "lg"
? (
<Title size={4}
<Title
dark={dark}
size={4}
tag="h4"
>
{showIcon && (
Expand Down Expand Up @@ -127,6 +131,7 @@ const PbDate = (props: PbDateProps): React.ReactElement => {
<>
{showIcon && (
<Caption className="pb_icon_kit_container"
dark={dark}
tag="span"
>
<Icon fixedWidth
Expand All @@ -138,15 +143,20 @@ const PbDate = (props: PbDateProps): React.ReactElement => {

{showDayOfWeek && (
<>
<Caption tag="div">{weekday}</Caption>
<Caption dark={dark}
tag="div">
{weekday}
</Caption>
<Caption color="light"
dark={dark}
tag="div"
text=" • "
/>
</>
)}

<Caption tag="span">
<Caption dark={dark}
tag="span">
{month} {day}
{currentYear != year && <>{`, ${year}`}</>}
</Caption>
Expand Down
3 changes: 2 additions & 1 deletion playbook/app/pb_kits/playbook/pb_date/docs/_date_default.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const DateDefault = (props) => {
value={"2012-08-03"}
{...props}
/>
<Caption>{"(Hyphenated Date)"}</Caption>
<Caption {...props}>{"(Hyphenated Date)"}</Caption>
</div>

<br />
Expand Down Expand Up @@ -56,6 +56,7 @@ const DateDefault = (props) => {
<Title
size={4}
text={"(Hyphenated Date)"}
{...props}
/>
</div>

Expand Down
18 changes: 13 additions & 5 deletions playbook/app/pb_kits/playbook/pb_date/docs/_date_unstyled.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import { Caption, Date as FormattedDate, Title } from 'playbook-ui'
const DateUnstyled = (props) => {
return (
<>
<Caption size="xs"
<Caption {...props}
size="xs"
text="Basic unstyled example"
/>
<FormattedDate
Expand All @@ -15,10 +16,14 @@ const DateUnstyled = (props) => {

<br />

<Caption size="xs"
<Caption {...props}

size="xs"
text="Example with wrapping typography kit"
/>
<Title size={1}>
<Title {...props}
size={1}
>
<FormattedDate
unstyled
value={new Date('25 Dec 1995')}
Expand All @@ -28,10 +33,13 @@ const DateUnstyled = (props) => {

<br />

<Caption size="xs"
<Caption {...props}
size="xs"
text="Example with icon + subcaption"
/>
<Caption size="xs">
<Caption {...props}
size="xs"
>
<FormattedDate
showDayOfWeek
showIcon
Expand Down

0 comments on commit e43cf01

Please sign in to comment.