Skip to content

Commit

Permalink
fix(Input): Extended input html props and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
xinyao27 committed Jul 9, 2019
1 parent f6ef8a9 commit 5239223
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 52 deletions.
12 changes: 6 additions & 6 deletions packages/fluent-ui.com/src/docs/components/Input/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ components: Input
```jsx
() => {
const [value, setValue] = React.useState('')
function handleChange(e) {
setValue(e)
function handleChange(v) {
setValue(v)
}
return (
<Input value={value} onChange={handleChange} />
Expand All @@ -36,8 +36,8 @@ components: Input
```jsx
() => {
const [value, setValue] = React.useState('')
function handleChange(e) {
setValue(e)
function handleChange(v) {
setValue(v)
}
return (
<Input value={value} onChange={handleChange} cleared />
Expand All @@ -50,8 +50,8 @@ components: Input
```jsx
() => {
const [value, setValue] = React.useState('')
function handleChange(e) {
setValue(e)
function handleChange(v) {
setValue(v)
}
return (
<Input value={value} onChange={handleChange} password />
Expand Down
6 changes: 5 additions & 1 deletion packages/fluent-ui/src/Input/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ import { forwardRef, ReactElement } from 'react'
import { StyledWrapper, StyledInput, StyledIcon } from './Input.styled'
import { ChromeClose as ChromeCloseIcon } from '@fluent-ui/icons'

export interface InputProps {
export interface InputProps
extends Omit<
React.InputHTMLAttributes<HTMLInputElement>,
'size' | 'value' | 'onChange'
> {
value?: string
onChange?: (value: string) => void
placeholder?: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,51 +10,7 @@ exports[`Input basic 1`] = `
outline: none;
width: 296px;
height: 32px;
font-size: 14px;
padding: 6px 12px;
font-family: PingFangSC-Regular,sans-serif,Arial,Helvetica,Roboto;
border: 2px solid #cccccc;
-webkit-transition: all 250ms cubic-bezier(0.4,0,0.2,1) 0ms;
transition: all 250ms cubic-bezier(0.4,0,0.2,1) 0ms;
}
.c1:hover {
border-color: #7a7a7a;
}
.c1:active,
.c1:focus {
border-color: #0078d7;
}
.c1:disabled {
background-color: #cccccc;
color: #7a7a7a;
cursor: not-allowed;
pointer-events: none;
}
<span
className="c0"
>
<input
className="c1"
onChange={[Function]}
type="text"
/>
</span>
`;

exports[`Input prop cleared 1`] = `
.c0 {
display: inline-block;
position: relative;
}
.c1 {
outline: none;
width: 296px;
height: 32px;
line-height: 32px;
font-size: 14px;
padding: 6px 12px;
font-family: PingFangSC-Regular,sans-serif,Arial,Helvetica,Roboto;
Expand Down

0 comments on commit 5239223

Please sign in to comment.