Skip to content

[WB-1851.1] Dropdown: Remove light prop on dropdowns #2430

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

Merged
merged 5 commits into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/tricky-yaks-mate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@khanacademy/wonder-blocks-dropdown": major
---

Removes the `light` prop from wonder-blocks-dropdown. This includes removing that in `SingleSelect` and `MultiSelect`.
9 changes: 0 additions & 9 deletions __docs__/wonder-blocks-dropdown/base-select.argtypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,6 @@ const argTypes: ArgTypes = {
},
},

light: {
description: `Whether to display the "light" version of this component
instead, for use when the component is used on a dark background.`,
table: {
category: "States",
defaultValue: {summary: "false"},
},
},

opened: {
control: "boolean",
description:
Expand Down
5 changes: 0 additions & 5 deletions __docs__/wonder-blocks-dropdown/combobox.argtypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,6 @@ const argTypes: ArgTypes = {
category: "Visual style",
},
},
light: {
table: {
category: "Visual style",
},
},

/**
* Events
Expand Down
1 change: 0 additions & 1 deletion __docs__/wonder-blocks-dropdown/combobox.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ const defaultArgs = {
placeholder: "Select an item",
testId: "",
autoComplete: "none",
light: false,
loading: false,
};

Expand Down
128 changes: 34 additions & 94 deletions __docs__/wonder-blocks-dropdown/multi-select-variants.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,19 @@ import {StyleSheet} from "aphrodite";
import type {Meta, StoryObj} from "@storybook/react";

import {View} from "@khanacademy/wonder-blocks-core";
import {ThemeSwitcherContext} from "@khanacademy/wonder-blocks-theming";
import {color, spacing} from "@khanacademy/wonder-blocks-tokens";
import {HeadingLarge, LabelMedium} from "@khanacademy/wonder-blocks-typography";
import {spacing} from "@khanacademy/wonder-blocks-tokens";
import {HeadingLarge} from "@khanacademy/wonder-blocks-typography";
import {MultiSelect, OptionItem} from "@khanacademy/wonder-blocks-dropdown";
import {LabeledField} from "@khanacademy/wonder-blocks-labeled-field";

/**
* The following stories are used to generate the pseudo states for the
* multi select component. This is only used for visual testing in Chromatic.
*/
export default {
title: "Packages / Dropdown / MultiSelect / All Variants",
parameters: {
docs: {
autodocs: false,
},
},
render: () => <AllVariants />,
tags: ["!autodocs"],
} as Meta;

type StoryComponentType = StoryObj<typeof MultiSelect>;
Expand All @@ -33,121 +30,64 @@ const selectItems = [
<OptionItem label="item 3" value="3" />,
];

const KindVariants = ({light}: {light: boolean}) => {
return (
<ThemeSwitcherContext.Consumer>
{(theme) => (
<>
<View
style={[
styles.gridRow,
light &&
(theme === "khanmigo"
? styles.darkKhanmigo
: styles.darkDefault),
]}
>
<LabelMedium style={light && {color: color.white}}>
Default
</LabelMedium>
<MultiSelect {...defaultProps} light={light}>
const AllVariants = ({themeName = "Default"}: {themeName?: string}) => (
<View style={{marginBottom: spacing.large_24}}>
<HeadingLarge>{themeName} theme</HeadingLarge>
<View style={styles.grid}>
<View style={[styles.gridRow]}>
<LabeledField
label="Default"
field={
<MultiSelect {...defaultProps}>
{selectItems}
</MultiSelect>
</View>
<View
style={[
styles.gridRow,
light &&
(theme === "khanmigo"
? styles.darkKhanmigo
: styles.darkDefault),
]}
>
<LabelMedium style={light && {color: color.white}}>
Disabled
</LabelMedium>
<MultiSelect
{...defaultProps}
light={light}
disabled={true}
>
}
/>
</View>
<View style={[styles.gridRow]}>
<LabeledField
label="Disabled"
field={
<MultiSelect {...defaultProps} disabled={true}>
{selectItems}
</MultiSelect>
</View>
<View
style={[
styles.gridRow,
light &&
(theme === "khanmigo"
? styles.darkKhanmigo
: styles.darkDefault),
]}
>
<LabelMedium style={light && {color: color.white}}>
Error
</LabelMedium>
<MultiSelect
{...defaultProps}
light={light}
error={true}
>
}
/>
</View>
<View style={[styles.gridRow]}>
<LabeledField
label="Error"
field={
<MultiSelect {...defaultProps} error={true}>
{selectItems}
</MultiSelect>
</View>
</>
)}
</ThemeSwitcherContext.Consumer>
);
};

const VariantsByTheme = ({themeName = "Default"}: {themeName?: string}) => (
<View style={{marginBottom: spacing.large_24}}>
<HeadingLarge>{themeName} theme</HeadingLarge>
<View style={styles.grid}>
<KindVariants light={false} />
<KindVariants light={true} />
}
/>
</View>
</View>
</View>
);

const AllVariants = () => (
<>
<VariantsByTheme />
</>
);

export const Default: StoryComponentType = {
render: AllVariants,
};
export const Default: StoryComponentType = {};

export const Hover: StoryComponentType = {
render: AllVariants,
parameters: {pseudo: {hover: true}},
};

export const Focus: StoryComponentType = {
render: AllVariants,
parameters: {pseudo: {focusVisible: true}},
};

export const HoverFocus: StoryComponentType = {
name: "Hover + Focus",
render: AllVariants,
parameters: {pseudo: {hover: true, focusVisible: true}},
};

export const Active: StoryComponentType = {
render: AllVariants,
parameters: {pseudo: {active: true}},
};

const styles = StyleSheet.create({
darkDefault: {
backgroundColor: color.darkBlue,
},
darkKhanmigo: {
backgroundColor: color.eggplant,
},
grid: {
display: "grid",
gridTemplateColumns: "repeat(3, 250px)",
Expand Down
1 change: 0 additions & 1 deletion __docs__/wonder-blocks-dropdown/multi-select.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ export default {
error: false,
opened: false,
disabled: false,
light: false,
shortcuts: false,
implicitAllEnabled: false,
id: "",
Expand Down
Loading
Loading