Skip to content

Commit

Permalink
Merge branch 'SL-1138/context-sub-menu' of github.com:stoplightio/ui-…
Browse files Browse the repository at this point in the history
…kit into SL-1138/context-sub-menu
  • Loading branch information
casserni committed Jan 29, 2019
2 parents e947f63 + 04e7691 commit caf7844
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/Checkbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import { Box, Flex, IBox, useTheme } from './';
export const Checkbox: FunctionComponent<ICheckbox> = props => {
const { id, disabled: isDisabled, onChange, ...rest } = props;

const [checked, setValue] = useState<boolean>(props.checked || false);
const isChecked = props.hasOwnProperty('checked') ? props.checked : checked;
const [checked, setValue] = useState<boolean>(!!props.checked);
const isChecked = props.hasOwnProperty('checked') ? !!props.checked : checked;

const css = checkboxStyles({ isDisabled, isChecked });

Expand Down Expand Up @@ -44,6 +44,7 @@ export const Checkbox: FunctionComponent<ICheckbox> = props => {

export interface ICheckboxProps {
id: IBox['id'];
checked?: boolean;
onChange?: (checked: boolean) => void;
}

Expand Down
5 changes: 3 additions & 2 deletions src/Toggle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ const circleStyles = ({ isChecked }: IToggleCircleProps) => {
export const Toggle: FunctionComponent<IToggle> = props => {
const { id, disabled: isDisabled, onChange, ...rest } = props;

const [checked, setValue] = useState<boolean>(props.checked || false);
const isChecked = props.hasOwnProperty('checked') ? props.checked : checked;
const [checked, setValue] = useState<boolean>(!!props.checked);
const isChecked = props.hasOwnProperty('checked') ? !!props.checked : checked;

const css = toggleStyles({ isDisabled, isChecked });

Expand Down Expand Up @@ -64,6 +64,7 @@ export const Toggle: FunctionComponent<IToggle> = props => {
};

export interface IToggleProps {
checked?: boolean;
onChange?: (checked: boolean) => void;
}

Expand Down

0 comments on commit caf7844

Please sign in to comment.