Skip to content

Commit

Permalink
fix: props type修改为color
Browse files Browse the repository at this point in the history
  • Loading branch information
irisSong committed Dec 27, 2024
1 parent eb7ee44 commit bb9bd4b
Show file tree
Hide file tree
Showing 14 changed files with 27 additions and 27 deletions.
2 changes: 1 addition & 1 deletion migrate-from-v2.md
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,7 @@ plugins: [
#### Price

- 修改 `size`,增加 'xlarge' 尺寸
- 新增 `type`, 价格类型
- 新增 `color`, 价格类型

#### Progress

Expand Down
4 changes: 2 additions & 2 deletions src/packages/price/__test__/price.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ test('props size', () => {
)
})

test('props type', () => {
const { container } = render(<Price price={1010} type="primary" />)
test('props color', () => {
const { container } = render(<Price price={1010} color="primary" />)
expect(container.querySelector('.nut-price')).toHaveClass('nut-price-primary')
})
2 changes: 1 addition & 1 deletion src/packages/price/demos/h5/demo8.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const Demo8 = () => {
<Cell align="baseline">
<Price price={618.68} />
<span>&nbsp;</span>
<Price price={1080.68} type="gray" size="small" line />
<Price price={1080.68} color="gray" size="small" line />
</Cell>
)
}
Expand Down
8 changes: 4 additions & 4 deletions src/packages/price/demos/h5/demo9.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,22 @@ const Demo9 = () => {
<Cell align="baseline">
<Price price={618.68} size="small" />
<span style={{ ...priceStyles, ...colorStyles }}>专享价</span>
<Price price={1080.68} type="gray" size="small" />
<Price price={1080.68} color="gray" size="small" />
</Cell>
<Cell align="baseline">
<Price price={618.68} size="normal" />
<span style={{ ...priceStyles, ...colorStyles }}>粉丝到手价</span>
<Price price={1080.68} type="gray" size="small" />
<Price price={1080.68} color="gray" size="small" />
</Cell>
<Cell align="baseline">
<Price price={618.68} size="large" />
<span style={{ ...exclusivePriceStyles, ...colorStyles }}>秒杀价</span>
<Price price={1080.68} type="gray" size="small" />
<Price price={1080.68} color="gray" size="small" />
</Cell>
<Cell align="baseline">
<Price price={618.68} size="xlarge" />
<span style={{ ...exclusivePriceStyles, ...colorStyles }}>专享价</span>
<Price price={1080.68} type="gray" size="small" />
<Price price={1080.68} color="gray" size="small" />
</Cell>
</CellGroup>
)
Expand Down
2 changes: 1 addition & 1 deletion src/packages/price/demos/taro/demo8.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const Demo8 = () => {
<Cell align="baseline">
<Price price={618.68} />
<Text>&nbsp;</Text>
<Price price={1080.68} type="gray" size="small" line />
<Price price={1080.68} color="gray" size="small" line />
</Cell>
)
}
Expand Down
8 changes: 4 additions & 4 deletions src/packages/price/demos/taro/demo9.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,22 @@ const Demo9 = () => {
<Cell align="baseline">
<Price price={618.68} size="small" />
<Text style={{ ...priceStyles, ...colorStyles }}>专享价</Text>
<Price price={1080.68} type="gray" size="small" />
<Price price={1080.68} color="gray" size="small" />
</Cell>
<Cell align="baseline">
<Price price={618.68} size="normal" />
<Text style={{ ...priceStyles, ...colorStyles }}>粉丝到手价</Text>
<Price price={1080.68} type="gray" size="small" />
<Price price={1080.68} color="gray" size="small" />
</Cell>
<Cell align="baseline">
<Price price={618.68} size="large" />
<Text style={{ ...exclusivePriceStyles, ...colorStyles }}>秒杀价</Text>
<Price price={1080.68} type="gray" size="small" />
<Price price={1080.68} color="gray" size="small" />
</Cell>
<Cell align="baseline">
<Price price={618.68} size="xlarge" />
<Text style={{ ...exclusivePriceStyles, ...colorStyles }}>专享价</Text>
<Price price={1080.68} type="gray" size="small" />
<Price price={1080.68} color="gray" size="small" />
</Cell>
</CellGroup>
)
Expand Down
2 changes: 1 addition & 1 deletion src/packages/price/doc.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ import { Price } from '@nutui/nutui-react'

