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
11 changes: 0 additions & 11 deletions packages/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,17 +91,6 @@
"exportEmpty": true,
"taro": true,
"author": "yisumay"
},
{
"version": "1.0.0",
"name": "Image",
"type": "component",
"cName": "图片",
"desc": "图片",
"sort": 2,
"show": true,
"taro": true,
"author": "yisumay"
}
]
},
Expand Down
21 changes: 13 additions & 8 deletions packages/nutui-solid/src/components/button/button.taro.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Loading } from '@nutui/icons-solid'
import { Show, createMemo, mergeProps, splitProps } from 'solid-js'
import { type Component, type JSX } from 'solid-js'
import { Loading } from '@nutui/icons-solid'

export type ButtonType =
| 'default'
Expand All @@ -13,7 +13,7 @@ export type ButtonSize = 'xlarge' | 'large' | 'normal' | 'small' | 'mini'
export type ButtonShape = 'square' | 'round'
export type ButtonFill = 'solid' | 'outline' | 'dashed' | 'none'

export interface ButtonProps extends JSX.HTMLAttributes<HTMLDivElement> {
export type ButtonProps = Omit<JSX.HTMLAttributes<HTMLDivElement>, 'style'> & Partial<{
color: string
shape: ButtonShape
plain: boolean
Expand All @@ -23,7 +23,8 @@ export interface ButtonProps extends JSX.HTMLAttributes<HTMLDivElement> {
size: ButtonSize
block: boolean
icon: JSX.Element
}
style: JSX.CSSProperties
}>

const defaultProps: ButtonProps = {
color: '',
Expand All @@ -37,7 +38,7 @@ const defaultProps: ButtonProps = {
icon: null,
}

export const Button: Component<Partial<ButtonProps>> = (props) => {
export const Button: Component<ButtonProps> = (props) => {
const merged = mergeProps(defaultProps, props)
const [local, rest] = splitProps(merged, [
'color',
Expand All @@ -54,14 +55,16 @@ export const Button: Component<Partial<ButtonProps>> = (props) => {
'style',
'onClick',
'ref',
'classList',
'class',
])

const getStyle = createMemo(() => {
let style: JSX.CSSProperties = {}
if (local.color) {
style = {
color: local.plain ? local.color : '#fff',
background: local.plain ? '#fff' : `border-box ${local.color}`,
color: local.plain ? local.color : 'rgb(255, 255, 255)',
background: local.plain ? 'rgb(255, 255, 255)' : `border-box ${local.color}`,
}
if (local.color.includes('gradient')) {
style['border-color'] = 'transparent'
Expand All @@ -70,7 +73,7 @@ export const Button: Component<Partial<ButtonProps>> = (props) => {
style['border-color'] = local.color
}
}
return style
return { ...style, ...local.style }
})

const handleClick: JSX.EventHandler<HTMLDivElement, MouseEvent> = (e) => {
Expand All @@ -92,6 +95,8 @@ export const Button: Component<Partial<ButtonProps>> = (props) => {
[`${prefixCls}--block`]: local.block,
[`${prefixCls}--disabled`]: local.disabled,
[`${prefixCls}--loading`]: local.loading,
...local.classList,
[local.class]: true,
}
})

Expand All @@ -103,7 +108,7 @@ export const Button: Component<Partial<ButtonProps>> = (props) => {
style={getStyle()}
onClick={handleClick}
>
<div class="nut-button-wrap">
<div class="nut-button__wrap">
<Show when={local.loading} fallback={null}>
<Loading />
</Show>
Expand Down
8 changes: 6 additions & 2 deletions packages/nutui-solid/src/components/button/button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export type ButtonSize = 'xlarge' | 'large' | 'normal' | 'small' | 'mini'
export type ButtonShape = 'square' | 'round'
export type ButtonFill = 'solid' | 'outline' | 'dashed' | 'none'

export type ButtonProps = JSX.HTMLAttributes<HTMLDivElement> & Partial<{
export type ButtonProps = Omit<JSX.HTMLAttributes<HTMLDivElement>, 'style'> & Partial<{
color: string
shape: ButtonShape
plain: boolean
Expand All @@ -23,6 +23,7 @@ export type ButtonProps = JSX.HTMLAttributes<HTMLDivElement> & Partial<{
size: ButtonSize
block: boolean
icon: JSX.Element
style: JSX.CSSProperties
}>

const defaultProps: ButtonProps = {
Expand Down Expand Up @@ -54,6 +55,7 @@ export const Button: Component<ButtonProps> = (props) => {
'style',
'onClick',
'ref',
'classList',
])

const getStyle = createMemo(() => {
Expand All @@ -70,7 +72,7 @@ export const Button: Component<ButtonProps> = (props) => {
style['border-color'] = local.color
}
}
return style
return { ...style, ...local.style }
})

const handleClick: JSX.EventHandler<HTMLDivElement, MouseEvent> = (e) => {
Expand All @@ -92,6 +94,8 @@ export const Button: Component<ButtonProps> = (props) => {
[`${prefixCls}--block`]: local.block,
[`${prefixCls}--disabled`]: local.disabled,
[`${prefixCls}--loading`]: local.loading,
...local.classList,
[local.class]: true,
}
})

Expand Down
52 changes: 29 additions & 23 deletions packages/nutui-solid/src/components/cell/cell.taro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { pxCheck } from '@/utils/px-check'

export type CellSize = 'normal' | 'large'

export type CellProps = Omit<JSX.HTMLAttributes<HTMLDivElement>, 'title'> & Partial<{
export type CellProps = Omit<JSX.HTMLAttributes<HTMLDivElement>, 'title' | 'style'> & Partial<{
title: JSX.Element
subTitle: JSX.Element
desc: JSX.Element
Expand All @@ -23,6 +23,7 @@ export type CellProps = Omit<JSX.HTMLAttributes<HTMLDivElement>, 'title'> & Part
*/
url: string
link: JSX.Element
style: JSX.CSSProperties
}>

const defaultProps: CellProps = {
Expand Down Expand Up @@ -56,6 +57,9 @@ export const Cell: Component<ParentProps<CellProps>> = (props) => {
'link',
'onClick',
'children',
'style',
'classList',
'class',
])

const classes = createMemo(() => {
Expand All @@ -65,15 +69,17 @@ export const Cell: Component<ParentProps<CellProps>> = (props) => {
[`${prefixCls}--clickable`]: local.isLink,
[`${prefixCls}--center`]: local.center,
[`${prefixCls}--large`]: local.size === 'large',
...local.classList,
[local.class]: true,
}
})

const baseStyle = createMemo(() => {
const style = local.style
if (local.roundRadius) {
return {
'border-radius': pxCheck(local.roundRadius),
} as JSX.CSSProperties
style['border-radius'] = pxCheck(local.roundRadius)
}
return style
})

const descStyle = createMemo(() => {
Expand Down Expand Up @@ -102,32 +108,32 @@ export const Cell: Component<ParentProps<CellProps>> = (props) => {
{local?.children
? local?.children
: (
<>
<Show when={local.icon}>
<div class="nut-cell__icon">
{local.icon}
</div>
</Show>
<Show when={local.title || local.subTitle}>
<div class="nut-cell__title">
<div class="title">{local.title}</div>
<Show when={local.subTitle}>
<div class="nut-cell__title-desc">{ local.subTitle}</div>
</Show>
</div>
</Show>
<Show when={local.desc}>
<div classList={descClasses()} style={descStyle()}>{local.desc}</div>
</Show>
{
<>
<Show when={local.icon}>
<div class="nut-cell__icon">
{local.icon}
</div>
</Show>
<Show when={local.title || local.subTitle}>
<div class="nut-cell__title">
<div class="title">{local.title}</div>
<Show when={local.subTitle}>
<div class="nut-cell__title-desc">{ local.subTitle}</div>
</Show>
</div>
</Show>
<Show when={local.desc}>
<div classList={descClasses()} style={descStyle()}>{local.desc}</div>
</Show>
{
local?.link
?? (
<Show when={local.isLink || local.url}>
<ArrowRight class="nut-cell__link" />
</Show>
)
}
</>
</>
)}
</div>
)
Expand Down
52 changes: 29 additions & 23 deletions packages/nutui-solid/src/components/cell/cell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { pxCheck } from '@/utils/px-check'

export type CellSize = 'normal' | 'large'

export type CellProps = Omit<JSX.HTMLAttributes<HTMLDivElement>, 'title'> & Partial<{
export type CellProps = Omit<JSX.HTMLAttributes<HTMLDivElement>, 'title' | 'style'> & Partial<{
title: JSX.Element
subTitle: JSX.Element
desc: JSX.Element
Expand All @@ -23,6 +23,7 @@ export type CellProps = Omit<JSX.HTMLAttributes<HTMLDivElement>, 'title'> & Part
*/
url: string
link: JSX.Element
style: JSX.CSSProperties
}>

const defaultProps: CellProps = {
Expand Down Expand Up @@ -56,6 +57,9 @@ export const Cell: Component<ParentProps<CellProps>> = (props) => {
'link',
'onClick',
'children',
'style',
'classList',
'class',
])

const classes = createMemo(() => {
Expand All @@ -65,15 +69,17 @@ export const Cell: Component<ParentProps<CellProps>> = (props) => {
[`${prefixCls}--clickable`]: local.isLink,
[`${prefixCls}--center`]: local.center,
[`${prefixCls}--large`]: local.size === 'large',
...local.classList,
[local.class]: true,
}
})

const baseStyle = createMemo(() => {
const style = local.style
if (local.roundRadius) {
return {
'border-radius': pxCheck(local.roundRadius),
} as JSX.CSSProperties
style['border-radius'] = pxCheck(local.roundRadius)
}
return style
})

const descStyle = createMemo(() => {
Expand Down Expand Up @@ -102,32 +108,32 @@ export const Cell: Component<ParentProps<CellProps>> = (props) => {
{local?.children
? local?.children
: (
<>
<Show when={local.icon}>
<div class="nut-cell__icon">
{local.icon}
</div>
</Show>
<Show when={local.title || local.subTitle}>
<div class="nut-cell__title">
<div class="title">{local.title}</div>
<Show when={local.subTitle}>
<div class="nut-cell__title-desc">{ local.subTitle}</div>
</Show>
</div>
</Show>
<Show when={local.desc}>
<div classList={descClasses()} style={descStyle()}>{local.desc}</div>
</Show>
{
<>
<Show when={local.icon}>
<div class="nut-cell__icon">
{local.icon}
</div>
</Show>
<Show when={local.title || local.subTitle}>
<div class="nut-cell__title">
<div class="title">{local.title}</div>
<Show when={local.subTitle}>
<div class="nut-cell__title-desc">{ local.subTitle}</div>
</Show>
</div>
</Show>
<Show when={local.desc}>
<div classList={descClasses()} style={descStyle()}>{local.desc}</div>
</Show>
{
local?.link
?? (
<Show when={local.isLink || local.url}>
<ArrowRight class="nut-cell__link" />
</Show>
)
}
</>
</>
)}
</div>
)
Expand Down
Loading
Loading