Skip to content

Commit

Permalink
fix: change view
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoyatong committed Jul 23, 2024
1 parent f300e81 commit fd1c75b
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 48 deletions.
9 changes: 5 additions & 4 deletions src/packages/timedetail/timedetail.taro.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { FunctionComponent, useCallback, useMemo } from 'react'
import classNames from 'classnames'
import { View } from '@tarojs/components'
import { BasicComponent, ComponentDefaults } from '@/utils/typings'
import {
TimeType,
Expand Down Expand Up @@ -60,19 +61,19 @@ export const TimeDetail: FunctionComponent<
[activeTime, optionKey, activeDate]
)
return (
<div className={classNames(classPrefix, className)}>
<View className={classNames(classPrefix, className)}>
{timeList[optionKey.childrenKey].map((item: TimeType) => (
<span
<View
className={classNames(`${classPrefix}-item`, {
active: isActive(item[optionKey.valueKey]),
})}
key={item[optionKey.valueKey]}
onClick={() => onSelect(item)}
>
{item[optionKey.textKey]}
</span>
</View>
))}
</div>
</View>
)
}

Expand Down
13 changes: 7 additions & 6 deletions src/packages/timeselect/demo.taro.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react'
import Taro from '@tarojs/taro'
import { ScrollView, View } from '@tarojs/components'
import { useTranslate } from '@/sites/assets/locale/taro'
import Header from '@/sites/components/header'
import Demo1 from './demos/taro/demo1'
Expand Down Expand Up @@ -32,16 +33,16 @@ const TimeSelectDemo = () => {
return (
<>
<Header />
<div className={`demo ${Taro.getEnv() === 'WEB' ? 'web' : ''}`}>
<h2>{translated.basic}</h2>
<ScrollView className={`demo ${Taro.getEnv() === 'WEB' ? 'web' : ''}`}>
<View className="h2">{translated.basic}</View>
<Demo1 />
<h2>{translated.optionKey}</h2>
<View className="h2">{translated.optionKey}</View>
<Demo2 />
<h2>{translated.multiple}</h2>
<View className="h2">{translated.multiple}</View>
<Demo3 />
<h2>{translated.custom}</h2>
<View className="h2">{translated.custom}</View>
<Demo4 />
</div>
</ScrollView>
</>
)
}
Expand Down
17 changes: 9 additions & 8 deletions src/packages/timeselect/timeselect.taro.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { FunctionComponent, ReactNode, useState } from 'react'
import classNames from 'classnames'
import { View } from '@tarojs/components'
import Popup from '@/packages/popup/index.taro'
import TimeDetail from '@/packages/timedetail/index.taro'
import { BasicComponent, ComponentDefaults } from '@/utils/typings'
Expand Down Expand Up @@ -152,30 +153,30 @@ export const TimeSelect: FunctionComponent<Partial<TimeSelectProps>> = (
onClose={closeFun}
{...rest}
>
<div className={classNames(classPrefix, className)}>
<div className={`${classPrefix}-content`}>
<div className={`${classPrefix}-content-left`}>
<View className={classNames(classPrefix, className)}>
<View className={`${classPrefix}-content`}>
<View className={`${classPrefix}-content-left`}>
{options.map((item: DateType) => (
<div
<View
key={item[optionKey.valueKey]}
className={classNames('nut-timepannel', {
active: item[optionKey.valueKey] === activeDate,
})}
onClick={() => handleChange(item)}
>
{item[optionKey.textKey]}
</div>
</View>
))}
</div>
</View>
<TimeDetail
options={options}
optionKey={optionKey}
activeDate={activeDate}
activeTime={activeTime}
onSelect={handleSelectTime}
/>
</div>
</div>
</View>
</View>
</Popup>
)
}
Expand Down
16 changes: 8 additions & 8 deletions src/packages/toast/demo.taro.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react'
import { Toast } from '@nutui/nutui-react-taro'
import { ScrollView, View } from '@tarojs/components'
import Header from '@/sites/components/header'
import { useTranslate } from '@/sites/assets/locale/taro'
import Demo1 from './demos/taro/demo1'
Expand Down Expand Up @@ -44,20 +45,19 @@ const ToastDemo = () => {
return (
<>
<Header />
<div className={`demo ${demoClass()}`}>
<h2>{translated.basic}</h2>
<ScrollView className={`demo ${demoClass()}`}>
<View className="h2">{translated.basic}</View>
<Demo1 />
<h2>{translated.toastFunction}</h2>
<View className="h2">{translated.toastFunction}</View>
<Toast id="test" />
<Demo2 />

<h2>{translated.toastDuration}</h2>
<View className="h2">{translated.toastDuration}</View>
<Demo3 />
<h2>{translated.toastCustomIcon}</h2>
<View className="h2">{translated.toastCustomIcon}</View>
<Demo4 />
<h2>{translated.toastWordBreak}</h2>
<View className="h2">{translated.toastWordBreak}</View>
<Demo5 />
</div>
</ScrollView>
</>
)
}
Expand Down
44 changes: 22 additions & 22 deletions src/packages/uploader/preview.taro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
Link as LinkIcon,
Loading,
} from '@nutui/icons-react-taro'
import { Image } from '@tarojs/components'
import { Image, View } from '@tarojs/components'
import Progress from '@/packages/progress/index.taro'
import { FileItem } from '@/packages/uploader/file-item.taro'
import { ERROR } from '@/packages/uploader/utils'
Expand All @@ -32,7 +32,7 @@ export const Preview: React.FunctionComponent<any> = ({
{fileList.length !== 0 &&
fileList.map((item: any, index: number) => {
return (
<div
<View
className={`nut-uploader-preview ${previewType}`}
key={item.uid}
>
Expand All @@ -44,21 +44,21 @@ export const Preview: React.FunctionComponent<any> = ({
/>
)}
{previewType === 'picture' && !children && (
<div className="nut-uploader-preview-img">
<View className="nut-uploader-preview-img">
{item.status === 'ready' ? (
<div className="nut-uploader-preview-progress">
<div className="nut-uploader-preview-progress-msg">
<View className="nut-uploader-preview-progress">
<View className="nut-uploader-preview-progress-msg">
{item.message}
</div>
</div>
</View>
</View>
) : (
item.status !== 'success' && (
<div className="nut-uploader-preview-progress">
<View className="nut-uploader-preview-progress">
{renderIcon(item)}
<div className="nut-uploader-preview-progress-msg">
<View className="nut-uploader-preview-progress-msg">
{item.message}
</div>
</div>
</View>
</View>
)
)}
{item.type?.includes('image') ? (
Expand All @@ -83,33 +83,33 @@ export const Preview: React.FunctionComponent<any> = ({
onClick={() => handleItemClick(item, index)}
/>
) : (
<div className="nut-uploader-preview-img-file">
<div
<View className="nut-uploader-preview-img-file">
<View
onClick={() => handleItemClick(item, index)}
className="nut-uploader-preview-img-file-name"
>
<LinkIcon color="#808080" />
<span>&nbsp;{item.name}</span>
</div>
</div>
</View>
</View>
)}
</>
)}
{item.status === 'success' ? (
<div className="tips">{item.name}</div>
<View className="tips">{item.name}</View>
) : null}
</div>
</View>
)}

{previewType === 'list' && (
<div className="nut-uploader-preview-list">
<div
<View className="nut-uploader-preview-list">
<View
className={`nut-uploader-preview-img-file-name ${item.status}`}
onClick={() => handleItemClick(item, index)}
>
<LinkIcon />
<span>&nbsp;{item.name}</span>
</div>
</View>
{deletable && (
<Del
color="#808080"
Expand All @@ -124,9 +124,9 @@ export const Preview: React.FunctionComponent<any> = ({
showText={false}
/>
)}
</div>
</View>
)}
</div>
</View>
)
})}
</>
Expand Down

0 comments on commit fd1c75b

Please sign in to comment.