Skip to content

Commit

Permalink
fix: incorrect icon removed
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoyatong committed Nov 22, 2024
1 parent b380bcf commit a518f89
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 25 deletions.
2 changes: 1 addition & 1 deletion src/packages/icon/demo.taro.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useState } from 'react'
import Taro from '@tarojs/taro'
import { ScrollView, View } from '@tarojs/components'
import '@nutui/icons-react-taro/dist/style_iconfont.css'
// import '@nutui/icons-react-taro/dist/style_iconfont.css'
import { Toast } from '@nutui/nutui-react-taro'
import { useTranslate } from '@/sites/assets/locale/taro'
import Header from '@/sites/components/header'
Expand Down
3 changes: 1 addition & 2 deletions src/packages/icon/demos/taro/demo3.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ const Demo3 = () => {
<Cell>
<IconFont
size={40}
width={40}
height={40}
style={{ width: 40, height: 40 }}
name="https://img11.360buyimg.com/imagetools/jfs/t1/137646/13/7132/1648/5f4c748bE43da8ddd/a3f06d51dcae7b60.png"
/>
</Cell>
Expand Down
9 changes: 2 additions & 7 deletions src/packages/icon/demos/taro/demo6.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import * as iconfonts from '@nutui/icons-react-taro'
import { Cell, Toast } from '@nutui/nutui-react-taro'
import { View } from '@tarojs/components'
import { camelCase } from '@/utils/camel-case'
import { web } from '@/utils/platform-taro'

const Demo6 = () => {
const generateCopyText = (name: string) => {
Expand Down Expand Up @@ -62,12 +61,8 @@ const Demo6 = () => {
justifyContent: 'center',
}}
>
{!web() ? (
React.createElement(
iconfonts[camelCase(icon, { pascalCase: true })] || ''
)
) : (
<iconfonts.IconFont name={icon} />
{React.createElement(
iconfonts[camelCase(icon, { pascalCase: true })]
)}
</View>
)
Expand Down
20 changes: 5 additions & 15 deletions src/packages/icon/demos/taro/demo7.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import * as iconfonts from '@nutui/icons-react-taro'
import { Cell, Toast } from '@nutui/nutui-react-taro'
import { View } from '@tarojs/components'
import { camelCase } from '@/utils/camel-case'
import { web } from '@/utils/platform-taro'

const Demo7 = () => {
const generateAMCopyText = (icon: any) => {
Expand Down Expand Up @@ -63,20 +62,11 @@ const Demo7 = () => {
justifyContent: 'center',
}}
>
{!web() ? (
React.createElement(
iconfonts[
camelCase(icon.name || '', { pascalCase: true })
],
{
className: `nut-icon-${icon['animation-name']} nut-icon-${icon['animation-time']}`,
}
)
) : (
<iconfonts.IconFont
name={icon.name}
className={`nut-icon-${icon['animation-name']} nut-icon-${icon['animation-time']}`}
/>
{React.createElement(
iconfonts[camelCase(icon.name, { pascalCase: true })],
{
className: `nut-icon-${icon['animation-name']} nut-icon-${icon['animation-time']}`,
}
)}
</View>
)
Expand Down

0 comments on commit a518f89

Please sign in to comment.