Skip to content

Commit

Permalink
feat: all nav coms have been replaced
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex-huxiyang committed Jan 9, 2025
1 parent c6abb10 commit 92071a4
Show file tree
Hide file tree
Showing 21 changed files with 303 additions and 180 deletions.
20 changes: 13 additions & 7 deletions src/packages/fixednav/demos/h5/demo1.tsx
Original file line number Diff line number Diff line change
@@ -1,45 +1,50 @@
import React, { useState } from 'react'
import { FixedNav } from '@nutui/nutui-react'
import { withTranslation, propsType } from '@/translation/demo.translation'

const Demo1 = () => {
const Demo1 = ({ t }: propsType) => {
const list = [
{
id: 1,
text: '首页',
text: t.home,
icon: 'https://img11.360buyimg.com/imagetools/jfs/t1/117646/2/11112/1297/5ef83e95E81d77f05/daf8e3b1c81e3c98.png',
},
{
id: 2,
text: '分类',
text: t.category,
icon: 'https://img12.360buyimg.com/imagetools/jfs/t1/119490/8/9568/1798/5ef83e95E968c69a6/dd029326f7d5042e.png',
},
{
id: 3,
text: '购物车',
text: t.cart,
num: 2,
icon: 'https://img14.360buyimg.com/imagetools/jfs/t1/130725/4/3157/1704/5ef83e95Eb976644f/b36c6cfc1cc1a99d.png',
},
{
id: 4,
text: '我的',
text: t.mine,
icon: 'https://img12.360buyimg.com/imagetools/jfs/t1/147573/29/1603/1721/5ef83e94E1393a678/5ddf1695ec989373.png',
},
]

const [visible, setVisible] = useState(false)

const change = (value: boolean) => {
setVisible(value)
}

const selected = (
item: any,
event: React.MouseEvent<Element, MouseEvent>
) => {
console.log(item, event)
}

return (
<>
<FixedNav
list={list}
activeText="基础用法"
activeText={t.basicUsage}
overlay
position={{ top: '70px' }}
onChange={change}
Expand All @@ -49,4 +54,5 @@ const Demo1 = () => {
</>
)
}
export default Demo1

export default withTranslation(Demo1)
22 changes: 14 additions & 8 deletions src/packages/fixednav/demos/h5/demo2.tsx
Original file line number Diff line number Diff line change
@@ -1,53 +1,59 @@
import React, { useState } from 'react'
import { FixedNav } from '@nutui/nutui-react'
import { withTranslation, propsType } from '@/translation/demo.translation'

const Demo2 = () => {
const Demo2 = ({ t }: propsType) => {
const list = [
{
id: 1,
text: '首页',
text: t.home,
icon: 'https://img11.360buyimg.com/imagetools/jfs/t1/117646/2/11112/1297/5ef83e95E81d77f05/daf8e3b1c81e3c98.png',
},
{
id: 2,
text: '分类',
text: t.category,
icon: 'https://img12.360buyimg.com/imagetools/jfs/t1/119490/8/9568/1798/5ef83e95E968c69a6/dd029326f7d5042e.png',
},
{
id: 3,
text: '购物车',
text: t.cart,
num: 2,
icon: 'https://img14.360buyimg.com/imagetools/jfs/t1/130725/4/3157/1704/5ef83e95Eb976644f/b36c6cfc1cc1a99d.png',
},
{
id: 4,
text: '我的',
text: t.mine,
icon: 'https://img12.360buyimg.com/imagetools/jfs/t1/147573/29/1603/1721/5ef83e94E1393a678/5ddf1695ec989373.png',
},
]

const [visible, setVisible] = useState(false)

const change = (value: boolean) => {
setVisible(value)
}

const selected = (
item: any,
event: React.MouseEvent<Element, MouseEvent>
) => {
console.log(item, event)
}

return (
<>
<FixedNav
list={list}
type="left"
position={{ top: '140px' }}
visible={visible}
activeText="左侧收起"
inactiveText="左侧展开"
activeText={t.collapseLeft}
inactiveText={t.expandLeft}
onChange={change}
onSelect={selected}
/>
</>
)
}
export default Demo2

export default withTranslation(Demo2)
18 changes: 12 additions & 6 deletions src/packages/fixednav/demos/h5/demo3.tsx
Original file line number Diff line number Diff line change
@@ -1,40 +1,45 @@
import React, { useState } from 'react'
import { FixedNav } from '@nutui/nutui-react'
import { withTranslation, propsType } from '@/translation/demo.translation'

const Demo3 = () => {
const Demo3 = ({ t }: propsType) => {
const list = [
{
id: 1,
text: '首页',
text: t.home,
icon: 'https://img11.360buyimg.com/imagetools/jfs/t1/117646/2/11112/1297/5ef83e95E81d77f05/daf8e3b1c81e3c98.png',
},
{
id: 2,
text: '分类',
text: t.category,
icon: 'https://img12.360buyimg.com/imagetools/jfs/t1/119490/8/9568/1798/5ef83e95E968c69a6/dd029326f7d5042e.png',
},
{
id: 3,
text: '购物车',
text: t.cart,
num: 2,
icon: 'https://img14.360buyimg.com/imagetools/jfs/t1/130725/4/3157/1704/5ef83e95Eb976644f/b36c6cfc1cc1a99d.png',
},
{
id: 4,
text: '我的',
text: t.mine,
icon: 'https://img12.360buyimg.com/imagetools/jfs/t1/147573/29/1603/1721/5ef83e94E1393a678/5ddf1695ec989373.png',
},
]

const [visible, setVisible] = useState(false)

const change = (value: boolean) => {
setVisible(value)
}

const selected = (
item: any,
event: React.MouseEvent<Element, MouseEvent>
) => {
console.log(item, event)
}

return (
<>
<FixedNav
Expand All @@ -48,4 +53,5 @@ const Demo3 = () => {
</>
)
}
export default Demo3

export default withTranslation(Demo3)
13 changes: 10 additions & 3 deletions src/packages/fixednav/demos/h5/demo4.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
import React, { useState } from 'react'
import { FixedNav } from '@nutui/nutui-react'
import { Retweet } from '@nutui/icons-react'
import { withTranslation, propsType } from '@/translation/demo.translation'

const Demo4 = () => {
const Demo4 = ({ t }: propsType) => {
const [visible, setVisible] = useState(false)

const change = (value: boolean) => {
setVisible(value)
}

const selected = (
item: any,
event: React.MouseEvent<Element, MouseEvent>
) => {
console.log(item, event)
}

return (
<>
<FixedNav
Expand All @@ -24,7 +28,9 @@ const Demo4 = () => {
content={
<>
<Retweet color="#fff" />
<span className="text">{visible ? '自定义开' : '自定义关'}</span>
<span className="text">
{visible ? t.customOpen : t.customClose}
</span>
</>
}
>
Expand All @@ -39,4 +45,5 @@ const Demo4 = () => {
</>
)
}
export default Demo4

export default withTranslation(Demo4)
20 changes: 13 additions & 7 deletions src/packages/fixednav/demos/h5/demo5.tsx
Original file line number Diff line number Diff line change
@@ -1,46 +1,51 @@
import React, { useState } from 'react'
import { Drag, FixedNav } from '@nutui/nutui-react'
import { withTranslation, propsType } from '@/translation/demo.translation'

const Demo5 = () => {
const Demo5 = ({ t }: propsType) => {
const list = [
{
id: 1,
text: '首页',
text: t.home,
icon: 'https://img11.360buyimg.com/imagetools/jfs/t1/117646/2/11112/1297/5ef83e95E81d77f05/daf8e3b1c81e3c98.png',
},
{
id: 2,
text: '分类',
text: t.category,
icon: 'https://img12.360buyimg.com/imagetools/jfs/t1/119490/8/9568/1798/5ef83e95E968c69a6/dd029326f7d5042e.png',
},
{
id: 3,
text: '购物车',
text: t.cart,
num: 2,
icon: 'https://img14.360buyimg.com/imagetools/jfs/t1/130725/4/3157/1704/5ef83e95Eb976644f/b36c6cfc1cc1a99d.png',
},
{
id: 4,
text: '我的',
text: t.mine,
icon: 'https://img12.360buyimg.com/imagetools/jfs/t1/147573/29/1603/1721/5ef83e94E1393a678/5ddf1695ec989373.png',
},
]

const [visible, setVisible] = useState(false)

const change = (value: boolean) => {
setVisible(value)
}

const selected = (
item: any,
event: React.MouseEvent<Element, MouseEvent>
) => {
console.log(item, event)
}

return (
<>
<Drag direction="y" style={{ right: '0px', bottom: '240px' }}>
<FixedNav
list={list}
inactiveText="支持拖拽"
inactiveText={t.supportDrag}
visible={visible}
onChange={change}
onSelect={selected}
Expand All @@ -49,4 +54,5 @@ const Demo5 = () => {
</>
)
}
export default Demo5

export default withTranslation(Demo5)
8 changes: 4 additions & 4 deletions src/packages/hoverbutton/doc.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,31 +16,31 @@ import { HoverButton } from '@nutui/nutui-react-taro'

:::demo

<CodeBlock src='taro/demo1.tsx'></CodeBlock>
<CodeBlock src='h5/demo1.tsx'></CodeBlock>

:::

### Multiple Buttons

:::demo

<CodeBlock src='taro/demo2.tsx'></CodeBlock>
<CodeBlock src='h5/demo2.tsx'></CodeBlock>

:::

### With Bottom Navigation Bar

:::demo

<CodeBlock src='taro/demo3.tsx'></CodeBlock>
<CodeBlock src='h5/demo3.tsx'></CodeBlock>

:::

### Custom Level

:::demo

<CodeBlock src='taro/demo4.tsx'></CodeBlock>
<CodeBlock src='h5/demo4.tsx'></CodeBlock>

:::

Expand Down
Loading

0 comments on commit 92071a4

Please sign in to comment.