Skip to content

Commit 19fe238

Browse files
authored
[PLAY-1787] Selectable Icon - Dark Mode Audit (#4140)
**What does this PR do?** A clear and concise description with your runway ticket url. This PR enables proper use of dark mode to the selectable icon kit in React. **Screenshots:** Screenshots to visualize your addition/change Before(left) and After(right) ![Screenshot 2025-01-20 at 3 39 32 PM](https://github.com/user-attachments/assets/44593a0e-380a-4537-a34e-15c80445ef69) **How to test?** Steps to confirm the desired behavior: 1. Go to the selectable icon kit : /kits/selectable_icon/react 2. Toggle Dark Mode 3. Switch to React 4. See change on each selectable icon kit #### 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. - [ ] **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 ae17486 commit 19fe238

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

playbook/app/pb_kits/playbook/pb_selectable_icon/_selectable_icon.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ type SelectableIconProps = {
1616
checked?: boolean,
1717
className?: string,
1818
customIcon?: {[key: string] :SVGElement},
19+
dark?: boolean,
1920
disabled?: boolean,
2021
data?: GenericObject,
2122
htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
@@ -33,6 +34,7 @@ const SelectableIcon = ({
3334
className,
3435
checked = false,
3536
customIcon,
37+
dark = false,
3638
data = {},
3739
disabled = false,
3840
htmlOptions = {},
@@ -52,10 +54,12 @@ const SelectableIcon = ({
5254
const classes = classnames(
5355
buildCss('pb_selectable_icon_kit', {
5456
checked: checked,
57+
dark: dark,
5558
disabled: disabled,
5659
enabled: !disabled,
5760
}),
5861
globalProps(props),
62+
dark ? 'dark' : '',
5963
className
6064
)
6165

@@ -73,17 +77,19 @@ const SelectableIcon = ({
7377
<>
7478
<Icon
7579
customIcon={customIcon}
80+
dark={dark}
7681
icon={icon}
7782
size="2x"
7883
/>
7984
<Title
85+
dark={dark}
8086
size={4}
8187
tag="h4"
8288
text={text}
8389
/>
8490
</>
8591
)}
86-
92+
8793
{inputs === 'enabled' && (
8894
<>
8995
<input
@@ -98,10 +104,12 @@ const SelectableIcon = ({
98104
<label htmlFor={inputIdPresent}>
99105
<Icon
100106
customIcon={customIcon}
107+
dark={dark}
101108
icon={icon}
102109
size="2x"
103110
/>
104111
<Title
112+
dark={dark}
105113
size={4}
106114
tag="h4"
107115
text={text}

playbook/app/pb_kits/playbook/pb_selectable_icon/docs/_selectable_icon_default.jsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React, { useState } from 'react'
22
import SelectableIcon from '../_selectable_icon'
33

4-
const SelectableIconDefault = () => {
4+
const SelectableIconDefault = (props) => {
55
const [ checkSelected, toggleSelected ] = useState(true)
66
const [ checkUnselected, toggleUnselected ] = useState(false)
77
const [ checkDisabled, toggleDisabled ] = useState(false)
@@ -15,6 +15,7 @@ const SelectableIconDefault = () => {
1515
inputId={10}
1616
onChange={() => toggleSelected(!checkSelected)}
1717
text="US Dollar"
18+
{...props}
1819
/>
1920

2021
<SelectableIcon
@@ -23,6 +24,7 @@ const SelectableIconDefault = () => {
2324
inputId={11}
2425
onChange={() => toggleUnselected(!checkUnselected)}
2526
text="Euro"
27+
{...props}
2628
/>
2729

2830
<SelectableIcon
@@ -32,6 +34,7 @@ const SelectableIconDefault = () => {
3234
inputId={12}
3335
onChange={() => toggleDisabled(!checkDisabled)}
3436
text="Yen"
37+
{...props}
3538
/>
3639
</div>
3740
)

playbook/app/pb_kits/playbook/pb_selectable_icon/docs/_selectable_icon_single_select.jsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React, { useState } from 'react'
22

33
import SelectableIcon from '../_selectable_icon'
44

5-
const SelectableIconSingleSelect = () => {
5+
const SelectableIconSingleSelect = (props) => {
66
const [ selectedFormat, toggleFormat ] = useState(null)
77

88
return (
@@ -17,6 +17,7 @@ const SelectableIconSingleSelect = () => {
1717
onChange={() => toggleFormat('Cassette')}
1818
text="Cassette"
1919
value="Cassette"
20+
{...props}
2021
/>
2122

2223
<SelectableIcon
@@ -28,6 +29,7 @@ const SelectableIconSingleSelect = () => {
2829
onChange={() => toggleFormat('CD')}
2930
text="CD"
3031
value="CD"
32+
{...props}
3133
/>
3234

3335
<SelectableIcon
@@ -39,6 +41,7 @@ const SelectableIconSingleSelect = () => {
3941
onChange={() => toggleFormat('Vinyl')}
4042
text="Vinyl"
4143
value="Vinyl"
44+
{...props}
4245
/>
4346
</div>
4447
)

0 commit comments

Comments
 (0)