diff --git a/site/mobile/mobile.config.js b/site/mobile/mobile.config.js index 493095c6..9866172b 100644 --- a/site/mobile/mobile.config.js +++ b/site/mobile/mobile.config.js @@ -105,7 +105,7 @@ export default { { title: 'Sticky 吸顶', name: 'sticky', - component: () => import('tdesign-mobile-react/sticky/_example/index.jsx'), + component: () => import('tdesign-mobile-react/sticky/_example/index.tsx'), }, { title: 'BackTop 返回顶部', diff --git a/src/sticky/_example/base.jsx b/src/sticky/_example/base.tsx similarity index 100% rename from src/sticky/_example/base.jsx rename to src/sticky/_example/base.tsx diff --git a/src/sticky/_example/container.jsx b/src/sticky/_example/container.tsx similarity index 100% rename from src/sticky/_example/container.jsx rename to src/sticky/_example/container.tsx diff --git a/src/sticky/_example/index.jsx b/src/sticky/_example/index.tsx similarity index 88% rename from src/sticky/_example/index.jsx rename to src/sticky/_example/index.tsx index 1eead7d6..8ed2d521 100644 --- a/src/sticky/_example/index.jsx +++ b/src/sticky/_example/index.tsx @@ -4,7 +4,7 @@ import TDemoHeader from '../../../site/mobile/components/DemoHeader'; import './style/index.less'; import BaseDemo from './base'; -import OffsetTopDemo from './offsetTop'; +import OffsetTopDemo from './offset'; import ContainerDemo from './container'; export default function Base() { @@ -12,7 +12,7 @@ export default function Base() {
- + diff --git a/src/sticky/_example/offsetTop.jsx b/src/sticky/_example/offset.tsx similarity index 100% rename from src/sticky/_example/offsetTop.jsx rename to src/sticky/_example/offset.tsx diff --git a/src/sticky/sticky.en-US.md b/src/sticky/sticky.en-US.md new file mode 100644 index 00000000..f5ec663d --- /dev/null +++ b/src/sticky/sticky.en-US.md @@ -0,0 +1,16 @@ +:: BASE_DOC :: + +## API + + +### Sticky Props + +name | type | default | description | required +-- | -- | -- | -- | -- +className | String | - | className of component | N +style | Object | - | CSS(Cascading Style Sheets),Typescript:`React.CSSProperties` | N +container | String / Function | body | Typescript:`ScrollContainer`。[see more ts definition](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N +disabled | Boolean | false | \- | N +offsetTop | String / Number | 0 | \- | N +zIndex | Number | 99 | \- | N +onScroll | Function | | Typescript:`(context: { scrollTop: number, isFixed: boolean }) => void`
Typescript:`TNode`。[see more ts definition](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N diff --git a/src/sticky/sticky.md b/src/sticky/sticky.md index ce2f3b81..3405914f 100644 --- a/src/sticky/sticky.md +++ b/src/sticky/sticky.md @@ -1,13 +1,14 @@ :: BASE_DOC :: ## API + ### Sticky Props -名称 | 类型 | 默认值 | 说明 | 必传 +名称 | 类型 | 默认值 | 描述 | 必传 -- | -- | -- | -- | -- className | String | - | 类名 | N style | Object | - | 样式,TS 类型:`React.CSSProperties` | N -container | String / Function | body | 指定滚动的容器。数据类型为 String 时,会被当作选择器处理,进行节点查询。示例:'body' 或 () => document.body。TS 类型:`ScrollContainer` | N +container | String / Function | body | 指定滚动的容器。数据类型为 String 时,会被当作选择器处理,进行节点查询。示例:'body' 或 () => document.body。TS 类型:`ScrollContainer`。[通用类型定义](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N disabled | Boolean | false | 是否禁用组件 | N offsetTop | String / Number | 0 | 吸顶时与顶部的距离,单位`px` | N zIndex | Number | 99 | 吸顶时的 z-index | N diff --git a/src/sticky/style/index.js b/src/sticky/style/index.js index f75b026a..531cf765 100644 --- a/src/sticky/style/index.js +++ b/src/sticky/style/index.js @@ -1 +1 @@ -import '../../_common/style/mobile/components/sticky/_index.less'; +import '../../_common/style/mobile/components/sticky/_index.less'; \ No newline at end of file diff --git a/test/snap/__snapshots__/csr.test.jsx.snap b/test/snap/__snapshots__/csr.test.jsx.snap index 1e001f13..398dbb5d 100644 --- a/test/snap/__snapshots__/csr.test.jsx.snap +++ b/test/snap/__snapshots__/csr.test.jsx.snap @@ -2697,6 +2697,251 @@ exports[`csr snapshot test > csr test src/result/_example/theme.tsx 1`] = `
`; +exports[`csr snapshot test > csr test src/sticky/_example/base.tsx 1`] = ` +
+
+
+
+ +
+
+
+
+`; + +exports[`csr snapshot test > csr test src/sticky/_example/container.tsx 1`] = ` +
+
+
+
+ +
+
+
+
+`; + +exports[`csr snapshot test > csr test src/sticky/_example/index.tsx 1`] = ` +
+
+
+

+ Sticky 吸顶 +

+

+ 用于常驻页面顶部的信息,操作展示 +

+
+
+
+
+

+ 基础吸顶 +

+
+
+
+
+
+ +
+
+
+
+
+
+
+

+ 吸顶距离 +

+
+
+
+
+
+ +
+
+
+
+
+
+
+

+ 指定容器 +

+
+
+
+
+
+ +
+
+
+
+
+
+
+
+`; + +exports[`csr snapshot test > csr test src/sticky/_example/offset.tsx 1`] = ` +
+
+
+
+ +
+
+
+
+`; + exports[`ssr snapshot test > ssr test src/back-top/_example/base.tsx 1`] = `"
"`; exports[`ssr snapshot test > ssr test src/back-top/_example/index.tsx 1`] = `"

BackTop 返回顶部

当页面过长往下滑动是会出现返回顶部的便捷操作,帮助用户快速回到页面顶部

形状

"`; @@ -2728,3 +2973,11 @@ exports[`ssr snapshot test > ssr test src/result/_example/custom.tsx 1`] = `" ssr test src/result/_example/index.tsx 1`] = `"

Result 结果

结果反馈

01类型

不同结果反馈

成功状态
描述文字
失败状态
描述文字
警示状态
描述文字
默认状态
描述文字

自定义结果

自定义结果
描述文字

页面位置展示

"`; exports[`ssr snapshot test > ssr test src/result/_example/theme.tsx 1`] = `"
成功状态
描述文字
失败状态
描述文字
警示状态
描述文字
默认状态
描述文字
"`; + +exports[`ssr snapshot test > ssr test src/sticky/_example/base.tsx 1`] = `"
"`; + +exports[`ssr snapshot test > ssr test src/sticky/_example/container.tsx 1`] = `"
"`; + +exports[`ssr snapshot test > ssr test src/sticky/_example/index.tsx 1`] = `"

Sticky 吸顶

用于常驻页面顶部的信息,操作展示

基础吸顶

吸顶距离

指定容器

"`; + +exports[`ssr snapshot test > ssr test src/sticky/_example/offset.tsx 1`] = `"
"`; diff --git a/test/snap/__snapshots__/ssr.test.jsx.snap b/test/snap/__snapshots__/ssr.test.jsx.snap index c889b0a4..b83c70c8 100644 --- a/test/snap/__snapshots__/ssr.test.jsx.snap +++ b/test/snap/__snapshots__/ssr.test.jsx.snap @@ -31,3 +31,11 @@ exports[`ssr snapshot test > ssr test src/result/_example/custom.tsx 1`] = `" ssr test src/result/_example/index.tsx 1`] = `"

Result 结果

结果反馈

01类型

不同结果反馈

成功状态
描述文字
失败状态
描述文字
警示状态
描述文字
默认状态
描述文字

自定义结果

自定义结果
描述文字

页面位置展示

"`; exports[`ssr snapshot test > ssr test src/result/_example/theme.tsx 1`] = `"
成功状态
描述文字
失败状态
描述文字
警示状态
描述文字
默认状态
描述文字
"`; + +exports[`ssr snapshot test > ssr test src/sticky/_example/base.tsx 1`] = `"
"`; + +exports[`ssr snapshot test > ssr test src/sticky/_example/container.tsx 1`] = `"
"`; + +exports[`ssr snapshot test > ssr test src/sticky/_example/index.tsx 1`] = `"

Sticky 吸顶

用于常驻页面顶部的信息,操作展示

基础吸顶

吸顶距离

指定容器

"`; + +exports[`ssr snapshot test > ssr test src/sticky/_example/offset.tsx 1`] = `"
"`;