feat: use inner icon to replace back-top background-img (#24397)

* feat: use inner icon to  replace back-top background-img

* chore: update snapshots
This commit is contained in:
zefeng 2020-05-22 17:03:30 +08:00 committed by GitHub
parent 254c17e320
commit baf001898d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 138 additions and 12 deletions

View File

@ -3,6 +3,7 @@ import Animate from 'rc-animate';
import addEventListener from 'rc-util/lib/Dom/addEventListener'; import addEventListener from 'rc-util/lib/Dom/addEventListener';
import classNames from 'classnames'; import classNames from 'classnames';
import omit from 'omit.js'; import omit from 'omit.js';
import VerticalAlignTopOutlined from '@ant-design/icons/VerticalAlignTopOutlined';
import throttleByAnimationFrame from '../_util/throttleByAnimationFrame'; import throttleByAnimationFrame from '../_util/throttleByAnimationFrame';
import { ConfigContext } from '../config-provider'; import { ConfigContext } from '../config-provider';
import getScroll from '../_util/getScroll'; import getScroll from '../_util/getScroll';
@ -80,7 +81,9 @@ const BackTop: React.FC<BackTopProps> = props => {
const { children } = props; const { children } = props;
const defaultElement = ( const defaultElement = (
<div className={`${prefixCls}-content`}> <div className={`${prefixCls}-content`}>
<div className={`${prefixCls}-icon`} /> <div className={`${prefixCls}-icon`}>
<VerticalAlignTopOutlined />
</div>
</div> </div>
); );
return ( return (

View File

@ -37,11 +37,8 @@
} }
&-icon { &-icon {
width: 14px; font-size: 24px;
height: 16px; line-height: 40px;
margin: 12px auto;
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAoCAYAAACWwljjAAAABGdBTUEAALGPC/xhBQAAAbtJREFUWAntmMtKw0AUhhMvS5cuxILgQlRUpIggIoKIIoigG1eC+AA+jo+i6FIXBfeuXIgoeKVeitVWJX5HWhhDksnUpp3FDPyZk3Nm5nycmZKkXhAEOXSA3lG7muTeRzmfy6HneUvIhnYkQK+Q9NhAA0Opg0vBEhjBKHiyb8iGMyQMOYuK41BcBSypAL+MYXSKjtFAW7EAGEO3qN4uMQbbAkXiSfRQJ1H6a+yhlkKRcAoVFYiweYNjtCVQJJpBz2GCiPt7fBOZQpFgDpUikse5HgnkM4Fi4QX0Fpc5wf9EbLqpUCy4jMoJSXWhFwbMNgWKhVbRhy5jirhs9fy/oFhgHVVTJEs7RLZ8sSEoJm6iz7SZDMbJ+/OKERQTttCXQRLToRUmrKWCYuA2+jbN0MB4OQobYShfdTCgn/sL1K36M7TLrN3n+758aPy2rrpR6+/od5E8tf/A1uLS9aId5T7J3CNYihkQ4D9PiMdMC7mp4rjB9kjFjZp8BlnVHJBuO1yFXIV0FdDF3RlyFdJVQBdv5AxVdIsq8apiZ2PyYO1EVykesGfZEESsCkweyR8MUW+V8uJ1gkYipmpdP1pm2aJVPEGzAAAAAElFTkSuQmCC)
~'100%/100%' no-repeat;
} }
} }

View File

