This repository has been archived on 2022-08-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
outline/frontend/components/Icon/Icon.js
Tom Moor 606dc69204 Link Toolbar Improves (#269)
* WIP

* Internal link handling

* Keyboard navigation of link select

* More constants

* Save relative urls.
Relative urls are atlas urls
2017-09-27 23:29:48 -04:00

54 lines
919 B
JavaScript

// @flow
import React from 'react';
import styled from 'styled-components';
import { color } from 'styles/constants';
import * as Icons from 'react-feather';
export type Props = {
className?: string,
type?: string,
light?: boolean,
};
type BaseProps = {
children?: React$Element<any>,
};
export default function Icon({
children,
light,
type,
...rest
}: Props & BaseProps) {
if (type) {
children = React.createElement(Icons[type], {
size: '1em',
color: light ? color.white : undefined,
...rest,
});
return (
<FeatherWrapper {...rest}>
{children}
</FeatherWrapper>
);
}
return (
<Wrapper light={light} {...rest}>
{children}
</Wrapper>
);
}
const FeatherWrapper = styled.span`
position: relative;
top: .1em;
`;
const Wrapper = styled.span`
svg {
fill: ${props => (props.light ? color.white : color.black)}
}
`;