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

style(input): 增加css 变量,优化demo和文档 #1730

Merged
merged 47 commits into from
Dec 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
49a6aca
feat: uploader taro h5 支持video
xiaoyatong Nov 9, 2023
8297caf
Merge branch 'next' of https://github.com/jdf2e/nutui-react into next
xiaoyatong Nov 13, 2023
9d730d4
Merge branch 'next' of https://github.com/jdf2e/nutui-react into next
xiaoyatong Nov 14, 2023
ecc10ce
fix: delete sth doesnot merge
xiaoyatong Nov 14, 2023
49310f9
Merge branch 'next' of https://github.com/jdf2e/nutui-react into next
xiaoyatong Nov 14, 2023
5b84c0d
Merge branch 'next' of https://github.com/jdf2e/nutui-react into next
xiaoyatong Nov 14, 2023
e633cea
Merge branch 'next' of https://github.com/jdf2e/nutui-react into next
xiaoyatong Nov 14, 2023
bd3aa30
Merge branch 'next' of https://github.com/jdf2e/nutui-react into next
xiaoyatong Nov 15, 2023
6eb249a
Merge branch 'next' of https://github.com/jdf2e/nutui-react into next
xiaoyatong Nov 15, 2023
981162e
Merge branch 'next' of https://github.com/jdf2e/nutui-react into next
xiaoyatong Nov 16, 2023
2369884
Merge branch 'next' of https://github.com/jdf2e/nutui-react into next
xiaoyatong Nov 16, 2023
85f285f
Merge branch 'next' of https://github.com/jdf2e/nutui-react into next
xiaoyatong Nov 17, 2023
f09fec7
Merge branch 'next' of https://github.com/jdf2e/nutui-react into next
xiaoyatong Nov 17, 2023
137b690
Merge branch 'next' of https://github.com/jdf2e/nutui-react into next
xiaoyatong Nov 17, 2023
7ddfca7
Merge branch 'next' of https://github.com/jdf2e/nutui-react into next
xiaoyatong Nov 20, 2023
6f2e558
Merge branch 'next' of https://github.com/jdf2e/nutui-react into next
xiaoyatong Nov 21, 2023
60c4d72
Merge branch 'next' of https://github.com/jdf2e/nutui-react into next
xiaoyatong Nov 21, 2023
3a86c79
Merge branch 'next' of https://github.com/jdf2e/nutui-react into next
xiaoyatong Nov 21, 2023
a927492
Merge branch 'next' of https://github.com/jdf2e/nutui-react into next
xiaoyatong Nov 22, 2023
225acd3
Merge branch 'next' of https://github.com/jdf2e/nutui-react into next
xiaoyatong Nov 22, 2023
0b21faa
Merge branch 'next' of https://github.com/jdf2e/nutui-react into next
xiaoyatong Nov 22, 2023
14cd4e1
Merge branch 'next' of https://github.com/jdf2e/nutui-react into next
xiaoyatong Nov 22, 2023
59fb3db
style: delete dark
xiaoyatong Nov 22, 2023
068f800
Merge branch 'next' of https://github.com/jdf2e/nutui-react into next
xiaoyatong Nov 22, 2023
8f490ea
Merge branch 'next' of https://github.com/jdf2e/nutui-react into next
xiaoyatong Nov 23, 2023
f63d00c
Merge branch 'next' of https://github.com/jdf2e/nutui-react into next
xiaoyatong Nov 23, 2023
53783e1
Merge branch 'next' of https://github.com/jdf2e/nutui-react into next
xiaoyatong Nov 23, 2023
334bb27
Merge branch 'next' of https://github.com/jdf2e/nutui-react into next
xiaoyatong Nov 24, 2023
b5b3129
Merge branch 'next' of https://github.com/jdf2e/nutui-react into next
xiaoyatong Nov 24, 2023
dea6141
Merge branch 'next' of https://github.com/jdf2e/nutui-react into next
xiaoyatong Nov 24, 2023
253eecf
Merge branch 'next' of https://github.com/jdf2e/nutui-react into next
xiaoyatong Nov 27, 2023
ac3c216
Merge branch 'next' of https://github.com/jdf2e/nutui-react into next
xiaoyatong Nov 27, 2023
a856800
Merge branch 'next' of https://github.com/jdf2e/nutui-react into next
xiaoyatong Nov 27, 2023
a391d51
Merge branch 'next' of https://github.com/jdf2e/nutui-react into next
xiaoyatong Nov 29, 2023
9ed5ddf
Merge branch 'next' of https://github.com/jdf2e/nutui-react into next
xiaoyatong Nov 29, 2023
b830fe5
Merge branch 'next' of https://github.com/jdf2e/nutui-react into next
xiaoyatong Nov 29, 2023
ae0c326
Merge branch 'next' of https://github.com/jdf2e/nutui-react into next
xiaoyatong Nov 29, 2023
44dd196
Merge branch 'next' of https://github.com/jdf2e/nutui-react into next
xiaoyatong Nov 30, 2023
51a4f9b
Merge branch 'next' of https://github.com/jdf2e/nutui-react into next
xiaoyatong Nov 30, 2023
feb185e
Merge branch 'next' of https://github.com/jdf2e/nutui-react into next
xiaoyatong Nov 30, 2023
bbc4971
Merge branch 'next' of https://github.com/jdf2e/nutui-react into next
xiaoyatong Nov 30, 2023
f8e5769
Merge branch 'next' of https://github.com/jdf2e/nutui-react into next
xiaoyatong Nov 30, 2023
84c6c16
Merge branch 'next' of https://github.com/jdf2e/nutui-react into next
xiaoyatong Dec 1, 2023
7765439
Merge branch 'next' of https://github.com/jdf2e/nutui-react into next
xiaoyatong Dec 1, 2023
0680e33
Merge branch 'next' of https://github.com/jdf2e/nutui-react into next
xiaoyatong Dec 1, 2023
0de6790
Merge branch 'next' of https://github.com/jdf2e/nutui-react into next
xiaoyatong Dec 1, 2023
5b8869b
feat(input): 增加css 变量,优化demo和文档
xiaoyatong Dec 1, 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
19 changes: 8 additions & 11 deletions src/packages/input/demo.taro.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useState } from 'react'
import Taro from '@tarojs/taro'
import { Ask, Close, Eye } from '@nutui/icons-react-taro'
import { Tips, Close, Eye, Marshalling } from '@nutui/icons-react-taro'
import { useTranslate } from '@/sites/assets/locale/taro'
import { Input, Button } from '@/packages/nutui.react.taro'
import Header from '@/sites/components/header'
Expand Down Expand Up @@ -152,15 +152,9 @@ const InputDemo = () => {
}
>
{inputType === 'text' ? (
<Eye size={14} />
<Eye color="var(--nutui-gray-7)" />
) : (
<img
width="16px"
height="16px"
style={{ display: 'block' }}
src="https://storage.360buyimg.com/imgtools/ac2c6b6b23-a6a8f1d0-ea4b-11ed-8ae6-f73921e8465b.png"
alt=""
/>
<Marshalling color="var(--nutui-gray-7)" />
)}
</div>
</div>
Expand Down Expand Up @@ -188,8 +182,11 @@ const InputDemo = () => {
padding: '0 10px',
}}
>
<Ask />
<Input placeholder={translated.codeplaceholder} />
<Tips color="var(--nutui-gray-7)" />
<Input
placeholder={translated.codeplaceholder}
style={{ '--nutui-input-padding': '10px' }}
/>
<div
className="right"
style={{ display: 'flex', alignItems: 'center' }}
Expand Down
19 changes: 8 additions & 11 deletions src/packages/input/demo.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useState } from 'react'
import { Ask, Close, Eye } from '@nutui/icons-react'
import { Tips, Close, Eye, Marshalling } from '@nutui/icons-react'
import { Input } from './input'
import Form from '@/packages/form'
import { useTranslate } from '../../sites/assets/locale'
Expand Down Expand Up @@ -157,15 +157,9 @@ const InputDemo = () => {
}
>
{inputType === 'text' ? (
<Eye />
<Eye color="var(--nutui-gray-7)" />
) : (
<img
width="16px"
height="16px"
style={{ display: 'block' }}
src="https://storage.360buyimg.com/imgtools/ac2c6b6b23-a6a8f1d0-ea4b-11ed-8ae6-f73921e8465b.png"
alt=""
/>
<Marshalling color="var(--nutui-gray-7)" />
)}
</div>
</div>
Expand Down Expand Up @@ -193,8 +187,11 @@ const InputDemo = () => {
padding: '0 10px',
}}
>
<Ask />
<Input placeholder={translated.codeplaceholder} />
<Tips color="var(--nutui-gray-7)" />
<Input
placeholder={translated.codeplaceholder}
style={{ '--nutui-input-padding': '10px' }}
/>
<div className="right">
<Button type="primary" size="small">
{translated.sendCode}
Expand Down
25 changes: 14 additions & 11 deletions src/packages/input/doc.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ export default App;
```tsx
import React, { useState } from "react";
import { Input, Button } from '@nutui/nutui-react';
import { Ask } from '@nutui/icons-react'
import { Tips } from '@nutui/icons-react'

const App = () => {
return (
Expand All @@ -213,7 +213,7 @@ const App = () => {
padding: '0 10px',
}}
>
<Ask />
<Tips />
<Input placeholder="Please enter the SMS verification code" />
<div className="right">
<Button type="primary" size="small">
Expand Down Expand Up @@ -275,16 +275,19 @@ export default App;
| onClear | Triggered when the clear button is clicked | `(value: string) => void` | `-` |
| onClick | Triggered when the input container is clicked | `(value: MouseEvent<HTMLDivElement>) => void` | `-` |

## 主题定制
## Theming

### 样式变量
### CSS Variables

组件提供了下列 CSS 变量,可用于自定义样式,使用方法请参考 [ConfigProvider 组件](#/zh-CN/component/configprovider)
The component provides the following CSS variables, which can be used to customize styles. Please refer to [ConfigProvider component](#/en-US/component/configprovider).

| 名称 | 说明 | 默认值 |
| Name | Description | Default |
| --- | --- | --- |
| \--nutui-input-border-bottom | 边框颜色 | `#eaf0fb` |
| \--nutui-input-border-bottom-width | 边框宽度 | `0px` |
| \--nutui-input-disabled-color | 禁用的文本颜色 | `#c8c9cc` |
| \--nutui-input-font-size | 文本字号 | `$font-size-base` |
| \--nutui-input-padding | 输入框容器的内边距 | `10px 25px` |
| \--nutui-input-border-bottom | border color | `#eaf0fb` |
| \--nutui-input-border-bottom-width | border width | `0px` |
| \--nutui-input-color | color | `$color-title` |
| \--nutui-input-disabled-color | disable color | `#c8c9cc` |
| \--nutui-input-background-color | background color | `$color-background-overlay` |
| \--nutui-input-border-radius | border radius | `0` |
| \--nutui-input-font-size | font size | `$font-size-base` |
| \--nutui-input-padding | input padding | `10px 25px` |
7 changes: 5 additions & 2 deletions src/packages/input/doc.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ export default App;
```tsx
import React, { useState } from "react";
import { Input, Button } from '@nutui/nutui-react';
import { Ask } from '@nutui/icons-react'
import { Tips } from '@nutui/icons-react'

const App = () => {
return (
Expand All @@ -213,7 +213,7 @@ const App = () => {
padding: '0 10px',
}}
>
<Ask />
<Tips />
<Input placeholder="请输入短信验证码" />
<div className="right">
<Button type="primary" size="small">
Expand Down Expand Up @@ -288,6 +288,9 @@ export default App;
| --- | --- | --- |
| \--nutui-input-border-bottom | 边框颜色 | `#eaf0fb` |
| \--nutui-input-border-bottom-width | 边框宽度 | `0px` |
| \--nutui-input-color | 文本颜色 | `$color-title` |
| \--nutui-input-disabled-color | 禁用的文本颜色 | `#c8c9cc` |
| \--nutui-input-background-color | 输入框背景颜色 | `$color-background-overlay` |
| \--nutui-input-border-radius | 输入框圆角 | `0` |
| \--nutui-input-font-size | 文本字号 | `$font-size-base` |
| \--nutui-input-padding | 输入框容器的内边距 | `10px 25px` |
7 changes: 5 additions & 2 deletions src/packages/input/doc.taro.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ export default App;
```tsx
import React, { useState } from "react";
import { Input, Button } from '@nutui/nutui-react-taro';
import { Ask } from '@nutui/icons-react-taro'
import { Tips } from '@nutui/icons-react-taro'

const App = () => {
return (
Expand All @@ -213,7 +213,7 @@ const App = () => {
padding: '0 10px',
}}
>
<Ask />
<Tips />
<Input placeholder="请输入短信验证码" />
<div
className="right"
Expand Down Expand Up @@ -291,6 +291,9 @@ export default App;
| --- | --- | --- |
| \--nutui-input-border-bottom | 边框颜色 | `#eaf0fb` |
| \--nutui-input-border-bottom-width | 边框宽度 | `0px` |
| \--nutui-input-color | 文本颜色 | `$color-title` |
| \--nutui-input-disabled-color | 禁用的文本颜色 | `#c8c9cc` |
| \--nutui-input-background-color | 输入框背景颜色 | `$color-background-overlay` |
| \--nutui-input-border-radius | 输入框圆角 | `0` |
| \--nutui-input-font-size | 文本字号 | `$font-size-base` |
| \--nutui-input-padding | 输入框容器的内边距 | `10px 25px` |
7 changes: 5 additions & 2 deletions src/packages/input/doc.zh-TW.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ export default App;
```tsx
import React, { useState } from "react";
import { Input, Button } from '@nutui/nutui-react';
import { Ask } from '@nutui/icons-react'
import { Tips } from '@nutui/icons-react'

const App = () => {
return (
Expand All @@ -213,7 +213,7 @@ const App = () => {
padding: '0 10px',
}}
>
<Ask />
<Tips />
<Input placeholder={translated.codeplaceholder} />
<div className="right">
<Button type="primary" size="small">
Expand Down Expand Up @@ -285,6 +285,9 @@ export default App;
| --- | --- | --- |
| \--nutui-input-border-bottom | 边框颜色 | `#eaf0fb` |
| \--nutui-input-border-bottom-width | 边框宽度 | `0px` |
| \--nutui-input-color | 文本颜色 | `$color-title` |
| \--nutui-input-disabled-color | 禁用的文本颜色 | `#c8c9cc` |
| \--nutui-input-background-color | 输入框背景颜色 | `$color-background-overlay` |
| \--nutui-input-border-radius | 输入框圆角 | `0` |
| \--nutui-input-font-size | 文本字号 | `$font-size-base` |
| \--nutui-input-padding | 输入框容器的内边距 | `10px 25px` |
6 changes: 4 additions & 2 deletions src/packages/input/input.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
width: 100%;
padding: $input-padding;
line-height: 24px;
background: $white;
font-size: $input-font-size;
box-sizing: border-box;
border-radius: $input-border-radius;
background-color: $input-background-color;
border-bottom: $input-border-bottom-width solid $input-border-bottom;

.nut-icon {
Expand All @@ -17,14 +18,15 @@

.nut-input-native {
width: 100%;
color: $gray1;
color: $input-color;
flex: 1;
background-color: transparent;
padding: 0;
border: 0;
outline: 0 none;
font: inherit;
text-decoration: none;
background-color: transparent;
}

&-disabled {
Expand Down
4 changes: 3 additions & 1 deletion src/styles/variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -592,10 +592,12 @@ $input-border-bottom-width: var(
) !default;
$input-disabled-color: var(--nutui-input-disabled-color, #c8c9cc) !default;
$input-font-size: var(--nutui-input-font-size, $font-size-base) !default;
$input-border-radius: var(--nutui-input-border-radius, 0) !default;
$input-color: var(--nutui-input-color, $gray1) !default;
$input-background-color: var(--nutui-input-background-color, $white) !default;
$input-padding: var(--nutui-input-padding, 10px 25px) !default;

// textarea(✅)

$textarea-font: var(--nutui-textarea-font, $font-size-base) !default;
$textarea-padding: var(--nutui-textarea-padding, 10px 25px) !default;
$textarea-limit-color: var(--nutui-textarea-limit-color, $text-color) !default;
Expand Down