Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: tag 增加iconSize属性,提取元素变量 #657

Merged
merged 46 commits into from
Feb 14, 2023
Merged
Show file tree
Hide file tree
Changes from 45 commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
2fef7f9
feat: 删无用代码。
xiaoyatong Oct 17, 2022
b5f134c
Merge branch 'main' of https://github.com/xiaoyatong/nutui-react
xiaoyatong Oct 18, 2022
8c6ffdc
Merge branch 'main' of https://github.com/xiaoyatong/nutui-react
xiaoyatong Oct 31, 2022
1a04b2b
Merge branch 'main' of https://github.com/xiaoyatong/nutui-react
xiaoyatong Nov 3, 2022
a7a00be
fix: 暗黑模式下,cellgroup、demo样式修复。
xiaoyatong Nov 3, 2022
067a9b6
Merge branch 'jdf2e:main' into main
xiaoyatong Nov 7, 2022
ee6d923
Merge branch 'jdf2e:main' into main
xiaoyatong Nov 18, 2022
f0b1a9c
Merge branch 'jdf2e:main' into main
xiaoyatong Nov 22, 2022
f9d4fe9
Merge branch 'jdf2e:main' into main
xiaoyatong Nov 22, 2022
7bf52dd
Merge branch 'jdf2e:main' into main
xiaoyatong Nov 23, 2022
899a88c
Merge branch 'jdf2e:main' into main
xiaoyatong Nov 28, 2022
9624dfa
feat: 适配form表单。可展示,但不可校验。
xiaoyatong Nov 29, 2022
8d08e08
Merge branch 'jdf2e:main' into main
xiaoyatong Dec 20, 2022
6698b43
fix: navbar 文档有误,修复。
xiaoyatong Dec 21, 2022
506bfb7
fix: searchbar 组件处理 taro 下的兼容问题。
xiaoyatong Dec 21, 2022
9fd4c8b
Merge branch 'main' of https://github.com/xiaoyatong/nutui-react
xiaoyatong Dec 21, 2022
8697879
Merge branch 'jdf2e:main' into main
xiaoyatong Dec 21, 2022
2dd7471
Merge branch 'main' of https://github.com/xiaoyatong/nutui-react
xiaoyatong Dec 21, 2022
7d996c5
fix: 修复文案。
xiaoyatong Dec 21, 2022
f1715c7
fix: form不可用。
xiaoyatong Dec 21, 2022
df84348
fix: 组件 Range 修复手动设置为0时,页面无法渲染的问题。
xiaoyatong Dec 21, 2022
b5c2143
Merge branch 'jdf2e:main' into main
xiaoyatong Dec 21, 2022
6400e4d
fix: 调整zIndex值,mask和内容区分别为1000和1200
xiaoyatong Dec 21, 2022
f3298d1
Merge branch 'jdf2e:main' into main
xiaoyatong Dec 21, 2022
104c150
Merge branch 'jdf2e:main' into main
xiaoyatong Dec 23, 2022
c689c6b
Merge branch 'jdf2e:main' into main
xiaoyatong Jan 10, 2023
42c1990
fix: badge组件修改background,适配渐变色。
xiaoyatong Jan 10, 2023
0002086
feat: 更新多语言文档。
xiaoyatong Jan 11, 2023
24d6b41
Merge branch 'jdf2e:main' into main
xiaoyatong Jan 11, 2023
612675e
Merge branch 'main' of https://github.com/xiaoyatong/nutui-react
xiaoyatong Jan 11, 2023
5eb7766
chore: 添加新组件时,对组件进行排序~
xiaoyatong Jan 11, 2023
d79093f
Merge branch 'jdf2e:main' into main
xiaoyatong Jan 11, 2023
bc9e003
Merge branch 'main' of https://github.com/xiaoyatong/nutui-react
xiaoyatong Jan 11, 2023
10a5ec3
chore: 排序。
xiaoyatong Jan 11, 2023
6b1ed2c
Merge branch 'jdf2e:main' into main
xiaoyatong Jan 16, 2023
2c5e4a6
Merge branch 'jdf2e:main' into main
xiaoyatong Feb 6, 2023
b096243
Merge branch 'jdf2e:main' into main
xiaoyatong Feb 13, 2023
a7f9973
fix: 统一doc文档 废弃文案。
xiaoyatong Feb 13, 2023
a1c991d
Merge branch 'jdf2e:main' into main
xiaoyatong Feb 13, 2023
33ebeae
Merge branch 'jdf2e:main' into main
xiaoyatong Feb 13, 2023
47aa203
Merge branch 'jdf2e:main' into main
xiaoyatong Feb 13, 2023
5979db5
feat: tag 增加iconsize 属性,提取视觉元素变量。
xiaoyatong Feb 13, 2023
040d693
fix: 变量定义。
xiaoyatong Feb 13, 2023
a70b82d
Merge branch 'jdf2e:main' into main
xiaoyatong Feb 13, 2023
4508046
Merge branch 'main' into tag0213
xiaoyatong Feb 13, 2023
142ab9e
docs: 增加版本号
xiaoyatong Feb 13, 2023
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
1 change: 1 addition & 0 deletions src/packages/tag/demo.taro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const TagDemo = () => {
linkSlot={
<Tag
closeable
iconSize="14px"
onClose={() => Taro.showToast({ title: 'Tag closed' })}
type="primary"
>
Expand Down
7 changes: 6 additions & 1 deletion src/packages/tag/demo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,12 @@ const TagDemo = () => {
<Cell
title="可关闭标签"
linkSlot={
<Tag closeable onClose={() => alert('Tag closed')} type="primary">
<Tag
closeable
iconSize="14px"
onClose={() => alert('Tag closed')}
type="primary"
>
标签
</Tag>
}
Expand Down
2 changes: 2 additions & 0 deletions src/packages/tag/doc.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ export default App;
| round | Whether it is a rounded style | Boolean | `false` |
| mark | Whether it is a tag style | Boolean | `false` |
| closeable | Whether it can be closed label | Boolean | `false` |
| iconSize | the size of closed label | string | number | ` 12px`|

### Event

Expand All @@ -216,6 +217,7 @@ The component provides the following CSS variables, which can be used to customi

| Name | Default Value |
| --- | --- |
| --nutui-tag-padding | ` 0 4px`|
| --nutui-tag-font-size | ` 12px` |
| --nutui-tag-default-border-radius | ` 4px` |
| --nutui-tag-round-border-radius | ` 8px` |
Expand Down
2 changes: 2 additions & 0 deletions src/packages/tag/doc.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ export default App;
| round | 是否为圆角样式 | Boolean | `false` |
| mark | 是否为标记样式 | Boolean | `false` |
| closeable | 是否为可关闭标签 | Boolean | `false` |
| iconSize | 关闭标签的尺寸 | string | number | ` 12px`|

### Event

Expand All @@ -217,6 +218,7 @@ export default App;

| 名称 | 默认值 |
| --- | --- |
| --nutui-tag-padding | ` 0 4px`|
| --nutui-tag-font-size | ` 12px` |
| --nutui-tag-default-border-radius | ` 4px` |
| --nutui-tag-round-border-radius | ` 8px` |
Expand Down
2 changes: 2 additions & 0 deletions src/packages/tag/doc.taro.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ export default App;
| round | 是否为圆角样式 | Boolean | `false` |
| mark | 是否为标记样式 | Boolean | `false` |
| closeable | 是否为可关闭标签 | Boolean | `false` |
| iconSize | 关闭标签的尺寸 | string | number | ` 12px`|

### Event

Expand All @@ -216,6 +217,7 @@ export default App;

| 名称 | 默认值 |
| --- | --- |
| --nutui-tag-padding | ` 0 4px`|
| --nutui-tag-font-size | ` 12px` |
| --nutui-tag-default-border-radius | ` 4px` |
| --nutui-tag-round-border-radius | ` 8px` |
Expand Down
3 changes: 2 additions & 1 deletion src/packages/tag/doc.zh-TW.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ export default App;
| round | 是否為圓角樣式 | Boolean | `false` |
| mark | 是否為標記樣式 | Boolean | `false` |
| closeable | 是否为可关闭標籤 | Boolean | `false` |

| iconSize | 关闭标签的尺寸 | string | number | ` 12px`|

### Event

Expand All @@ -215,6 +215,7 @@ export default App;

| 名稱 | 默認值 |
| --- | --- |
| --nutui-tag-padding | ` 0 4px`|
| --nutui-tag-font-size | ` 12px` |
| --nutui-tag-default-border-radius | ` 4px` |
| --nutui-tag-round-border-radius | ` 8px` |
Expand Down
4 changes: 3 additions & 1 deletion src/packages/tag/tag.scss
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
@import '../icon/icon.scss';

.nut-tag {
padding: 0 4px;
padding: $tag-padding;
display: inline-flex;
justify-content: center;
align-items: center;
font-size: $tag-font-size;
border-radius: $tag-default-border-radius;
height: $tag-height;

._icon {
vertical-align: middle;
margin-left: 4px;
Expand Down
8 changes: 6 additions & 2 deletions src/packages/tag/tag.taro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import React, {
useEffect,
useState,
} from 'react'
import classNames from 'classnames'
import Icon from '@/packages/icon/index.taro'

import { BasicComponent, ComponentDefaults } from '@/utils/typings'
import classNames from 'classnames'

export interface TagProps extends BasicComponent {
type: TagType
Expand All @@ -17,6 +17,7 @@ export interface TagProps extends BasicComponent {
round: boolean
mark: boolean
closeable: boolean
iconSize?: string | number
prefixCls: string
onClick: (e: MouseEvent) => void
onClose: (e?: any) => void
Expand All @@ -34,6 +35,7 @@ const defaultProps = {
round: false,
mark: false,
closeable: false,
iconSize: '12px',
prefixCls: 'nut-tag',
onClose: (e: any) => {},
onClick: (e: MouseEvent) => {},
Expand All @@ -50,6 +52,7 @@ export const Tag: FunctionComponent<Partial<TagProps>> = (props) => {
children,
mark,
closeable,
iconSize,
textColor,
onClick,
onClose,
Expand All @@ -71,6 +74,7 @@ export const Tag: FunctionComponent<Partial<TagProps>> = (props) => {
round,
mark,
closeable,
iconSize,
prefixCls,
onClick,
onClose,
Expand Down Expand Up @@ -125,7 +129,7 @@ export const Tag: FunctionComponent<Partial<TagProps>> = (props) => {
fontClassName={iconFontClassName}
className="_icon"
name="close"
size="12"
size={iconSize}
onClick={(e) => {
setIsTagShow(false)
if (props.onClose) {
Expand Down
8 changes: 6 additions & 2 deletions src/packages/tag/tag.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import React, {
useEffect,
useState,
} from 'react'
import classNames from 'classnames'
import Icon from '@/packages/icon'

import { BasicComponent, ComponentDefaults } from '@/utils/typings'
import classNames from 'classnames'

export interface TagProps extends BasicComponent {
type: TagType
Expand All @@ -17,6 +17,7 @@ export interface TagProps extends BasicComponent {
round: boolean
mark: boolean
closeable: boolean
iconSize?: string | number
prefixCls: string
onClick: (e: MouseEvent) => void
onClose: (e?: any) => void
Expand All @@ -34,6 +35,7 @@ const defaultProps = {
round: false,
mark: false,
closeable: false,
iconSize: '12px',
prefixCls: 'nut-tag',
onClose: (e: any) => {},
onClick: (e: MouseEvent) => {},
Expand All @@ -50,6 +52,7 @@ export const Tag: FunctionComponent<Partial<TagProps>> = (props) => {
children,
mark,
closeable,
iconSize,
textColor,
onClick,
onClose,
Expand All @@ -71,6 +74,7 @@ export const Tag: FunctionComponent<Partial<TagProps>> = (props) => {
round,
mark,
closeable,
iconSize,
prefixCls,
onClick,
onClose,
Expand Down Expand Up @@ -125,7 +129,7 @@ export const Tag: FunctionComponent<Partial<TagProps>> = (props) => {
fontClassName={iconFontClassName}
className="_icon"
name="close"
size="12"
size={iconSize}
onClick={(e) => {
setIsTagShow(false)
if (props.onClose) {
Expand Down
1 change: 1 addition & 0 deletions src/styles/variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1230,6 +1230,7 @@ $timeselect-timedetail-time-font-size: var(
) !default;

//tag(✅)
$tag-padding: var(--nutui-tag-padding, 0 4px) !default;
$tag-font-size: var(--nutui-tag-font-size, 12px) !default;
$tag-default-border-radius: var(
--nutui-tag-default-border-radius,
Expand Down