File size: 443 Bytes
84c1942
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import React, { FunctionComponent } from 'react';

import { Switch } from '@codesandbox/components';

type Props = {
  setValue: (value: boolean) => void;
  value: boolean;
};

export const PreferenceSwitch: FunctionComponent<Props> = ({
  setValue,
  value,
}) => {
  const handleClick = () => {
    setValue(!value);
  };

  return (
    <div style={{ marginRight: 8 }}>
      <Switch onChange={handleClick} on={value} />
    </div>
  );
};