-
Notifications
You must be signed in to change notification settings - Fork 10
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
WB-1779: Add startIcon prop to Combobox #2364
Changes from 2 commits
5a182f0
0b0c21d
1c65f4d
a2a3291
eeb6c3e
76790a9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,12 @@ import { | |
} from "@khanacademy/wonder-blocks-core"; | ||
import {TextField} from "@khanacademy/wonder-blocks-form"; | ||
import IconButton from "@khanacademy/wonder-blocks-icon-button"; | ||
import {border, color, spacing} from "@khanacademy/wonder-blocks-tokens"; | ||
import { | ||
border, | ||
color, | ||
semanticColor, | ||
spacing, | ||
} from "@khanacademy/wonder-blocks-tokens"; | ||
|
||
import {DetailCell} from "@khanacademy/wonder-blocks-cell"; | ||
import {PhosphorIcon} from "@khanacademy/wonder-blocks-icon"; | ||
|
@@ -495,10 +500,16 @@ export default function Combobox({ | |
} | ||
|
||
const startIconElement = React.cloneElement(startIcon, { | ||
// Provide a default size for the icon that can be overridden by | ||
// the consumer. | ||
size: "small", | ||
...startIcon.props, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion: (no changes necessary) What do you think about providing a default size and color if the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Love it! |
||
// Override the disable state of the icon to match the combobox | ||
// Override the disabled state of the icon to match the combobox | ||
// state. | ||
color: disabled ? color.offBlack32 : startIcon.props.color, | ||
color: disabled | ||
? color.offBlack32 | ||
: // Use the color passed in, otherwise use the default color. | ||
startIcon.props.color ?? semanticColor.icon.primary, | ||
} as Partial<React.ReactElement<React.ComponentProps<typeof PhosphorIcon>>>); | ||
|
||
return <View style={styles.iconWrapper}>{startIconElement}</View>; | ||
|
@@ -711,12 +722,6 @@ const styles = StyleSheet.create({ | |
border: `1px solid ${color.red}`, | ||
color: color.offBlack, | ||
}, | ||
/** | ||
* Start icon styles | ||
*/ | ||
iconDisabled: { | ||
color: color.offBlack32, | ||
}, | ||
/** | ||
* Combobox input styles | ||
*/ | ||
|
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.
suggestion: We can remove
size="small"
here so we can confirm that the default size is being applied!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.
Good catch! I'll fix it before landing.