Summary: _typescript_

Reviewed By: bnelo12

Differential Revision: D16830545

fbshipit-source-id: d2fbbe76e4aaf36d8558a2e793d782f184e1da54
This commit is contained in:
Daniel Büchele
2019-08-20 03:18:32 -07:00
committed by Facebook Github Bot
parent 462c903380
commit 4eff1dc073
7 changed files with 39 additions and 35 deletions

View File

@@ -6,7 +6,7 @@
*/ */
import * as React from 'react'; import * as React from 'react';
import Glyph from './Glyph.js'; import Glyph from './Glyph.tsx';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import electron from 'electron'; import electron from 'electron';
import styled from '../styled/index.js'; import styled from '../styled/index.js';

View File

@@ -8,7 +8,7 @@ import React, {Component} from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import styled from '../styled/index.js'; import styled from '../styled/index.js';
import Glyph from './Glyph.js'; import Glyph from './Glyph.tsx';
const IconContainer = styled('div')({ const IconContainer = styled('div')({
width: 0, width: 0,

View File

@@ -6,18 +6,21 @@
*/ */
import React from 'react'; import React from 'react';
import styled from '../styled/index.js'; import styled from 'react-emotion';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import {getIconURL} from '../../utils/icons.js'; import {getIconURL} from '../../utils/icons.js';
const ColoredIconBlack = styled('img')(({size}) => ({ export type IconSize = 8 | 10 | 12 | 16 | 18 | 20 | 24 | 32;
const ColoredIconBlack = styled('img')(({size}: {size: number}) => ({
height: size, height: size,
verticalAlign: 'middle', verticalAlign: 'middle',
width: size, width: size,
flexShrink: 0, flexShrink: 0,
})); }));
const ColoredIconCustom = styled('div')(props => ({ const ColoredIconCustom = styled('div')(
(props: {size: number; color: string; src: string}) => ({
height: props.size, height: props.size,
verticalAlign: 'middle', verticalAlign: 'middle',
width: props.size, width: props.size,
@@ -28,19 +31,20 @@ const ColoredIconCustom = styled('div')(props => ({
WebkitMaskImage: `url('${props.src}')`, WebkitMaskImage: `url('${props.src}')`,
WebkitMaskSize: '100% 100%', WebkitMaskSize: '100% 100%',
flexShrink: 0, flexShrink: 0,
})); }),
);
function ColoredIcon( function ColoredIcon(
props: {| props: {
name: string, name: string;
src: string, src: string;
size?: number, size?: number;
className?: string, className?: string;
color?: string, color?: string;
|}, },
context: {| context: {
glyphColor?: string, glyphColor?: string;
|}, },
) { ) {
const {color = context.glyphColor, name, size = 16, src} = props; const {color = context.glyphColor, name, size = 16, src} = props;
@@ -76,11 +80,11 @@ ColoredIcon.contextTypes = {
}; };
export default class Glyph extends React.Component<{ export default class Glyph extends React.Component<{
name: string, name: string;
size?: 8 | 10 | 12 | 16 | 18 | 20 | 24 | 32, size?: IconSize;
variant?: 'filled' | 'outline', variant?: 'filled' | 'outline';
className?: string, className?: string;
color?: string, color?: string;
}> { }> {
render() { render() {
const {name, size, variant, color, className} = this.props; const {name, size, variant, color, className} = this.props;

View File

@@ -10,7 +10,7 @@ import styled from 'react-emotion';
import FlexColumn from './FlexColumn.js'; import FlexColumn from './FlexColumn.js';
import FlexBox from './FlexBox.js'; import FlexBox from './FlexBox.js';
import {colors} from './colors'; import {colors} from './colors';
import Glyph from './Glyph.js'; import Glyph from './Glyph';
const BORDER = '1px solid #dddfe2'; const BORDER = '1px solid #dddfe2';

View File

@@ -15,7 +15,7 @@ import ContextMenu from '../ContextMenu.js';
import {PureComponent, type Element as ReactElement} from 'react'; import {PureComponent, type Element as ReactElement} from 'react';
import FlexRow from '../FlexRow.js'; import FlexRow from '../FlexRow.js';
import FlexColumn from '../FlexColumn.js'; import FlexColumn from '../FlexColumn.js';
import Glyph from '../Glyph.js'; import Glyph from '../Glyph.tsx';
import {colors} from '../colors.tsx'; import {colors} from '../colors.tsx';
import Text from '../Text.tsx'; import Text from '../Text.tsx';
import styled from '../../styled/index.js'; import styled from '../../styled/index.js';

View File

@@ -14,7 +14,7 @@ import Input from '../Input.tsx';
import {colors} from '../colors.tsx'; import {colors} from '../colors.tsx';
import Text from '../Text.tsx'; import Text from '../Text.tsx';
import FlexBox from '../FlexBox.js'; import FlexBox from '../FlexBox.js';
import Glyph from '../Glyph.js'; import Glyph from '../Glyph.tsx';
import FilterToken from './FilterToken.js'; import FilterToken from './FilterToken.js';
import styled from '../../styled/index.js'; import styled from '../../styled/index.js';
import debounce from 'lodash.debounce'; import debounce from 'lodash.debounce';

View File

@@ -18,7 +18,7 @@ export {default as ButtonGroupChain} from './components/ButtonGroupChain.js';
export {colors, darkColors, brandColors} from './components/colors.tsx'; export {colors, darkColors, brandColors} from './components/colors.tsx';
// //
export {default as Glyph} from './components/Glyph.js'; export {default as Glyph} from './components/Glyph.tsx';
// //
export {default as LoadingIndicator} from './components/LoadingIndicator.tsx'; export {default as LoadingIndicator} from './components/LoadingIndicator.tsx';