refactor(v2): split out dark mode toggle so it is easily swizzle-able (#2013)

This commit is contained in:
Endi 2019-11-22 12:31:28 +07:00 committed by GitHub
parent d2a095bec0
commit 4fab29fb21
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 187 additions and 166 deletions

View file

@ -0,0 +1,27 @@
/**
* Copyright (c) 2017-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
import Toggle from 'react-toggle';
import classnames from 'classnames';
import styles from './styles.module.css';
const Moon = () => <span className={classnames(styles.toggle, styles.moon)} />;
const Sun = () => <span className={classnames(styles.toggle, styles.sun)} />;
export default function(props) {
return (
<Toggle
icons={{
checked: <Moon />,
unchecked: <Sun />,
}}
{...props}
/>
);
}