Limit logo upload to either SVG or PNG

This commit is contained in:
crockwave 2020-08-02 14:07:13 -05:00
parent ba18c3a643
commit 1f6ca55366
2 changed files with 10 additions and 1 deletions

View file

@ -11,6 +11,7 @@ import {
TextInput,
Checkbox,
FileChooser,
FileChooserLogo,
} from 'soapbox/features/forms';
import StillImage from 'soapbox/components/still_image';
import {
@ -261,7 +262,7 @@ class ConfigSoapbox extends ImmutablePureComponent {
{this.state.logo ? (<StillImage src={this.state.logo || ''} />) : (<StillImage src={this.props.logo || ''} />)}
</div>
<div className='fields-row__column fields-group fields-row__column-6'>
<FileChooser
<FileChooserLogo
label={<FormattedMessage id='soapbox_settings.fields.logo_label' defaultMessage='Logo' />}
name='logo'
hint={<FormattedMessage id='soapbox_settings.hints.logo' defaultMessage='SVG. At most 2 MB. Will be downscaled to 50px height, maintaining aspect ratio' />}

View file

@ -222,3 +222,11 @@ export const FileChooser = props => (
FileChooser.defaultProps = {
accept: ['image/jpeg', 'image/png', 'image/gif', 'image/webp'],
};
export const FileChooserLogo = props => (
<SimpleInput type='file' {...props} />
);
FileChooserLogo.defaultProps = {
accept: ['image/svg', 'image/png'],
};