Skip to content

Commit e43cf01

Browse files
authored
[PLAY-1799] Date Dark Mode Audit (#4174)
**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.
1 parent 9a4932a commit e43cf01

File tree

3 files changed

+29
-10
lines changed

3 files changed

+29
-10
lines changed

playbook/app/pb_kits/playbook/pb_date/_date.tsx

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ type PbDateProps = {
1414
alignment?: "left" | "center" | "right";
1515
aria?: { [key: string]: string };
1616
className?: string;
17+
dark?: boolean;
1718
data?: { [key: string]: string };
1819
htmlOptions?: { [key: string]: string | number | boolean | (() => void) };
1920
id?: string;
@@ -29,6 +30,7 @@ const PbDate = (props: PbDateProps): React.ReactElement => {
2930
aria = {},
3031
alignment = "left",
3132
className,
33+
dark = false,
3234
data = {},
3335
htmlOptions = {},
3436
id,
@@ -56,7 +58,7 @@ const PbDate = (props: PbDateProps): React.ReactElement => {
5658
);
5759

5860
return (
59-
<div
61+
<div
6062
{...ariaProps}
6163
{...dataProps}
6264
{...htmlProps}
@@ -93,7 +95,9 @@ const PbDate = (props: PbDateProps): React.ReactElement => {
9395
</>
9496
: size == "md" || size == "lg"
9597
? (
96-
<Title size={4}
98+
<Title
99+
dark={dark}
100+
size={4}
97101
tag="h4"
98102
>
99103
{showIcon && (
@@ -127,6 +131,7 @@ const PbDate = (props: PbDateProps): React.ReactElement => {
127131
<>
128132
{showIcon && (
129133
<Caption className="pb_icon_kit_container"
134+
dark={dark}
130135
tag="span"
131136
>
132137
<Icon fixedWidth
@@ -138,15 +143,20 @@ const PbDate = (props: PbDateProps): React.ReactElement => {
138143

139144
{showDayOfWeek && (
140145
<>
141-
<Caption tag="div">{weekday}</Caption>
146+
<Caption dark={dark}
147+
tag="div">
148+
{weekday}
149+
</Caption>
142150
<Caption color="light"
151+
dark={dark}
143152
tag="div"
144153
text=" • "
145154
/>
146155
</>
147156
)}
148157

149-
<Caption tag="span">
158+
<Caption dark={dark}
159+
tag="span">
150160
{month} {day}
151161
{currentYear != year && <>{`, ${year}`}</>}
152162
</Caption>

playbook/app/pb_kits/playbook/pb_date/docs/_date_default.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const DateDefault = (props) => {
1818
value={"2012-08-03"}
1919
{...props}
2020
/>
21-
<Caption>{"(Hyphenated Date)"}</Caption>
21+
<Caption {...props}>{"(Hyphenated Date)"}</Caption>
2222
</div>
2323

2424
<br />
@@ -56,6 +56,7 @@ const DateDefault = (props) => {
5656
<Title
5757
size={4}
5858
text={"(Hyphenated Date)"}
59+
{...props}
5960
/>
6061
</div>
6162

playbook/app/pb_kits/playbook/pb_date/docs/_date_unstyled.jsx

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ import { Caption, Date as FormattedDate, Title } from 'playbook-ui'
44
const DateUnstyled = (props) => {
55
return (
66
<>
7-
<Caption size="xs"
7+
<Caption {...props}
8+
size="xs"
89
text="Basic unstyled example"
910
/>
1011
<FormattedDate
@@ -15,10 +16,14 @@ const DateUnstyled = (props) => {
1516

1617
<br />
1718

18-
<Caption size="xs"
19+
<Caption {...props}
20+
21+
size="xs"
1922
text="Example with wrapping typography kit"
2023
/>
21-
<Title size={1}>
24+
<Title {...props}
25+
size={1}
26+
>
2227
<FormattedDate
2328
unstyled
2429
value={new Date('25 Dec 1995')}
@@ -28,10 +33,13 @@ const DateUnstyled = (props) => {
2833

2934
<br />
3035

31-
<Caption size="xs"
36+
<Caption {...props}
37+
size="xs"
3238
text="Example with icon + subcaption"
3339
/>
34-
<Caption size="xs">
40+
<Caption {...props}
41+
size="xs"
42+
>
3543
<FormattedDate
3644
showDayOfWeek
3745
showIcon

0 commit comments

Comments
 (0)