Skip to content

Commit

Permalink
Added suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
thomheymann committed Jul 19, 2021
1 parent 21168e7 commit 972a2f9
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 7 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
EuiFieldText,
EuiFormRow,
EuiLoadingSpinner,
EuiText,
EuiTextArea,
EuiTitle,
} from '@elastic/eui';
Expand Down Expand Up @@ -102,9 +103,14 @@ export class CustomizeSpace extends Component<Props, State> {
defaultMessage: 'Description',
}
)}
labelAppend={i18n.translate('xpack.spaces.management.manageSpacePage.optionalLabel', {
defaultMessage: 'Optional',
})}
labelAppend={
<EuiText color="subdued" size="xs">
<FormattedMessage
id="xpack.spaces.management.manageSpacePage.optionalLabel"
defaultMessage="Optional"
/>
</EuiText>
}
helpText={i18n.translate(
'xpack.spaces.management.manageSpacePage.spaceDescriptionHelpText',
{
Expand Down Expand Up @@ -176,7 +182,7 @@ export class CustomizeSpace extends Component<Props, State> {
<LazySpaceAvatar
space={{
...space,
initials: undefined,
initials: '?',
name: undefined,
}}
size="xl"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ interface Props {
}

export class CustomizeSpaceAvatar extends Component<Props> {
private storeImageChanges(imageUrl: string) {
private storeImageChanges(imageUrl: string | undefined) {
this.props.onChange({
...this.props.space,
imageUrl,
Expand Down Expand Up @@ -80,7 +80,10 @@ export class CustomizeSpaceAvatar extends Component<Props> {
};

private onFileUpload = (files: FileList | null) => {
if (files == null) return;
if (files == null || files.length === 0) {
this.storeImageChanges(undefined);
return;
}
const file = files[0];
if (imageTypes.indexOf(file.type) > -1) {
encode(file).then((dataurl: string) => this.handleImageUpload(dataurl));
Expand Down

0 comments on commit 972a2f9

Please sign in to comment.