mirror of
				https://github.com/superseriousbusiness/gotosocial.git
				synced 2025-10-31 18:02:25 -05:00 
			
		
		
		
	[bugfix] Fix wide images being squished when used as instance avatar (#2669)
This commit is contained in:
		
					parent
					
						
							
								291e180990
							
						
					
				
			
			
				commit
				
					
						2d9e498f96
					
				
			
		
					 5 changed files with 52 additions and 27 deletions
				
			
		|  | @ -18,14 +18,25 @@ | ||||||
| */ | */ | ||||||
| 
 | 
 | ||||||
| /* | /* | ||||||
| 	Render instance title a | 	Render instance title + image | ||||||
| 	bit bigger on index page. | 	a bit bigger on index page. | ||||||
|  | 
 | ||||||
|  | 	Overrides the css from page.css. | ||||||
| */ | */ | ||||||
| .page-header a h1 { | .page-header { | ||||||
|  | 	& > a { | ||||||
|  | 		& > h1 { | ||||||
| 			font-size: 2rem; | 			font-size: 2rem; | ||||||
| 			line-height: 2rem; | 			line-height: 2rem; | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
|  | 		& > img { | ||||||
|  | 			align-self: center; | ||||||
|  | 			max-height: 6rem; | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  | 
 | ||||||
| /* | /* | ||||||
| 	Reuse about styling, but rework it | 	Reuse about styling, but rework it | ||||||
| 	to separate sections a bit more. | 	to separate sections a bit more. | ||||||
|  |  | ||||||
|  | @ -50,6 +50,15 @@ | ||||||
| 
 | 
 | ||||||
| 		img { | 		img { | ||||||
| 			align-self: center; | 			align-self: center; | ||||||
|  | 			 | ||||||
|  | 			/* | ||||||
|  | 				Shrink too-wide / too-tall instance | ||||||
|  | 				icons to sensible proportions. Allow | ||||||
|  | 				pretty wide images but prevent things | ||||||
|  | 				getting too out of hand + looking bad. | ||||||
|  | 			*/ | ||||||
|  | 			max-height: 4rem; | ||||||
|  | 			max-width: 16rem; | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		h1 { | 		h1 { | ||||||
|  |  | ||||||
|  | @ -105,19 +105,18 @@ function AdminSettingsForm({ data: instance }: AdminSettingsFormProps) { | ||||||
| 			/> | 			/> | ||||||
| 
 | 
 | ||||||
| 			<div className="file-upload" aria-labelledby="avatar"> | 			<div className="file-upload" aria-labelledby="avatar"> | ||||||
| 				<strong id="avatar">Instance avatar</strong> | 				<strong id="avatar">Instance avatar (1:1 images look best)</strong> | ||||||
| 				<div> | 				<div className="file-upload-with-preview"> | ||||||
| 					<img | 					<img | ||||||
| 						className="preview avatar" | 						className="preview avatar" | ||||||
| 						src={form.thumbnail.previewValue ?? instance?.thumbnail} | 						src={form.thumbnail.previewValue ?? instance?.thumbnail} | ||||||
| 						alt={form.thumbnailDesc.value ?? (instance?.thumbnail ? `Thumbnail image for the instance` : "No instance thumbnail image set")} | 						alt={form.thumbnailDesc.value ?? (instance?.thumbnail ? `Thumbnail image for the instance` : "No instance thumbnail image set")} | ||||||
| 					/> | 					/> | ||||||
| 					<div> | 					<div className="file-input-with-image-description"> | ||||||
| 						<FileInput | 						<FileInput | ||||||
| 							field={form.thumbnail} | 							field={form.thumbnail} | ||||||
| 							accept="image/png, image/jpeg, image/webp, image/gif" | 							accept="image/png, image/jpeg, image/webp, image/gif" | ||||||
| 						/> | 						/> | ||||||
| 						<br/> |  | ||||||
| 						<TextInput | 						<TextInput | ||||||
| 							field={form.thumbnailDesc} | 							field={form.thumbnailDesc} | ||||||
| 							label="Avatar image description" | 							label="Avatar image description" | ||||||
|  |  | ||||||
|  | @ -395,7 +395,8 @@ section.with-sidebar > div, section.with-sidebar > form { | ||||||
| 	gap: 1rem; | 	gap: 1rem; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| .file-upload > div { | .file-upload { | ||||||
|  | 	.file-upload-with-preview { | ||||||
| 		display: flex; | 		display: flex; | ||||||
| 		gap: 1rem; | 		gap: 1rem; | ||||||
| 	 | 	 | ||||||
|  | @ -413,6 +414,13 @@ section.with-sidebar > div, section.with-sidebar > form { | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 	 | 	 | ||||||
|  | 	.file-input-with-image-description { | ||||||
|  | 		display: flex; | ||||||
|  | 		flex-direction: column; | ||||||
|  | 		justify-content: space-around; | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  | 
 | ||||||
| /* | /* | ||||||
| 	Normalize mock profile and make profile | 	Normalize mock profile and make profile | ||||||
| 	header preview pop a bit nicer. | 	header preview pop a bit nicer. | ||||||
|  |  | ||||||
|  | @ -61,8 +61,6 @@ Instance Logo | ||||||
|         src="{{- .instance.Thumbnail -}}" |         src="{{- .instance.Thumbnail -}}" | ||||||
|         alt="{{- template "thumbnailDescription" . -}}" |         alt="{{- template "thumbnailDescription" . -}}" | ||||||
|         title="{{- template "thumbnailDescription" . -}}" |         title="{{- template "thumbnailDescription" . -}}" | ||||||
|         width="100" |  | ||||||
|         height="100" |  | ||||||
|     /> |     /> | ||||||
|     <h1>{{- .instance.Title -}}</h1> |     <h1>{{- .instance.Title -}}</h1> | ||||||
| </a> | </a> | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue