Skip to content

Commit

Permalink
feat: all layout and 2 nav coms
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex-huxiyang committed Jan 9, 2025
1 parent 9a720ee commit c6abb10
Show file tree
Hide file tree
Showing 33 changed files with 737 additions and 319 deletions.
436 changes: 357 additions & 79 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

13 changes: 10 additions & 3 deletions src/packages/backtop/demos/h5/demo1.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
import React from 'react'
import { BackTop, Cell } from '@nutui/nutui-react'
import { withTranslation, propsType } from '@/translation/demo.translation'

const Demo1 = () => {
const Demo1 = ({ t }: propsType) => {
return (
<>
{new Array(24).fill(0).map((_, index) => {
return <Cell key={index}>我是测试数据{index}</Cell>
return (
<Cell key={index}>
{t.testData}
{index}
</Cell>
)
})}
<BackTop target="target" />
</>
)
}
export default Demo1

export default withTranslation(Demo1)
13 changes: 10 additions & 3 deletions src/packages/backtop/demos/h5/demo2.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
import React from 'react'
import { BackTop, Cell } from '@nutui/nutui-react'
import { withTranslation, propsType } from '@/translation/demo.translation'

const Demo2 = () => {
const Demo2 = ({ t }: propsType) => {
return (
<>
{new Array(24).fill(0).map((_, index) => {
return <Cell key={index}>我是测试数据{index}</Cell>
return (
<Cell key={index}>
{t.testData}
{index}
</Cell>
)
})}
<BackTop target="target" threshold={200} />
</>
)
}
export default Demo2

export default withTranslation(Demo2)
15 changes: 11 additions & 4 deletions src/packages/backtop/demos/h5/demo3.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
import React from 'react'
import { Top } from '@nutui/icons-react'
import { BackTop, Cell } from '@nutui/nutui-react'
import { withTranslation, propsType } from '@/translation/demo.translation'

const Demo3 = () => {
const Demo3 = ({ t }: propsType) => {
return (
<>
{new Array(24).fill(0).map((_, index) => {
return <Cell key={index}>我是测试数据{index}</Cell>
return (
<Cell key={index}>
{t.testData}
{index}
</Cell>
)
})}
<BackTop threshold={100} target="target">
<Top width={12} height={12} />
<div style={{ fontSize: '12px' }}>顶部</div>
<div style={{ fontSize: '12px' }}>{t.top}</div>
</BackTop>
</>
)
}
export default Demo3

export default withTranslation(Demo3)
13 changes: 10 additions & 3 deletions src/packages/backtop/demos/h5/demo4.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
import React from 'react'
import { BackTop, Cell } from '@nutui/nutui-react'
import { withTranslation, propsType } from '@/translation/demo.translation'

const Demo4 = () => {
const Demo4 = ({ t }: propsType) => {
return (
<div id="target2" style={{ height: '800px', overflowY: 'auto' }}>
{new Array(24).fill(0).map((_, index) => {
return <Cell key={index}>我是测试数据{index}</Cell>
return (
<Cell key={index}>
{t.testData}
{index}
</Cell>
)
})}
<BackTop target="target2" threshold={100} />
</div>
)
}
export default Demo4

export default withTranslation(Demo4)
14 changes: 11 additions & 3 deletions src/packages/backtop/demos/h5/demo5.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
import React from 'react'
import { BackTop, Cell } from '@nutui/nutui-react'
import { withTranslation, propsType } from '@/translation/demo.translation'

const Demo5 = () => {
const Demo5 = ({ t }: propsType) => {
const handleClick = () => {
const ele = document.getElementsByClassName('backtop-button')[0]
}

return (
<>
{new Array(24).fill(0).map((_, index) => {
return <Cell key={index}>我是测试数据{index}</Cell>
return (
<Cell key={index}>
{t.testData}
{index}
</Cell>
)
})}
<BackTop
onClick={() => {
Expand All @@ -20,4 +27,5 @@ const Demo5 = () => {
</>
)
}
export default Demo5

export default withTranslation(Demo5)
26 changes: 15 additions & 11 deletions src/packages/elevator/demos/h5/demo1.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import React from 'react'
import { Elevator } from '@nutui/nutui-react'
import { withTranslation, propsType } from '@/translation/demo.translation'

const Demo1 = () => {
const Demo1 = ({ t }: propsType) => {
const dataList = [
{
title: 'A',
list: [
{
name: '安徽',
name: t.anhui,
id: 1,
},
],
Expand All @@ -16,7 +17,7 @@ const Demo1 = () => {
title: 'B',
list: [
{
name: '北京',
name: t.beijing,
id: 2,
},
],
Expand All @@ -25,11 +26,11 @@ const Demo1 = () => {
title: 'G',
list: [
{
name: '广西',
name: t.guangxi,
id: 3,
},
{
name: '广东',
name: t.guangdong,
id: 4,
},
],
Expand All @@ -38,34 +39,37 @@ const Demo1 = () => {
title: 'H',
list: [
{
name: '湖南',
name: t.hunan,
id: 5,
},
{
name: '湖北',
name: t.hubei,
id: 6,
},
{
name: '河南',
name: t.henan,
id: 7,
},
],
},
]

const onItemClick = (key: string, item: any) => {
console.log(key, JSON.stringify(item))
}

const onIndexClick = (key: string) => {
console.log(key)
}

return (
<Elevator
list={dataList}
height="260"
onItemClick={(key: string, item: any) => onItemClick(key, item)}
onIndexClick={(key: string) => onIndexClick(key)}
onItemClick={onItemClick}
onIndexClick={onIndexClick}
/>
)
}
export default Demo1

export default withTranslation(Demo1)
54 changes: 29 additions & 25 deletions src/packages/elevator/demos/h5/demo2.tsx
Original file line number Diff line number Diff line change
@@ -1,29 +1,30 @@
import React from 'react'
import { Elevator } from '@nutui/nutui-react'
import { withTranslation, propsType } from '@/translation/demo.translation'

const Demo2 = () => {
const Demo2 = ({ t }: propsType) => {
const dataList = [
{
num: '一',
list: [
{
name: '北京',
name: t.beijing,
id: 1,
},
{
name: '上海',
name: t.shanghai,
id: 2,
},
{
name: '深圳',
name: t.shenzhen,
id: 3,
},
{
name: '广州',
name: t.guangzhou,
id: 4,
},
{
name: '杭州',
name: t.hangzhou,
id: 5,
},
],
Expand All @@ -32,35 +33,35 @@ const Demo2 = () => {
num: '二',
list: [
{
name: '成都',
name: t.chengdu,
id: 6,
},
{
name: '西安',
name: t.xian,
id: 7,
},
{
name: '天津',
name: t.tianjin,
id: 8,
},
{
name: '武汉',
name: t.wuhan,
id: 9,
},
{
name: '长沙',
name: t.changsha,
id: 10,
},
{
name: '重庆',
name: t.chongqing,
id: 11,
},
{
name: '苏州',
name: t.suzhou,
id: 12,
},
{
name: '南京',
name: t.nanjing,
id: 13,
},
],
Expand All @@ -69,55 +70,58 @@ const Demo2 = () => {
num: '三',
list: [
{
name: '西宁',
name: t.xining,
id: 14,
},
{
name: '兰州',
name: t.lanzhou,
id: 15,
},
{
name: '石家庄',
name: t.shijiazhuang,
id: 16,
},
{
name: '秦皇岛',
name: t.qinhuangdao,
id: 17,
},
{
name: '大连',
name: t.dalian,
id: 18,
},
{
name: '哈尔滨',
name: t.haerbin,
id: 19,
},
{
name: '长春',
name: t.changchun,
id: 20,
},
{
name: '太原',
name: t.taiyuan,
id: 21,
},
],
},
]

const onItemClick = (key: string, item: any) => {
console.log(key, JSON.stringify(item))
}

const onIndexClick = (key: string) => {
console.log(key)
}

return (
<Elevator
list={dataList}
height="220"
floorKey="num"
onItemClick={(key: string, item: any) => onItemClick(key, item)}
onIndexClick={(key: string) => onIndexClick(key)}
onItemClick={onItemClick}
onIndexClick={onIndexClick}
/>
)
}
export default Demo2

export default withTranslation(Demo2)
Loading

0 comments on commit c6abb10

Please sign in to comment.