| Property | Description | Type | Default |
| --- | --- | --- | --- |
| type | Price type | `primary` \| `gray` \| `darkgray` | `primary` |
| color | Price type | `primary` \| `gray` \| `darkgray` | `primary` |
| price | Price | `number` | `0` |
| symbol | Symbol type | `string` | `&yen;` |
| digits | Decimal digits | `number` | `2` |
Expand Down
2 changes: 1 addition & 1 deletion src/packages/price/doc.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ import { Price } from '@nutui/nutui-react'

| 属性 | 说明 | 类型 | 默认值 |
| --- | --- | --- | --- |
| type | 价格类型 | `primary` \| `gray` \| `darkgray` | `primary` |
| color | 价格类型 | `primary` \| `gray` \| `darkgray` | `primary` |
| price | 价格数量 | `number` | `0` |
| symbol | 符号类型 | `string` | `&yen;` |
| digits | 小数位位数 | `number` | `2` |
Expand Down
2 changes: 1 addition & 1 deletion src/packages/price/doc.zh-TW.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ import { Price } from '@nutui/nutui-react'

| 屬性 | 說明 | 類型 | 默認值 |
| --- | --- | --- | --- |
| type | 價格類型 | `primary` \| `gray` \| `darkgray` | `primary` |
| color | 價格類型 | `primary` \| `gray` \| `darkgray` | `primary` |
| price | 價格數量 | `number` | `0` |
| symbol | 符號類型 | `string` | `&yen;` |
| digits | 小數位位數 | `number` | `2` |
Expand Down
2 changes: 1 addition & 1 deletion src/packages/price/index.taro.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Price } from './price.taro'

export type { PriceProps, PriceSize, PriceType } from './types'
export type { PriceProps, PriceSize, PriceColor } from './types'
export default Price
2 changes: 1 addition & 1 deletion src/packages/price/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Price } from './price'

export type { PriceProps, PriceSize, PriceType } from './types'
export type { PriceProps, PriceSize, PriceColor } from './types'
export default Price
8 changes: 4 additions & 4 deletions src/packages/price/price.taro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { harmony } from '@/utils/platform-taro'

const defaultProps = {
...ComponentDefaults,
type: 'primary',
color: 'primary',
price: 0,
symbol: '&yen;',
digits: 2,
Expand All @@ -19,7 +19,7 @@ const defaultProps = {
} as PriceProps
export const Price: FunctionComponent<Partial<PriceProps>> = (props) => {
const {
type,
color,
price,
symbol,
digits,
Expand Down Expand Up @@ -142,14 +142,14 @@ export const Price: FunctionComponent<Partial<PriceProps>> = (props) => {
<>
{harmony() ? (
<Text
className={`${classPrefix} ${classPrefix}-${type} ${className}`}
className={`${classPrefix} ${classPrefix}-${color} ${className}`}
style={style}
>
{renderInner()}
</Text>
) : (
<View
className={`${classPrefix} ${classPrefix}-${type} ${className}`}
className={`${classPrefix} ${classPrefix}-${color} ${className}`}
style={style}
>
{renderInner()}
Expand Down
6 changes: 3 additions & 3 deletions src/packages/price/price.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { PriceProps } from './types'

const defaultProps = {
...ComponentDefaults,
type: 'primary',
color: 'primary',
price: 0,
symbol: '&yen;',
digits: 2,
Expand All @@ -17,7 +17,7 @@ const defaultProps = {
} as PriceProps
export const Price: FunctionComponent<Partial<PriceProps>> = (props) => {
const {
type,
color,
price,
symbol,
digits,
Expand Down Expand Up @@ -93,7 +93,7 @@ export const Price: FunctionComponent<Partial<PriceProps>> = (props) => {

return (
<div
className={`${classPrefix} ${classPrefix}-${type} ${className}`}
className={`${classPrefix} ${classPrefix}-${color} ${className}`}
style={style}
{...rest}
>
Expand Down
4 changes: 2 additions & 2 deletions src/packages/price/types.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { BasicComponent } from '@/utils/typings'

export type PriceSize = 'xlarge' | 'large' | 'normal' | 'small'
export type PriceType = 'primary' | 'gray' | 'darkgray'
export type PriceColor = 'primary' | 'gray' | 'darkgray'
export interface PriceProps extends BasicComponent {
type: PriceType
color: PriceColor
price: number | string
symbol: string
digits: number
Expand Down

0 comments on commit bb9bd4b

Please sign in to comment.