Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/packages/navbar/demos/h5/demo1.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { NavBar, Toast } from '@nutui/nutui-react'
import { NavBar, Toast, Space } from '@nutui/nutui-react'
import { ArrowLeft, Close, More, Share } from '@nutui/icons-react'

const Demo1 = () => {
Expand All @@ -21,7 +21,7 @@ const Demo1 = () => {
},
}
return (
<>
<Space direction="vertical">
<NavBar
title="页面标题"
back={
Expand Down Expand Up @@ -63,7 +63,7 @@ const Demo1 = () => {
}
onBackClick={(e) => Toast.show('返回')}
/>
</>
</Space>
)
}
export default Demo1
104 changes: 48 additions & 56 deletions src/packages/navbar/demos/h5/demo2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,63 +23,55 @@ const Demo2 = () => {
return (
<>
<Space direction="vertical">
<div style={{ background: '#fff' }}>
<NavBar
back={
<>
<ArrowLeft />
返回
</>
}
right={<Share onClick={(e) => Toast.show('icon')} />}
onBackClick={(e) => Toast.show('返回')}
<NavBar
back={
<>
<ArrowLeft />
返回
</>
}
right={<Share onClick={(e) => Toast.show('icon')} />}
onBackClick={(e) => Toast.show('返回')}
>
页面标题
</NavBar>
<NavBar
right={<Share onClick={(e) => Toast.show('icon')} />}
onBackClick={(e) => Toast.show('返回')}
>
页面标题
</NavBar>
<NavBar
right={<span onClick={(e) => Toast.show('清空')}>清空</span>}
left={<Close />}
back={<ArrowLeft />}
onBackClick={(e) => Toast.show('返回')}
>
<div
style={{
...styles.flexCenter,
alignItems: 'flex-start',
flexDirection: 'column',
}}
>
页面标题
</NavBar>
</div>
<div style={{ background: '#fff' }}>
<NavBar
right={<Share onClick={(e) => Toast.show('icon')} />}
onBackClick={(e) => Toast.show('返回')}
>
页面标题
</NavBar>
</div>
<div style={{ background: '#fff' }}>
<NavBar
right={<span onClick={(e) => Toast.show('清空')}>清空</span>}
left={<Close />}
back={<ArrowLeft />}
onBackClick={(e) => Toast.show('返回')}
>
<div
style={{
...styles.flexCenter,
alignItems: 'flex-start',
flexDirection: 'column',
}}
>
<span style={styles.title} onClick={(e) => Toast.show('标题')}>
页面标题
</span>
<span style={styles.description}>副标题</span>
</div>
</NavBar>
</div>
<div style={{ background: '#fff' }}>
<NavBar
back={<ArrowLeft />}
right={
<>
<span onClick={(e) => Toast.show('编辑')}>编辑</span>
<More onClick={(e) => Toast.show('icon')} />
</>
}
onBackClick={(e) => Toast.show('返回')}
>
<span onClick={(e) => Toast.show('页面标题')}>页面标题</span>
</NavBar>
</div>
<span style={styles.title} onClick={(e) => Toast.show('标题')}>
页面标题
</span>
<span style={styles.description}>副标题</span>
</div>
</NavBar>
<NavBar
back={<ArrowLeft />}
right={
<>
<span onClick={(e) => Toast.show('编辑')}>编辑</span>
<More onClick={(e) => Toast.show('icon')} />
</>
}
onBackClick={(e) => Toast.show('返回')}
>
<span onClick={(e) => Toast.show('页面标题')}>页面标题</span>
</NavBar>
</Space>
</>
)
Expand Down
20 changes: 15 additions & 5 deletions src/packages/navbar/demos/h5/demo3.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import React, { useState } from 'react'
import { NavBar, TabPane, Tabs, Toast } from '@nutui/nutui-react'
import { NavBar, TabPane, Tabs, Toast, Space } from '@nutui/nutui-react'
import { ArrowLeft, More } from '@nutui/icons-react'

const Demo3 = () => {
const [tab1value, setTab1value] = useState<string | number>('0')
const [tab2value, setTab2value] = useState<string | number>('0')
return (
<>
<Space direction="vertical">
<NavBar
style={{ '--nutui-navbar-background': 'transparent' }}
back={<ArrowLeft />}
right={
<>
Expand All @@ -25,7 +26,7 @@ const Demo3 = () => {
}}
style={{
'--nutui-tabs-titles-gap': 0,
background: 'transparent',
'--nutui-tabs-titles-background-color': 'transparent',
}}
>
<TabPane title="Tab 1"> Tab 1 </TabPane>
Expand All @@ -35,6 +36,10 @@ const Demo3 = () => {
</div>
</NavBar>
<NavBar
style={{
'--nutui-navbar-background': '#ff0f23',
'--nutui-navbar-color': '#fff',
}}
back={<ArrowLeft />}
right={
<>
Expand All @@ -46,7 +51,12 @@ const Demo3 = () => {
>
<div>
<Tabs
className="navbar-tabs"
style={{
'--nutui-tabs-titles-gap': 0,
'--nutui-tabs-titles-background-color': 'transparent',
'--nutui-tabs-titles-item-color': '#fff',
'--nutui-color-title': 'white',
}}
align="left"
activeType="simple"
value={tab2value}
Expand All @@ -59,7 +69,7 @@ const Demo3 = () => {
</Tabs>
</div>
</NavBar>
</>
</Space>
)
}
export default Demo3
6 changes: 3 additions & 3 deletions src/packages/navbar/demos/taro/demo1.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react'
import Taro from '@tarojs/taro'
import { View } from '@tarojs/components'
import { NavBar, pxTransform, harmony } from '@nutui/nutui-react-taro'
import { NavBar, pxTransform, harmony, Space } from '@nutui/nutui-react-taro'
import { ArrowLeft, Close, More, Share } from '@nutui/icons-react-taro'

const Demo1 = () => {
Expand All @@ -25,7 +25,7 @@ const Demo1 = () => {
},
}
return (
<>
<Space direction="vertical">
<NavBar
title="页面标题"
back={
Expand Down Expand Up @@ -84,7 +84,7 @@ const Demo1 = () => {
}
onBackClick={(e) => Taro.showToast({ title: '返回' })}
/>
</>
</Space>
)
}
export default Demo1
145 changes: 68 additions & 77 deletions src/packages/navbar/demos/taro/demo2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,92 +27,83 @@ const Demo2 = () => {
return (
<>
<Space direction="vertical">
<View style={{ background: '#fff' }}>
<NavBar
back={
<>
<ArrowLeft style={harmony() ? { marginRight: 16 } : {}} />
返回
</>
}
right={<Share onClick={(e) => Taro.showToast({ title: 'icon' })} />}
onBackClick={(e) => Taro.showToast({ title: '返回' })}
<NavBar
back={
<>
<ArrowLeft style={harmony() ? { marginRight: 16 } : {}} />
返回
</>
}
right={<Share onClick={(e) => Taro.showToast({ title: 'icon' })} />}
onBackClick={(e) => Taro.showToast({ title: '返回' })}
>
<View
style={styles.title}
onClick={(e) => Taro.showToast({ title: '页面标题' })}
>
<View
style={styles.title}
onClick={(e) => Taro.showToast({ title: '页面标题' })}
>
页面标题
</View>
</NavBar>
</View>
<View style={{ background: '#fff' }}>
<NavBar
right={<Share onClick={(e) => Taro.showToast({ title: 'icon' })} />}
onBackClick={(e) => Taro.showToast({ title: '返回' })}
页面标题
</View>
</NavBar>

<NavBar
right={<Share onClick={(e) => Taro.showToast({ title: 'icon' })} />}
onBackClick={(e) => Taro.showToast({ title: '返回' })}
>
<View
style={styles.title}
onClick={(e) => Taro.showToast({ title: '页面标题' })}
>
页面标题
</View>
</NavBar>
<NavBar
right={
<View onClick={(e) => Taro.showToast({ title: '清空' })}>清空</View>
}
left={<Close style={harmony() ? { marginLeft: 16 } : {}} />}
back={<ArrowLeft />}
onBackClick={(e) => Taro.showToast({ title: '返回' })}
>
<View>
<View
style={styles.title}
onClick={(e) => Taro.showToast({ title: '页面标题' })}
style={{
...styles.flexCenter,
alignItems: 'flex-start',
flexDirection: 'column',
}}
>
页面标题
</View>
</NavBar>
</View>
<View style={{ background: '#fff' }}>
<NavBar
right={
<View onClick={(e) => Taro.showToast({ title: '清空' })}>
清空
</View>
}
left={<Close style={harmony() ? { marginLeft: 16 } : {}} />}
back={<ArrowLeft />}
onBackClick={(e) => Taro.showToast({ title: '返回' })}
>
<View>
<View
style={{
...styles.flexCenter,
alignItems: 'flex-start',
flexDirection: 'column',
}}
style={styles.title}
onClick={(e) => Taro.showToast({ title: '标题' })}
>
<View
style={styles.title}
onClick={(e) => Taro.showToast({ title: '标题' })}
>
页面标题
</View>
<View style={styles.description}>副标题</View>
页面标题
</View>
<View style={styles.description}>副标题</View>
</View>
</NavBar>
</View>
<View style={{ background: '#fff' }}>
<NavBar
back={<ArrowLeft />}
right={
<>
<View
style={harmony() ? { marginRight: 16 } : {}}
onClick={(e) => Taro.showToast({ title: '编辑' })}
>
编辑
</View>
<More onClick={(e) => Taro.showToast({ title: 'icon' })} />
</>
}
onBackClick={(e) => Taro.showToast({ title: '返回' })}
</View>
</NavBar>
<NavBar
back={<ArrowLeft />}
right={
<>
<View
style={harmony() ? { marginRight: 16 } : {}}
onClick={(e) => Taro.showToast({ title: '编辑' })}
>
编辑
</View>
<More onClick={(e) => Taro.showToast({ title: 'icon' })} />
</>
}
onBackClick={(e) => Taro.showToast({ title: '返回' })}
>
<View
style={styles.title}
onClick={(e) => Taro.showToast({ title: '页面标题' })}
>
<View
style={styles.title}
onClick={(e) => Taro.showToast({ title: '页面标题' })}
>
页面标题
</View>
</NavBar>
</View>
页面标题
</View>
</NavBar>
</Space>
</>
)
Expand Down
Loading
Loading