Skip to content

Commit

Permalink
Merge pull request #827 from GaviXi/master
Browse files Browse the repository at this point in the history
back-top 1.0.3 and improve back-top in site
  • Loading branch information
dntzhang committed Sep 1, 2023
2 parents a7b8e5a + efa3220 commit 6ee05ea
Show file tree
Hide file tree
Showing 10 changed files with 403 additions and 13 deletions.
31 changes: 29 additions & 2 deletions tdesign/desktop/site/src/components/web/back-top/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import '../common/index'
import '../../../../../src/back-top/_example/back-top-base'
import '../../../../../src/back-top/_example/back-top-duration'
import '../../../../../src/back-top/_example/back-top-size'
import '../../../../../src/back-top/_example/back-top-shape'
import '../../../../../src/back-top/_example/back-top-theme'
import '../../../../../src/back-top/_example/back-top-custom'

import * as marked from 'marked'

Expand Down Expand Up @@ -80,13 +83,14 @@ define(
this.updateTab(currentTab)
}
}


render() {
return (
<>
<td-doc-tabs ref={this.tdDocTabs} tab={this.props.tab} style="display:block"></td-doc-tabs>
<div style={this.isShow('demo')} name="DEMO">
{/* <h3 id="基础的回到顶部">
<h3 id="基础的回到顶部">
基础的回到顶部 <a class="header-anchor" href="#基础的回到顶部"></a>
</h3>
<p>默认距离页面右侧24px,距离页面底部80px,滚动动画时长200ms</p>
Expand All @@ -99,15 +103,38 @@ define(
</h3>
<demo-wrapper>
<back-top-duration></back-top-duration>
</demo-wrapper> */}
</demo-wrapper>

<h3 id="不同组件尺寸的回到顶部">
不同组件尺寸的回到顶部 <a class="header-anchor" href="#不同组件尺寸的回到顶部"></a>
</h3>
<demo-wrapper>
<back-top-size></back-top-size>
</demo-wrapper>

<h3 id="不同组件主题的回到顶部">
不同组件形状的回到顶部 <a class="header-anchor" href="#不同组件形状的回到顶部"></a>
</h3>
<p>不同组件形状的回到顶部</p>
<demo-wrapper>
<back-top-shape></back-top-shape>
</demo-wrapper>

<h3 id="不同组件主题的回到顶部">
不同组件主题的回到顶部 <a class="header-anchor" href="#不同组件主题的回到顶部"></a>
</h3>
<demo-wrapper>
<back-top-theme></back-top-theme>
</demo-wrapper>

<h3 id="可自定义内容的回到顶部">
可自定义内容的回到顶部 <a class="header-anchor" href="#可自定义内容的回到顶部"></a>
</h3>
<demo-wrapper>
<back-top-custom></back-top-custom>
</demo-wrapper>
</div>

<div style={this.isShow('api')} name="API">
<div
style="margin-bottom:76px"
Expand Down
61 changes: 61 additions & 0 deletions tdesign/desktop/src/back-top/_example/back-top-custom.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import { OmiProps, WeElement, h, tag, classNames, render, createRef } from 'omi'

import '../index'

import '../../space'

@tag('back-top-custom')
export default class backTopCustom extends WeElement {
height = 300

// scrollCss =
// `.t-list{
// height: ` +
// this.height +
// `px !important;
// overflow: auto,
// }`

// sizeStyle = {
// position: 'relative',
// insetInlineEnd: 0,
// insetBlockEnd: 0,
// }

withStyle = `
.t-back-top{
position: relative !important;
right: 0 !important;
bottom: 0 !important;
}
`
render() {
return (
<h.f>
<div style="position: relative; ">
<t-space direction="vertical">
<t-space>
<t-back-top
css={this.withStyle}
visibleHeight={0}
container={() => document}
/>
<t-back-top
css={this.withStyle}
visibleHeight={0}
default={<span>TOP</span>}
container={() => document}
/>
<t-back-top
css={this.withStyle}
visibleHeight={0}
content={<span>UP</span>}
container={() => document}
/>
</t-space>
</t-space>
</div>
</h.f>
)
}
}
97 changes: 97 additions & 0 deletions tdesign/desktop/src/back-top/_example/back-top-shape.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
import { OmiProps, WeElement, h, tag, classNames, render, createRef } from 'omi'

import '../index'

import '../../space'

@tag('back-top-shape')
export default class backTopShape extends WeElement {
height = 300

// scrollCss =
// `.t-list{
// height: ` +
// this.height +
// `px !important;
// overflow: auto,
// }`

// sizeStyle = {
// position: 'relative',
// insetInlineEnd: 0,
// insetBlockEnd: 0,
// }

withStyle = `
.t-back-top{
position: relative !important;
right: 0 !important;
bottom: 0 !important;
}
`
render() {
return (
<h.f>
<div style="position: relative;">
<t-space direction="vertical">
<t-space size={24}>
<t-back-top
css={this.withStyle}
visibleHeight={0}
shape="circle"
size="medium"
// offset={['400px', '316px']}
container={() => document}
/>
<t-back-top
css={this.withStyle}
visibleHeight={0}
size="medium"
// offset={['300px', '300px']}
container={() => document}
/>
</t-space>
<t-space size={24}>
<t-back-top
css={this.withStyle}
visibleHeight={0}
size="medium"
shape="circle"
theme="primary"
// offset={['400px', '316px']}
container={() => document}
/>
<t-back-top
css={this.withStyle}
visibleHeight={0}
size="medium"
theme="primary"
// offset={['300px', '300px']}
container={() => document}
/>
</t-space>
<t-space size={24}>
<t-back-top
css={this.withStyle}
visibleHeight={0}
size="medium"
shape="circle"
theme="dark"
// offset={['400px', '316px']}
container={() => document}
/>
<t-back-top
css={this.withStyle}
visibleHeight={0}
size="medium"
theme="dark"
// offset={['300px', '300px']}
container={() => document}
/>
</t-space>
</t-space>
</div>
</h.f>
)
}
}
2 changes: 1 addition & 1 deletion tdesign/desktop/src/back-top/_example/back-top-size.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default class backTopSize extends WeElement {
render() {
return (
<h.f>
<div style="position: relative; min-height:400px">
<div style="position: relative;">
<t-space direction="vertical">
<t-space size={24}>
<t-back-top
Expand Down
136 changes: 136 additions & 0 deletions tdesign/desktop/src/back-top/_example/back-top-theme.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
import { OmiProps, WeElement, h, tag, classNames, render, createRef } from 'omi'

import '../index'

import '../../space'

@tag('back-top-theme')
export default class backTopTheme extends WeElement {
height = 300

// scrollCss =
// `.t-list{
// height: ` +
// this.height +
// `px !important;
// overflow: auto,
// }`

// sizeStyle = {
// position: 'relative',
// insetInlineEnd: 0,
// insetBlockEnd: 0,
// }

withStyle = `
.t-back-top{
position: relative !important;
right: 0 !important;
bottom: 0 !important;
}
`
render() {
return (
<h.f>
<div style="position: relative; ">
<t-space direction="vertical">
<t-space>
<t-back-top
css={this.withStyle}
visibleHeight={0}
size="medium"
container={() => document}
/>
<t-back-top
css={this.withStyle}
visibleHeight={0}
size="medium"
theme='primary'
container={() => document}
/>
<t-back-top
css={this.withStyle}
visibleHeight={0}
size="medium"
theme='dark'
container={() => document}
/>
</t-space>
<t-space>
<t-back-top
css={this.withStyle}
visibleHeight={0}
size="medium"
shape="circle"
container={() => document}
/>
<t-back-top
css={this.withStyle}
visibleHeight={0}
size="medium"
shape="circle"
theme='primary'
container={() => document}
/>
<t-back-top
css={this.withStyle}
visibleHeight={0}
size="medium"
shape="circle"
theme='dark'
container={() => document}
/>
</t-space>
<t-space>
<t-back-top
css={this.withStyle}
visibleHeight={0}
size="small"
container={() => document}
/>
<t-back-top
css={this.withStyle}
visibleHeight={0}
size="small"
theme="primary"
container={() => document}
/>
<t-back-top
css={this.withStyle}
visibleHeight={0}
size="small"
theme="dark"
container={() => document}
/>
</t-space>
<t-space>
<t-back-top
css={this.withStyle}
visibleHeight={0}
size="small"
shape="circle"
container={() => document}
/>
<t-back-top
css={this.withStyle}
visibleHeight={0}
size="small"
theme="primary"
shape="circle"
container={() => document}
/>
<t-back-top
css={this.withStyle}
visibleHeight={0}
size="small"
theme="dark"
shape="circle"
container={() => document}
/>
</t-space>
</t-space>
</div>
</h.f>
)
}
}
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 6ee05ea

Please sign in to comment.