Skip to content

Commit

Permalink
fix: correct toggle button type (#2651)
Browse files Browse the repository at this point in the history
  • Loading branch information
lukewalczak authored Apr 9, 2021
1 parent cdfb9ab commit 3593cd5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/components/ToggleButton/ToggleButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ const ToggleButton = ({

return (
<ToggleButtonGroupContext.Consumer>
{(context: { value: string; onValueChange: Function } | null) => {
{(context: { value: string | null; onValueChange: Function } | null) => {
let backgroundColor;

const checked: boolean | null =
Expand Down
8 changes: 4 additions & 4 deletions src/components/ToggleButton/ToggleButtonGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ type Props = {
/**
* Function to execute on selection change.
*/
onValueChange: (value: string) => void;
onValueChange: (value: string) => void | null;
/**
* Value of the currently selected toggle button.
*/
value: string;
value: string | null;
/**
* React elements containing toggle buttons.
*/
children: React.ReactNode;
};

type ToggleButtonContextType = {
value: string;
onValueChange: (item: string) => void;
value: string | null;
onValueChange: (item: string) => void | null;
};

export const ToggleButtonGroupContext = React.createContext<
Expand Down

0 comments on commit 3593cd5

Please sign in to comment.