Skip to content

Commit

Permalink
perf(badge): increase size when used alone (#1118)
Browse files Browse the repository at this point in the history
* fix: fix text-overflow bug

* docs: support docs site for 1.x

* chore: sort versions

* fix: fix readOnly style of CustomInput

* fix: clear event and remove useless element

* perf(badge): increase size when used alone
  • Loading branch information
JeromeLin committed Jun 8, 2023
1 parent 6762785 commit 606c676
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 13 deletions.
1 change: 1 addition & 0 deletions packages/zarm/src/badge/Badge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export interface BadgeCssVars {
'--text-color'?: React.CSSProperties['color'];
'--border-color'?: React.CSSProperties['borderColor'];
'--font-size'?: React.CSSProperties['fontSize'];
'--font-weight'?: React.CSSProperties['fontWeight'];
'--height'?: React.CSSProperties['height'];
'--padding-horizontal'?: React.CSSProperties['padding'];
'--border-radius'?: React.CSSProperties['borderRadius'];
Expand Down
3 changes: 2 additions & 1 deletion packages/zarm/src/badge/demo.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ ReactDOM.render(
</Badge>
</div>
<div className="box">
<Badge bordered shape="rect" text="免费">
<Badge bordered shape="round" text="免费">
<div className="box-item" />
</Badge>
</div>
Expand Down Expand Up @@ -131,6 +131,7 @@ ReactDOM.render(
| --text-color | '#fff' | 徽标文字颜色 |
| --border-color | '#fff' | 徽标边框色 |
| --font-size | '10px' | 徽标文字字体大小 |
| --font-weight | 600 | 徽标文字字体粗细 |
| --height | '14px' | 徽标高度 |
| --padding-horizontal | '4px' | 徽标左右内边距 |
| --border-radius | 'var(--za-radius-sm)' | 徽标圆角大小 |
Expand Down
17 changes: 13 additions & 4 deletions packages/zarm/src/badge/style/component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
@include define(color, var(--za-theme-danger));
@include define(text-color, #fff);
@include define(border-color, #fff);
@include define(font-size, 10px);
@include define(height, 14px);
@include define(font-size, 12px);
@include define(font-weight, 600);
@include define(height, 20px);
@include define(padding-horizontal, 4px);
@include define(border-radius, var(--za-radius-sm));
@include define(top, 0);
Expand All @@ -26,6 +27,7 @@
background-color: var(--color);
color: var(--text-color);
font-size: var(--font-size);
font-weight: var(--font-weight);
height: var(--height);
padding: 0 var(--padding-horizontal);
white-space: nowrap;
Expand All @@ -35,9 +37,9 @@

@include m(dot) {
@include define(height, var(--dot-size));

@include e(content) {
width: var(--dot-size);
height: var(--dot-size);
width: var(--height);
border-radius: 50%;
padding: 0;
}
Expand Down Expand Up @@ -72,6 +74,13 @@
}

@include m(sup) {
@include define(font-size, 10px);
@include define(height, 16px);

@include m(dot) {
@include define(height, var(--dot-size));
}

@include e(content) {
position: absolute;
top: var(--top);
Expand Down
2 changes: 0 additions & 2 deletions packages/zarm/src/custom-input/CustomInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,6 @@ const CustomInput = React.forwardRef<CustomInputRef, CustomInputProps>((props, r
const onInputClear = (e) => {
e.stopPropagation();
setValue('');

setValue?.('');
};

const scrollToStart = () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/zarm/src/input/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -151,14 +151,14 @@ const Input = React.forwardRef<unknown, InputProps>((props, ref) => {

// 渲染输入框
const inputRender = isTextarea ? (
<div className={bem('inner')}>
<>
<textarea
ref={inputRef as React.RefObject<HTMLTextAreaElement>}
{...(commonProps as React.HTMLAttributes<HTMLTextAreaElement>)}
rows={rows}
/>
{textLengthRender}
</div>
</>
) : (
<input
ref={inputRef as React.RefObject<HTMLInputElement>}
Expand Down
4 changes: 0 additions & 4 deletions packages/zarm/src/input/style/mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@
overflow: visible;
}

@include e(inner) {
flex: 1;
}

@include e(label) {
font-size: var(--label-font-size);
line-height: var(--line-height);
Expand Down

1 comment on commit 606c676

@vercel
Copy link

@vercel vercel bot commented on 606c676 Jun 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

zarm – ./

zarm-zhongantech.vercel.app
zarm-git-master-zhongantech.vercel.app

Please sign in to comment.