fix: Icon dark theme

This commit is contained in:
ycjcl868 2019-12-25 14:42:15 +08:00
parent 3698d7d221
commit 5dbfe42159
5 changed files with 27 additions and 4 deletions

View File

@ -21,7 +21,7 @@ function onChange(value) {
} }
ReactDOM.render( ReactDOM.render(
<div> <div className="site-input-number-wrapper">
<InputNumber size="large" min={1} max={100000} defaultValue={3} onChange={onChange} /> <InputNumber size="large" min={1} max={100000} defaultValue={3} onChange={onChange} />
<InputNumber min={1} max={100000} defaultValue={3} onChange={onChange} /> <InputNumber min={1} max={100000} defaultValue={3} onChange={onChange} />
<InputNumber size="small" min={1} max={100000} defaultValue={3} onChange={onChange} /> <InputNumber size="small" min={1} max={100000} defaultValue={3} onChange={onChange} />

View File

@ -46,7 +46,7 @@ ul.anticons-list {
} }
} }
&.outlined:hover { &.twotone:hover {
background-color: #8ecafe; background-color: #8ecafe;
} }
@ -81,3 +81,12 @@ ul.anticons-list {
background: #f5f5f5; background: #f5f5f5;
border-radius: 2px; border-radius: 2px;
} }
[data-theme='dark'] ul.anticons-list {
li {
color: #acacac;
&.twotone:hover {
background-color: #15395b;
}
}
}

View File

@ -2,11 +2,13 @@ import * as React from 'react';
import { message } from 'antd'; import { message } from 'antd';
import { injectIntl } from 'react-intl'; import { injectIntl } from 'react-intl';
import CopyableIcon from './CopyableIcon'; import CopyableIcon from './CopyableIcon';
import { ThemeType } from './index';
import { CategoriesKeys } from './fields'; import { CategoriesKeys } from './fields';
interface CategoryProps { interface CategoryProps {
title: CategoriesKeys; title: CategoriesKeys;
icons: string[]; icons: string[];
theme: ThemeType;
newIcons: string[]; newIcons: string[];
intl: any; intl: any;
} }
@ -44,6 +46,7 @@ class Category extends React.Component<CategoryProps, CategoryState> {
icons, icons,
title, title,
newIcons, newIcons,
theme,
intl: { messages }, intl: { messages },
} = this.props; } = this.props;
const items = icons.map(name => { const items = icons.map(name => {
@ -51,6 +54,7 @@ class Category extends React.Component<CategoryProps, CategoryState> {
<CopyableIcon <CopyableIcon
key={name} key={name}
name={name} name={name}
theme={theme}
isNew={newIcons.indexOf(name) >= 0} isNew={newIcons.indexOf(name) >= 0}
justCopied={this.state.justCopied} justCopied={this.state.justCopied}
onCopied={this.onCopied} onCopied={this.onCopied}

View File

@ -3,6 +3,7 @@ import CopyToClipboard from 'react-copy-to-clipboard';
import { Badge } from 'antd'; import { Badge } from 'antd';
import classNames from 'classnames'; import classNames from 'classnames';
import * as AntdIcons from '@ant-design/icons'; import * as AntdIcons from '@ant-design/icons';
import { ThemeType } from './index';
const allIcons: { const allIcons: {
[key: string]: any; [key: string]: any;
@ -11,13 +12,21 @@ const allIcons: {
export interface CopyableIconProps { export interface CopyableIconProps {
name: string; name: string;
isNew: boolean; isNew: boolean;
theme: ThemeType;
justCopied: string | null; justCopied: string | null;
onCopied: (type: string, text: string) => any; onCopied: (type: string, text: string) => any;
} }
const CopyableIcon: React.SFC<CopyableIconProps> = ({ name, isNew, justCopied, onCopied }) => { const CopyableIcon: React.SFC<CopyableIconProps> = ({
name,
isNew,
justCopied,
onCopied,
theme,
}) => {
const className = classNames({ const className = classNames({
copied: justCopied === name, copied: justCopied === name,
[theme]: !!theme,
}); });
return ( return (
<CopyToClipboard text={`<${name} />`} onCopy={(text: string) => onCopied(name, text)}> <CopyToClipboard text={`<${name} />`} onCopy={(text: string) => onCopied(name, text)}>

View File

@ -9,7 +9,7 @@ import IconPicSearcher from './IconPicSearcher';
import { FilledIcon, OutlinedIcon, TwoToneIcon } from './themeIcons'; import { FilledIcon, OutlinedIcon, TwoToneIcon } from './themeIcons';
import { categories, Categories, CategoriesKeys } from './fields'; import { categories, Categories, CategoriesKeys } from './fields';
type ThemeType = 'filled' | 'outlined' | 'twoTone'; export type ThemeType = 'filled' | 'outlined' | 'twoTone';
const allIcons: { const allIcons: {
[key: string]: any; [key: string]: any;
@ -84,6 +84,7 @@ class IconDisplay extends React.Component<IconDisplayProps, IconDisplayState> {
<Category <Category
key={category} key={category}
title={category} title={category}
theme={theme}
icons={icons} icons={icons}
newIcons={IconDisplay.newIconNames} newIcons={IconDisplay.newIconNames}
/> />