MM-58849 - Fixing upload button in bot screen (#27674)

* MM-58849 - Fixing upload button in bot screen

* Updating fixes

* updating tests
Этот коммит содержится в:
Asaad Mahmood
2024-07-23 20:06:13 +05:00
коммит произвёл GitHub
родитель 819840a077
Коммит d8c16cdfd5
3 изменённых файлов: 23 добавлений и 4 удалений

Просмотреть файл

@@ -89,7 +89,7 @@ exports[`components/integrations/bots/AddBot blank 1`] = `
/> />
</div> </div>
<div <div
className="btn btn-sm btn-primary btn-file" className="btn btn-primary btn-file"
> >
<MemoizedFormattedMessage <MemoizedFormattedMessage
defaultMessage="Upload Image" defaultMessage="Upload Image"
@@ -97,6 +97,7 @@ exports[`components/integrations/bots/AddBot blank 1`] = `
/> />
<input <input
accept=".jpeg,.jpg,.png,.bmp" accept=".jpeg,.jpg,.png,.bmp"
className="btn-file__input"
onChange={[Function]} onChange={[Function]}
type="file" type="file"
/> />

Просмотреть файл

@@ -108,7 +108,7 @@ export type State = {
error: JSX.Element | string; error: JSX.Element | string;
adding: boolean; adding: boolean;
image: string; image: string;
orientationStyles: {transform: string; transformOrigin: string}; orientationStyles: { transform: string; transformOrigin: string };
pictureFile: File | null | string; pictureFile: File | null | string;
}; };
@@ -519,13 +519,14 @@ export default class AddBot extends React.PureComponent<Props, State> {
{removeImageIcon} {removeImageIcon}
</div> </div>
<div <div
className='btn btn-sm btn-primary btn-file' className='btn btn-primary btn-file'
> >
<FormattedMessage <FormattedMessage
id='bots.image.upload' id='bots.image.upload'
defaultMessage='Upload Image' defaultMessage='Upload Image'
/> />
<input <input
className='btn-file__input'
accept={Constants.ACCEPT_STATIC_IMAGE} accept={Constants.ACCEPT_STATIC_IMAGE}
type='file' type='file'
onChange={this.updatePicture} onChange={this.updatePicture}

Просмотреть файл

@@ -99,6 +99,7 @@
} }
.has-error { .has-error {
.help-block, .help-block,
.radio, .radio,
.checkbox, .checkbox,
@@ -148,7 +149,7 @@
padding-right: 1px; padding-right: 1px;
margin-right: 6px; margin-right: 6px;
& + span { &+span {
margin-right: 4px; margin-right: 4px;
font-weight: 600; font-weight: 600;
} }
@@ -204,3 +205,19 @@ input[type="radio"]:focus,
input[type="checkbox"]:focus { input[type="checkbox"]:focus {
outline: none; outline: none;
} }
.btn-file {
position: relative;
overflow: hidden;
.btn-file__input {
position: absolute;
top: 0;
right: 0;
padding: 0;
margin: 0;
cursor: pointer;
filter: alpha(opacity=0);
opacity: 0;
}
}