From 71d28ced785942fd06ab6546aed70e19b281f6be Mon Sep 17 00:00:00 2001 From: 2betop <2betop.cn@gmail.com> Date: Mon, 8 Jun 2020 17:13:54 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=BF=E6=8D=A2=20svg=20icon?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scss/_variables.scss | 3 --- scss/components/form/_picker.scss | 9 --------- src/components/icons.tsx | 8 ++++++++ src/icons/question.svg | 7 +++++++ src/icons/window-restore.svg | 7 +++++++ src/renderers/Form/Picker.tsx | 4 +++- src/renderers/Remark.tsx | 11 +++++++++-- 7 files changed, 34 insertions(+), 15 deletions(-) create mode 100644 src/icons/question.svg create mode 100644 src/icons/window-restore.svg diff --git a/scss/_variables.scss b/scss/_variables.scss index b0cb1596..ee37e8c2 100644 --- a/scss/_variables.scss +++ b/scss/_variables.scss @@ -1482,6 +1482,3 @@ $Carousel-imageDescription-bottom: px2rem(25px) !default; // Picker $Picker-iconColor: $icon-color !default; $Picker-onHover-iconColor: $icon-onHover-color !default; -$Picker-btn-vendor: 'FontAwesome' !default; -$Picker-btn-fontSize: $Form-fontSize !default; -$Picker-btn-icon: '\f2d2' !default; diff --git a/scss/components/form/_picker.scss b/scss/components/form/_picker.scss index 79d3dd7e..6f0be737 100644 --- a/scss/components/form/_picker.scss +++ b/scss/components/form/_picker.scss @@ -85,15 +85,6 @@ &:hover { color: $Picker-onHover-iconColor; } - - &:before { - line-height: 1; - color: inherit; - content: $Picker-btn-icon; - display: inline-block; - font-size: $Picker-btn-fontSize; - font-family: $Picker-btn-vendor; - } } &-clear { diff --git a/src/components/icons.tsx b/src/components/icons.tsx index 57d67b89..f6733582 100644 --- a/src/components/icons.tsx +++ b/src/components/icons.tsx @@ -95,6 +95,12 @@ import ZoomInIcon from '../icons/zoom-in.svg'; // @ts-ignore import ZoomOutIcon from '../icons/zoom-out.svg'; +// @ts-ignore +import QuestionIcon from '../icons/question.svg'; + +// @ts-ignore +import WindowRestoreIcon from '../icons/window-restore.svg'; + // 兼容原来的用法,后续不直接试用。 // @ts-ignore export const closeIcon = ; @@ -169,6 +175,8 @@ registerIcon('column-filter', ColumnFilterIcon); registerIcon('caret', CaretIcon); registerIcon('zoom-in', ZoomInIcon); registerIcon('zoom-out', ZoomOutIcon); +registerIcon('question', QuestionIcon); +registerIcon('window-restore', WindowRestoreIcon); export function Icon({ icon, diff --git a/src/icons/question.svg b/src/icons/question.svg new file mode 100644 index 00000000..7c49c34b --- /dev/null +++ b/src/icons/question.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/src/icons/window-restore.svg b/src/icons/window-restore.svg new file mode 100644 index 00000000..f4237930 --- /dev/null +++ b/src/icons/window-restore.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/src/renderers/Form/Picker.tsx b/src/renderers/Form/Picker.tsx index 9ec1d869..43367e7e 100644 --- a/src/renderers/Form/Picker.tsx +++ b/src/renderers/Form/Picker.tsx @@ -424,7 +424,9 @@ export default class PickerControl extends React.PureComponent< ) : null} - + + + {render( diff --git a/src/renderers/Remark.tsx b/src/renderers/Remark.tsx index 596ceda8..7736691e 100644 --- a/src/renderers/Remark.tsx +++ b/src/renderers/Remark.tsx @@ -5,6 +5,7 @@ import cx from 'classnames'; import TooltipWrapper from '../components/TooltipWrapper'; import {filter} from '../utils/tpl'; import {themeable} from '../theme'; +import {Icon} from '../components/icons'; export function filterContents( tooltip: @@ -43,7 +44,7 @@ type RemarkProps = { class Remark extends React.Component { static propsList: Array = []; static defaultProps = { - icon: 'fa fa-question-circle', + icon: '', trigger: ['hover', 'focus'] }; @@ -62,6 +63,8 @@ class Remark extends React.Component { data } = this.props; + const finalIcon = (tooltip && tooltip.icon) || icon; + return (
{ container={container} delay={tooltip && tooltip.delay} > - + {finalIcon ? ( + + ) : ( + + )}
);