Skip to content

Commit

Permalink
feat(file-input): Add buttonType property
Browse files Browse the repository at this point in the history
  • Loading branch information
qafoori committed Apr 21, 2024
1 parent 18219d6 commit 7581afe
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions dist/components/file-input/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export interface FileInputProps extends React.HTMLProps<HTMLInputElement> {
tryAgainText?: string | React.ReactNode;
inputRef?: React.RefObject<HTMLInputElement>;
isClear?: boolean;
buttonType?: React.ButtonHTMLAttributes<HTMLButtonElement>['type'];
}
export interface FileInputState {
touched: boolean;
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4374,7 +4374,7 @@ var FileInput = /** @class */ (function (_super) {
files.map(function (file, index) {
return _this.renderFiles(states && states[index], file, index);
}),
React.createElement(button_1.default, { disabled: disabled, primary: true },
React.createElement(button_1.default, { type: props.buttonType, disabled: disabled, primary: true },
children ? children : 'افزودن فایل',
React.createElement("input", __assign({ disabled: disabled, type: "file", ref: inputRef, onChange: this.handleInput, value: "" }, props))))));
};
Expand Down
3 changes: 2 additions & 1 deletion src/components/file-input/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export interface FileInputProps extends React.HTMLProps<HTMLInputElement> {
tryAgainText?: string | React.ReactNode;
inputRef?: React.RefObject<HTMLInputElement>;
isClear?: boolean;
buttonType?: React.ButtonHTMLAttributes<HTMLButtonElement>['type'];
}

export interface FileInputState {
Expand Down Expand Up @@ -138,7 +139,7 @@ class FileInput extends React.Component<FileInputProps, FileInputState> {
files.map((file, index) =>
this.renderFiles(states && states[index], file, index),
)}
<Button disabled={disabled} primary>
<Button type={props.buttonType} disabled={disabled} primary>
{children ? children : 'افزودن فایل'}
<input
disabled={disabled}
Expand Down

0 comments on commit 7581afe

Please sign in to comment.