@ -562,7 +562,28 @@ exports[`ConfigProvider components BackTop configProvider 1`] = `
> >
<div <div
class="config-back-top-icon" class="config-back-top-icon"
>
<span
aria-label="vertical-align-top"
class="anticon anticon-vertical-align-top"
role="img"
>
<svg
aria-hidden="true"
class=""
data-icon="vertical-align-top"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M859.9 168H164.1c-4.5 0-8.1 3.6-8.1 8v60c0 4.4 3.6 8 8.1 8h695.8c4.5 0 8.1-3.6 8.1-8v-60c0-4.4-3.6-8-8.1-8zM518.3 355a8 8 0 00-12.6 0l-112 141.7a7.98 7.98 0 006.3 12.9h73.9V848c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V509.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 355z"
/> />
</svg>
</span>
</div>
</div> </div>
</div> </div>
</div> </div>
@ -578,7 +599,28 @@ exports[`ConfigProvider components BackTop configProvider componentSize large 1`
> >
<div <div
class="config-back-top-icon" class="config-back-top-icon"
>
<span
aria-label="vertical-align-top"
class="anticon anticon-vertical-align-top"
role="img"
>
<svg
aria-hidden="true"
class=""
data-icon="vertical-align-top"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M859.9 168H164.1c-4.5 0-8.1 3.6-8.1 8v60c0 4.4 3.6 8 8.1 8h695.8c4.5 0 8.1-3.6 8.1-8v-60c0-4.4-3.6-8-8.1-8zM518.3 355a8 8 0 00-12.6 0l-112 141.7a7.98 7.98 0 006.3 12.9h73.9V848c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V509.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 355z"
/> />
</svg>
</span>
</div>
</div> </div>
</div> </div>
</div> </div>
@ -594,7 +636,28 @@ exports[`ConfigProvider components BackTop configProvider componentSize middle 1
> >
<div <div
class="config-back-top-icon" class="config-back-top-icon"
>
<span
aria-label="vertical-align-top"
class="anticon anticon-vertical-align-top"
role="img"
>
<svg
aria-hidden="true"
class=""
data-icon="vertical-align-top"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M859.9 168H164.1c-4.5 0-8.1 3.6-8.1 8v60c0 4.4 3.6 8 8.1 8h695.8c4.5 0 8.1-3.6 8.1-8v-60c0-4.4-3.6-8-8.1-8zM518.3 355a8 8 0 00-12.6 0l-112 141.7a7.98 7.98 0 006.3 12.9h73.9V848c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V509.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 355z"
/> />
</svg>
</span>
</div>
</div> </div>
</div> </div>
</div> </div>
@ -610,7 +673,28 @@ exports[`ConfigProvider components BackTop configProvider virtual and dropdownMa
> >
<div <div
class="ant-back-top-icon" class="ant-back-top-icon"
>
<span
aria-label="vertical-align-top"
class="anticon anticon-vertical-align-top"
role="img"
>
<svg
aria-hidden="true"
class=""
data-icon="vertical-align-top"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M859.9 168H164.1c-4.5 0-8.1 3.6-8.1 8v60c0 4.4 3.6 8 8.1 8h695.8c4.5 0 8.1-3.6 8.1-8v-60c0-4.4-3.6-8-8.1-8zM518.3 355a8 8 0 00-12.6 0l-112 141.7a7.98 7.98 0 006.3 12.9h73.9V848c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V509.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 355z"
/> />
</svg>
</span>
</div>
</div> </div>
</div> </div>
</div> </div>
@ -626,7 +710,28 @@ exports[`ConfigProvider components BackTop normal 1`] = `
> >
<div <div
class="ant-back-top-icon" class="ant-back-top-icon"
>
<span
aria-label="vertical-align-top"
class="anticon anticon-vertical-align-top"
role="img"
>
<svg
aria-hidden="true"
class=""
data-icon="vertical-align-top"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M859.9 168H164.1c-4.5 0-8.1 3.6-8.1 8v60c0 4.4 3.6 8 8.1 8h695.8c4.5 0 8.1-3.6 8.1-8v-60c0-4.4-3.6-8-8.1-8zM518.3 355a8 8 0 00-12.6 0l-112 141.7a7.98 7.98 0 006.3 12.9h73.9V848c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V509.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 355z"
/> />
</svg>
</span>
</div>
</div> </div>
</div> </div>
</div> </div>
@ -642,7 +747,28 @@ exports[`ConfigProvider components BackTop prefixCls 1`] = `
> >
<div <div
class="prefix-BackTop-icon" class="prefix-BackTop-icon"
>
<span
aria-label="vertical-align-top"
class="anticon anticon-vertical-align-top"
role="img"
>
<svg
aria-hidden="true"
class=""
data-icon="vertical-align-top"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M859.9 168H164.1c-4.5 0-8.1 3.6-8.1 8v60c0 4.4 3.6 8 8.1 8h695.8c4.5 0 8.1-3.6 8.1-8v-60c0-4.4-3.6-8-8.1-8zM518.3 355a8 8 0 00-12.6 0l-112 141.7a7.98 7.98 0 006.3 12.9h73.9V848c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V509.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 355z"
/> />
</svg>
</span>
</div>
</div> </div>
</div> </div>
</div> </div>