feat: Have theme follow system pref

This commit is contained in:
Tom Moor
2020-05-20 23:19:07 -07:00
parent 218b0ea76a
commit 672ffacc5b
5 changed files with 88 additions and 23 deletions

View File

@ -1,14 +1,22 @@
// @flow
import * as React from 'react';
import { CheckmarkIcon } from 'outline-icons';
import styled from 'styled-components';
type Props = {
onClick?: (SyntheticEvent<>) => void | Promise<void>,
children?: React.Node,
selected?: boolean,
disabled?: boolean,
};
const DropdownMenuItem = ({ onClick, children, disabled, ...rest }: Props) => {
const DropdownMenuItem = ({
onClick,
children,
selected,
disabled,
...rest
}: Props) => {
return (
<MenuItem
onClick={disabled ? undefined : onClick}
@ -17,6 +25,9 @@ const DropdownMenuItem = ({ onClick, children, disabled, ...rest }: Props) => {
tabIndex="-1"
{...rest}
>
{selected !== undefined && (
<CheckmarkIcon color={selected === false ? 'transparent' : undefined} />
)}
{children}
</MenuItem>
);
@ -26,6 +37,7 @@ const MenuItem = styled.a`
display: flex;
margin: 0;
padding: 6px 12px;
width: 100%;
height: 32px;
color: ${props =>